Skip to content

Commit

Permalink
Add RAW vision channel
Browse files Browse the repository at this point in the history
  • Loading branch information
IAmCoder committed Aug 13, 2022
1 parent 360cb4a commit 066816b
Show file tree
Hide file tree
Showing 5 changed files with 202 additions and 5 deletions.
Binary file not shown.
3 changes: 3 additions & 0 deletions Halovision/Halovision.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@
<HintPath>Dependencies\lucidcode.LucidScribe.Interface.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="lucidcode.LucidScribe.Interface.Illuminated">
<HintPath>Dependencies\lucidcode.LucidScribe.Interface.Illuminated.dll</HintPath>
</Reference>
<Reference Include="lucidcode.LucidScribe.TCMP">
<HintPath>Dependencies\lucidcode.LucidScribe.TCMP.dll</HintPath>
</Reference>
Expand Down
158 changes: 154 additions & 4 deletions Halovision/PluginHandler.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Media;
using System.Threading;
Expand All @@ -12,6 +13,11 @@ public static class Device
static bool Initialized;
static bool InitError;
static int Value = 0;
static int Readings = 0;

private static bool clearValue;

public static EventHandler<EventArgs> VisionChanged;

static VisionForm visionForm;
public static bool Initialize()
Expand All @@ -38,7 +44,20 @@ public static bool Initialize()

private static void VisionForm_ValueChanged(int value)
{
Value = value;
Value = Value + value;
Readings = Readings + 1;

if (clearValue)
{
clearValue = false;
Readings = 0;
Value = 0;
}

if (VisionChanged != null)
{
VisionChanged((object)value, null);
}
}

static void loadVisionForm()
Expand Down Expand Up @@ -73,7 +92,13 @@ public static void Dispose()

public static int GetVision()
{
return Value;
//if (Readings == 0) return 0;

int value = Value; //
// Readings;
//if (Readings > 0) value = value / Readings;
clearValue = true;
return value;
}

public static int GetTossThreshold()
Expand Down Expand Up @@ -261,8 +286,6 @@ namespace Vision
{
public class PluginHandler : lucidcode.LucidScribe.Interface.LucidPluginBase
{
SoundPlayer sound = new SoundPlayer();

public override string Name
{
get
Expand All @@ -273,6 +296,10 @@ public override string Name

public override bool Initialize()
{

if (Device.Auralize) {
System.Media.SystemSounds.Asterisk.Play();
}
return Device.Initialize();
}

Expand Down Expand Up @@ -307,6 +334,7 @@ private void Auralize(double frequency)
soundBytes.AddRange(format.GetBytes());
soundBytes.AddRange(austioChunk.GetBytes());

var sound = new SoundPlayer();
sound.Stream = new MemoryStream(soundBytes.ToArray());
sound.Play();
}
Expand All @@ -318,6 +346,128 @@ public override void Dispose()
}
}

namespace RAW
{
public class PluginHandler : lucidcode.LucidScribe.Interface.ILluminatedPlugin
{

public string Name
{
get
{
return "Halovision RAW";
}
}

public bool Initialize()
{
try
{
bool initialized = Device.Initialize();
Device.VisionChanged += VisionChanged;
return initialized;
}
catch (Exception ex)
{
throw (new Exception("The '" + Name + "' plugin failed to initialize: " + ex.Message));
}
}

public event Interface.SenseHandler Sensed;
public void VisionChanged(object sender, EventArgs e)
{
if (ClearTicks)
{
ClearTicks = false;
TickCount = "";
}
TickCount += sender + ",";

if (ClearBuffer)
{
ClearBuffer = false;
BufferData = "";
}
BufferData += sender + ",";
}

public void Dispose()
{
Device.VisionChanged -= VisionChanged;
Device.Dispose();
}

public Boolean isEnabled = false;
public Boolean Enabled
{
get
{
return isEnabled;
}
set
{
isEnabled = value;
}
}

public Color PluginColor = Color.White;
public Color Color
{
get
{
return Color;
}
set
{
Color = value;
}
}

private Boolean ClearTicks = false;
public String TickCount = "";
public String Ticks
{
get
{
ClearTicks = true;
return TickCount;
}
set
{
TickCount = value;
}
}

private Boolean ClearBuffer = false;
public String BufferData = "";
public String Buffer
{
get
{
ClearBuffer = true;
return BufferData;
}
set
{
BufferData = value;
}
}

int lastHour;
public int LastHour
{
get
{
return lastHour;
}
set
{
lastHour = value;
}
}
}
}

