Skip to content

Commit eaa39f6

Browse files
authored
Merge pull request #3 from lucidcode/feature/512-hz
Add 512 Hz channel
2 parents 930fffa + 7f7115c commit eaa39f6

3 files changed

Lines changed: 223 additions & 30 deletions

File tree

Installer/Lucid Scribe Interval.vdproj

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,25 +52,25 @@
5252
"Entry"
5353
{
5454
"MsmKey" = "8:_UNDEFINED"
55-
"OwnerKey" = "8:_35DE2A9363DCB4CF8BD6FE7230ECF565"
55+
"OwnerKey" = "8:_F4D7EA65385449C7AA2351CC0180CB34"
5656
"MsmSig" = "8:_UNDEFINED"
5757
}
5858
"Entry"
5959
{
6060
"MsmKey" = "8:_UNDEFINED"
61-
"OwnerKey" = "8:_F4D7EA65385449C7AA2351CC0180CB34"
61+
"OwnerKey" = "8:_AB22893621B134E2FE1D696ECCAC5328"
6262
"MsmSig" = "8:_UNDEFINED"
6363
}
6464
"Entry"
6565
{
6666
"MsmKey" = "8:_UNDEFINED"
67-
"OwnerKey" = "8:_AB22893621B134E2FE1D696ECCAC5328"
67+
"OwnerKey" = "8:_189DAF5A5D4EEC74A935C36FF0C90FBF"
6868
"MsmSig" = "8:_UNDEFINED"
6969
}
7070
"Entry"
7171
{
7272
"MsmKey" = "8:_UNDEFINED"
73-
"OwnerKey" = "8:_189DAF5A5D4EEC74A935C36FF0C90FBF"
73+
"OwnerKey" = "8:_35DE2A9363DCB4CF8BD6FE7230ECF565"
7474
"MsmSig" = "8:_UNDEFINED"
7575
}
7676
}
@@ -170,7 +170,7 @@
170170
{
171171
"Name" = "8:.NET Framework"
172172
"Message" = "8:[VSDNETMSG]"
173-
"FrameworkVersion" = "8:3.5.30729 "
173+
"FrameworkVersion" = "8:3.5.30729 "
174174
"AllowLaterVersions" = "11:FALSE"
175175
"InstallUrl" = "8:http://go.microsoft.com/fwlink/?LinkId=76617"
176176
}
@@ -411,15 +411,15 @@
411411
{
412412
"Name" = "8:Microsoft Visual Studio"
413413
"ProductName" = "8:Lucid Scribe Interval"
414-
"ProductCode" = "8:{7B737FF4-4CB1-4CBA-B0B6-B47509BC231F}"
415-
"PackageCode" = "8:{D3787BE4-7299-4CC8-8021-FDC25F29BE66}"
414+
"ProductCode" = "8:{EC4EE151-B7CC-402B-8569-F06F6AAD0126}"
415+
"PackageCode" = "8:{9691D196-5307-49E6-B654-3BF7B8CD5041}"
416416
"UpgradeCode" = "8:{D69BA483-0900-4583-859C-3AAE825E4801}"
417417
"AspNetVersion" = "8:4.0.30319.0"
418418
"RestartWWWService" = "11:FALSE"
419419
"RemovePreviousVersions" = "11:FALSE"
420420
"DetectNewerInstalledVersion" = "11:TRUE"
421421
"InstallAllUsers" = "11:TRUE"
422-
"ProductVersion" = "8:1.0.4"
422+
"ProductVersion" = "8:1.0.5"
423423
"Manufacturer" = "8:lucidcode"
424424
"ARPHELPTELEPHONE" = "8:"
425425
"ARPHELPLINK" = "8:https://www.lucidcode.com/Contact"

Interval/PluginHandler.cs

Lines changed: 213 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,236 @@
11
using System;
2+
using System.Drawing;
3+
using System.Linq;
24

35
namespace lucidcode.LucidScribe.Plugin.Interval
46
{
5-
public class PluginHandler : Interface.LucidPluginBase
7+
public static class Device
68
{
7-
private int interval = 40;
8-
private int lastSecond = -1;
9-
private DateTime lastTrigger;
9+
public static EventHandler<EventArgs> ValueChanged;
1010

11-
public override string Name
11+
static bool initialized;
12+
private static int delay = 40;
13+
private static int lastSecond = -1;
14+
private static DateTime lastTrigger;
15+
16+
private static System.Threading.Timer timer;
17+
18+
static int interval;
19+
20+
public static Boolean Initialize()
1221
{
13-
get
22+
if (initialized)
1423
{
15-
return "Interval REM";
24+
return true;
1625
}
26+
initialized = true;
27+
timer = new System.Threading.Timer(Tick, "interval", TimeSpan.FromMilliseconds(10), TimeSpan.FromMilliseconds(500));
28+
return true;
1729
}
1830

19-
public override bool Initialize()
31+
private static void Tick(object state)
2032
{
21-
lastTrigger = DateTime.Now;
22-
return true;
33+
if (lastSecond == DateTime.Now.Second)
34+
{
35+
return;
36+
}
37+
38+
if (DateTime.Now >= lastTrigger.AddSeconds(delay) &&
39+
lastSecond != DateTime.Now.Second)
40+
{
41+
lastTrigger = DateTime.Now;
42+
lastSecond = DateTime.Now.Second;
43+
interval = 888;
44+
}
45+
else
46+
{
47+
interval = 1;
48+
}
49+
50+
string values = string.Join(",", Enumerable.Repeat(interval, 512));
51+
52+
if (ValueChanged != null)
53+
{
54+
ValueChanged((object)values, null);
55+
}
2356
}
2457

25-
public override double Value
58+
public static void Dispose()
2659
{
27-
get
60+
timer.Dispose();
61+
}
62+
63+
public static Double GetInterval()
64+
{
65+
return interval;
66+
}
67+
}
68+
69+
namespace Timer
70+
{
71+
public class PluginHandler : Interface.LucidPluginBase
72+
{
73+
private DateTime lastTrigger;
74+
75+
public override string Name
2876
{
29-
if (DateTime.Now >= lastTrigger.AddSeconds(interval) &&
30-
lastSecond != DateTime.Now.Second)
77+
get
3178
{
32-
lastTrigger = DateTime.Now;
33-
lastSecond = DateTime.Now.Second;
34-
return 888;
79+
return "Interval REM";
3580
}
81+
}
3682

37-
return 1;
83+
public override bool Initialize()
84+
{
85+
try
86+
{
87+
return Device.Initialize();
88+
}
89+
catch (Exception ex)
90+
{
91+
throw (new Exception("The '" + Name + "' plugin failed to initialize: " + ex.Message));
92+
}
3893
}
39-
}
4094

95+
public override double Value
96+
{
97+
get
98+
{
99+
double value = Device.GetInterval();
100+
if (value == 888 && DateTime.Now >= lastTrigger.AddSeconds(3))
101+
{
102+
lastTrigger = DateTime.Now;
103+
return value;
104+
}
105+
return 1;
106+
}
107+
}
108+
109+
public override void Dispose()
110+
{
111+
Device.Dispose();
112+
}
113+
}
41114
}
42115

43-
}
116+
namespace RAW
117+
{
118+
public class PluginHandler : Interface.ILluminatedPlugin
119+
{
120+
public string Name
121+
{
122+
get
123+
{
124+
return "Interval RAW";
125+
}
126+
}
127+
128+
public bool Initialize()
129+
{
130+
try
131+
{
132+
bool initialized = Device.Initialize();
133+
Device.ValueChanged += ValueChanged;
134+
return initialized;
135+
}
136+
catch (Exception ex)
137+
{
138+
throw (new Exception("The '" + Name + "' plugin failed to initialize: " + ex.Message));
139+
}
140+
}
141+
142+
public event Interface.SenseHandler Sensed;
143+
public void ValueChanged(object sender, EventArgs e)
144+
{
145+
if (ClearTicks)
146+
{
147+
ClearTicks = false;
148+
TickCount = "";
149+
}
150+
TickCount += sender + ",";
151+
152+
if (ClearBuffer)
153+
{
154+
ClearBuffer = false;
155+
BufferData = "";
156+
}
157+
BufferData += sender + ",";
158+
}
159+
160+
public void Dispose()
161+
{
162+
Device.ValueChanged -= ValueChanged;
163+
Device.Dispose();
164+
}
165+
166+
public Boolean isEnabled = false;
167+
public Boolean Enabled
168+
{
169+
get
170+
{
171+
return isEnabled;
172+
}
173+
set
174+
{
175+
isEnabled = value;
176+
}
177+
}
178+
179+
public Color PluginColor = Color.White;
180+
public Color Color
181+
{
182+
get
183+
{
184+
return Color;
185+
}
186+
set
187+
{
188+
Color = value;
189+
}
190+
}
191+
192+
private Boolean ClearTicks = false;
193+
public String TickCount = "";
194+
public String Ticks
195+
{
196+
get
197+
{
198+
ClearTicks = true;
199+
return TickCount;
200+
}
201+
set
202+
{
203+
TickCount = value;
204+
}
205+
}
206+
207+
private Boolean ClearBuffer = false;
208+
public String BufferData = "";
209+
public String Buffer
210+
{
211+
get
212+
{
213+
ClearBuffer = true;
214+
return BufferData;
215+
}
216+
set
217+
{
218+
BufferData = value;
219+
}
220+
}
221+
222+
int lastHour;
223+
public int LastHour
224+
{
225+
get
226+
{
227+
return lastHour;
228+
}
229+
set
230+
{
231+
lastHour = value;
232+
}
233+
}
234+
}
235+
}
236+
}

Interval/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("1.0.4.0")]
36-
[assembly: AssemblyFileVersion("1.0.4.0")]
35+
[assembly: AssemblyVersion("1.0.5.0")]
36+
[assembly: AssemblyFileVersion("1.0.5.0")]

0 commit comments

Comments
 (0)