namespace REM
{
public class PluginHandler : lucidcode.LucidScribe.Interface.LucidPluginBase
Expand Down
1 change: 1 addition & 0 deletions Halovision/VisionForm.designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

45 changes: 44 additions & 1 deletion Installer/Lucid Scribe Halovision.vdproj
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,12 @@
}
"Entry"
{
"MsmKey" = "8:_5294BB40EE33B2C3602EF328FF25AADE"
"OwnerKey" = "8:_395AC690E5F04358B866710FD743FFE4"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
{
"MsmKey" = "8:_53FD229DEDBBC6B6C38C5D53D2512E09"
"OwnerKey" = "8:_395AC690E5F04358B866710FD743FFE4"
"MsmSig" = "8:_UNDEFINED"
Expand Down Expand Up @@ -2002,6 +2008,12 @@
"Entry"
{
"MsmKey" = "8:_UNDEFINED"
"OwnerKey" = "8:_5294BB40EE33B2C3602EF328FF25AADE"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
{
"MsmKey" = "8:_UNDEFINED"
"OwnerKey" = "8:_9768C46742605F22AB604239F03E17DD"
"MsmSig" = "8:_UNDEFINED"
}
Expand Down Expand Up @@ -5273,6 +5285,37 @@
"IsDependency" = "11:FALSE"
"IsolateTo" = "8:"
}
"{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_5294BB40EE33B2C3602EF328FF25AADE"
{
"AssemblyRegister" = "3:1"
"AssemblyIsInGAC" = "11:FALSE"
"AssemblyAsmDisplayName" = "8:lucidcode.LucidScribe.Interface.Illuminated, Version=1.0.4.0, Culture=neutral, processorArchitecture=MSIL"
"ScatterAssemblies"
{
"_5294BB40EE33B2C3602EF328FF25AADE"
{
"Name" = "8:lucidcode.LucidScribe.Interface.Illuminated.dll"
"Attributes" = "3:512"
}
}
"SourcePath" = "8:lucidcode.LucidScribe.Interface.Illuminated.dll"
"TargetName" = "8:"
"Tag" = "8:"
"Folder" = "8:_491A001224CF4D699EA475B2FB5F2890"
"Condition" = "8:"
"Transitive" = "11:FALSE"
"Vital" = "11:TRUE"
"ReadOnly" = "11:FALSE"
"Hidden" = "11:FALSE"
"System" = "11:FALSE"
"Permanent" = "11:FALSE"
"SharedLegacy" = "11:FALSE"
"PackageAs" = "3:1"
"Register" = "3:1"
"Exclude" = "11:TRUE"
"IsDependency" = "11:TRUE"
"IsolateTo" = "8:"
}
"{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_53FD229DEDBBC6B6C38C5D53D2512E09"
{
"AssemblyRegister" = "3:1"
Expand Down Expand Up @@ -10814,7 +10857,7 @@
"Name" = "8:Microsoft Visual Studio"
"ProductName" = "8:Lucid Scribe Halovision"
"ProductCode" = "8:{411774F8-3E0E-4CF2-9192-C614B596B336}"
"PackageCode" = "8:{29D970C5-AC16-4945-8EE1-803FDC2C989D}"
"PackageCode" = "8:{1BBABB08-9954-4183-AD1A-8EFC431B9F5F}"
"UpgradeCode" = "8:{CAAB2187-AD23-435C-A3DB-568744247625}"
"AspNetVersion" = "8:4.0.30319.0"
"RestartWWWService" = "11:FALSE"
Expand Down

0 comments on commit 066816b

Please sign in to comment.