Browse files

added first attempt at windows blink1control app

  • Loading branch information...
1 parent 65077b0 commit 3627b6242fc89e4de3d18aeeab8a7f7cf975723a @todbot committed Dec 30, 2012
View
42 windows/Blink1Control/Blink1Control.sln
@@ -0,0 +1,42 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Express 2012 for Windows Desktop
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Blink1Control", "Blink1Control\Blink1Control.csproj", "{123A2D92-89AB-47F9-BFCC-DA1711E04D1D}"
+ ProjectSection(ProjectDependencies) = postProject
+ {3E1BEF4C-CC09-4C31-AFB5-15A951811AC6} = {3E1BEF4C-CC09-4C31-AFB5-15A951811AC6}
+ {A9AE40FF-1A21-414A-9FE7-3BE13644CC6D} = {A9AE40FF-1A21-414A-9FE7-3BE13644CC6D}
+ EndProjectSection
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MiniHttpd", "..\MiniHttpd\MiniHttpd.csproj", "{3E1BEF4C-CC09-4C31-AFB5-15A951811AC6}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Newtonsoft.Json", "..\JSON\Newtonsoft.Json\Newtonsoft.Json.csproj", "{A9AE40FF-1A21-414A-9FE7-3BE13644CC6D}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Blink1Lib", "..\Blink1Lib\Blink1Lib\Blink1Lib.csproj", "{4FE2AE76-BA05-44BC-A04E-5CAF5D7A7D2F}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {123A2D92-89AB-47F9-BFCC-DA1711E04D1D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {123A2D92-89AB-47F9-BFCC-DA1711E04D1D}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {123A2D92-89AB-47F9-BFCC-DA1711E04D1D}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {123A2D92-89AB-47F9-BFCC-DA1711E04D1D}.Release|Any CPU.Build.0 = Release|Any CPU
+ {3E1BEF4C-CC09-4C31-AFB5-15A951811AC6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {3E1BEF4C-CC09-4C31-AFB5-15A951811AC6}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {3E1BEF4C-CC09-4C31-AFB5-15A951811AC6}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {3E1BEF4C-CC09-4C31-AFB5-15A951811AC6}.Release|Any CPU.Build.0 = Release|Any CPU
+ {A9AE40FF-1A21-414A-9FE7-3BE13644CC6D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {A9AE40FF-1A21-414A-9FE7-3BE13644CC6D}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {A9AE40FF-1A21-414A-9FE7-3BE13644CC6D}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {A9AE40FF-1A21-414A-9FE7-3BE13644CC6D}.Release|Any CPU.Build.0 = Release|Any CPU
+ {4FE2AE76-BA05-44BC-A04E-5CAF5D7A7D2F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {4FE2AE76-BA05-44BC-A04E-5CAF5D7A7D2F}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {4FE2AE76-BA05-44BC-A04E-5CAF5D7A7D2F}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {4FE2AE76-BA05-44BC-A04E-5CAF5D7A7D2F}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
View
6 windows/Blink1Control/Blink1Control/App.config
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<configuration>
+ <startup>
+ <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
+ </startup>
+</configuration>
View
8 windows/Blink1Control/Blink1Control/App.xaml
@@ -0,0 +1,8 @@
+<Application x:Class="Blink1Control.App"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ StartupUri="MainWindow.xaml">
+ <Application.Resources>
+
+ </Application.Resources>
+</Application>
View
17 windows/Blink1Control/Blink1Control/App.xaml.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Configuration;
+using System.Data;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Windows;
+
+namespace Blink1Control
+{
+ /// <summary>
+ /// Interaction logic for App.xaml
+ /// </summary>
+ public partial class App : Application
+ {
+ }
+}
View
120 windows/Blink1Control/Blink1Control/Blink1Control.csproj
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProjectGuid>{123A2D92-89AB-47F9-BFCC-DA1711E04D1D}</ProjectGuid>
+ <OutputType>WinExe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>Blink1Control</RootNamespace>
+ <AssemblyName>Blink1Control</AssemblyName>
+ <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <PlatformTarget>AnyCPU</PlatformTarget>
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <PlatformTarget>AnyCPU</PlatformTarget>
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Drawing" />
+ <Reference Include="System.Xml" />
+ <Reference Include="Microsoft.CSharp" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Xml.Linq" />
+ <Reference Include="System.Data.DataSetExtensions" />
+ <Reference Include="System.Xaml">
+ <RequiredTargetFramework>4.0</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="WindowsBase" />
+ <Reference Include="PresentationCore" />
+ <Reference Include="PresentationFramework" />
+ </ItemGroup>
+ <ItemGroup>
+ <ApplicationDefinition Include="App.xaml">
+ <Generator>MSBuild:Compile</Generator>
+ <SubType>Designer</SubType>
+ </ApplicationDefinition>
+ <Page Include="MainWindow.xaml">
+ <Generator>MSBuild:Compile</Generator>
+ <SubType>Designer</SubType>
+ </Page>
+ <Compile Include="App.xaml.cs">
+ <DependentUpon>App.xaml</DependentUpon>
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="blink1ControlServer.cs" />
+ <Compile Include="MainWindow.xaml.cs">
+ <DependentUpon>MainWindow.xaml</DependentUpon>
+ <SubType>Code</SubType>
+ </Compile>
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Properties\AssemblyInfo.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="Properties\Resources.Designer.cs">
+ <AutoGen>True</AutoGen>
+ <DesignTime>True</DesignTime>
+ <DependentUpon>Resources.resx</DependentUpon>
+ </Compile>
+ <Compile Include="Properties\Settings.Designer.cs">
+ <AutoGen>True</AutoGen>
+ <DependentUpon>Settings.settings</DependentUpon>
+ <DesignTimeSharedInput>True</DesignTimeSharedInput>
+ </Compile>
+ <EmbeddedResource Include="Properties\Resources.resx">
+ <Generator>ResXFileCodeGenerator</Generator>
+ <LastGenOutput>Resources.Designer.cs</LastGenOutput>
+ </EmbeddedResource>
+ <None Include="Properties\Settings.settings">
+ <Generator>SettingsSingleFileGenerator</Generator>
+ <LastGenOutput>Settings.Designer.cs</LastGenOutput>
+ </None>
+ <AppDesigner Include="Properties\" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="App.config" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\Blink1Lib\Blink1Lib\Blink1Lib.csproj">
+ <Project>{4fe2ae76-ba05-44bc-a04e-5caf5d7a7d2f}</Project>
+ <Name>Blink1Lib</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\JSON\Newtonsoft.Json\Newtonsoft.Json.csproj">
+ <Project>{a9ae40ff-1a21-414a-9fe7-3be13644cc6d}</Project>
+ <Name>Newtonsoft.Json</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\MiniHttpd\MiniHttpd.csproj">
+ <Project>{3e1bef4c-cc09-4c31-afb5-15a951811ac6}</Project>
+ <Name>MiniHttpd</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
View
8 windows/Blink1Control/Blink1Control/MainWindow.xaml
@@ -0,0 +1,8 @@
+<Window x:Class="Blink1Control.MainWindow"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ Title="MainWindow" Height="350" Width="525">
+ <Grid>
+
+ </Grid>
+</Window>
View
35 windows/Blink1Control/Blink1Control/MainWindow.xaml.cs
@@ -0,0 +1,35 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+using System.Web;
+using System.Net;
+
+namespace Blink1Control
+{
+ /// <summary>
+ /// Interaction logic for MainWindow.xaml
+ /// </summary>
+ public partial class MainWindow : Window
+ {
+ //public HttpListener _httpListener = new HttpListener();
+ blink1HttpInterface bhi = new blink1HttpInterface();
+ blink1Server bs = new blink1Server();
+ //public bool disposeTime = false;
+
+ public MainWindow()
+ {
+ InitializeComponent();
+ }
+ }
+}
View
55 windows/Blink1Control/Blink1Control/Properties/AssemblyInfo.cs
@@ -0,0 +1,55 @@
+using System.Reflection;
+using System.Resources;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Windows;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("Blink1Control")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Microsoft")]
+[assembly: AssemblyProduct("Blink1Control")]
+[assembly: AssemblyCopyright("Copyright © Microsoft 2012")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+//In order to begin building localizable applications, set
+//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
+//inside a <PropertyGroup>. For example, if you are using US english
+//in your source files, set the <UICulture> to en-US. Then uncomment
+//the NeutralResourceLanguage attribute below. Update the "en-US" in
+//the line below to match the UICulture setting in the project file.
+
+//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
+
+
+[assembly: ThemeInfo(
+ ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
+ //(used if a resource is not found in the page,
+ // or application resource dictionaries)
+ ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
+ //(used if a resource is not found in the page,
+ // app, or any theme specific resource dictionaries)
+)]
+
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
View
71 windows/Blink1Control/Blink1Control/Properties/Resources.Designer.cs
@@ -0,0 +1,71 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.17929
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace Blink1Control.Properties
+{
+
+
+ /// <summary>
+ /// A strongly-typed resource class, for looking up localized strings, etc.
+ /// </summary>
+ // This class was auto-generated by the StronglyTypedResourceBuilder
+ // class via a tool like ResGen or Visual Studio.
+ // To add or remove a member, edit your .ResX file then rerun ResGen
+ // with the /str option, or rebuild your VS project.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources
+ {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources()
+ {
+ }
+
+ /// <summary>
+ /// Returns the cached ResourceManager instance used by this class.
+ /// </summary>
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager
+ {
+ get
+ {
+ if ((resourceMan == null))
+ {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Blink1Control.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ /// <summary>
+ /// Overrides the current thread's CurrentUICulture property for all
+ /// resource lookups using this strongly typed resource class.
+ /// </summary>
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture
+ {
+ get
+ {
+ return resourceCulture;
+ }
+ set
+ {
+ resourceCulture = value;
+ }
+ }
+ }
+}
View
117 windows/Blink1Control/Blink1Control/Properties/Resources.resx
@@ -0,0 +1,117 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+</root>
View
30 windows/Blink1Control/Blink1Control/Properties/Settings.Designer.cs
@@ -0,0 +1,30 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.17929
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace Blink1Control.Properties
+{
+
+
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
+ internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
+ {
+
+ private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+
+ public static Settings Default
+ {
+ get
+ {
+ return defaultInstance;
+ }
+ }
+ }
+}
View
7 windows/Blink1Control/Blink1Control/Properties/Settings.settings
@@ -0,0 +1,7 @@
+<?xml version='1.0' encoding='utf-8'?>
+<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
+ <Profiles>
+ <Profile Name="(Default)" />
+ </Profiles>
+ <Settings />
+</SettingsFile>
View
286 windows/Blink1Control/Blink1Control/blink1ControlServer.cs
@@ -0,0 +1,286 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Timers;
+using System.Drawing;
+using System.Reflection;
+using System.IO;
+using System.Diagnostics;
+using MiniHttpd;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using Blink1Lib;
+
+namespace Blink1Control
+{
+
+ class blink1HttpInterface
+ {
+ HttpWebServer bhI = new HttpWebServer(8934);
+ JTokenWriter jtw = new JTokenWriter();
+ blink1Server bs = new blink1Server();
+ //J bhIJW = new JsonTextWriter(new System.IO.TextWriter());
+ public blink1HttpInterface()
+ {
+ try
+ {
+ VirtualDirectory root = new VirtualDirectory();
+ DriveDirectory homeDir = new DriveDirectory(System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location));
+ foreach (DriveDirectory d in homeDir.GetDirectories())
+ {
+ root.AddDirectory(d.Path);
+ }
+ VirtualDirectory blink1 = new VirtualDirectory("blink1",root);
+
+ Blink1JSONFile id = new Blink1JSONFile("id", blink1, bs);
+ id.GetStringResponse = blink1Id;
+ blink1.AddFile(id); //add a virtual file for each json method
+
+ Blink1JSONFile id2 = new Blink1JSONFile("id2", blink1, bs);
+ id2.GetStringResponse = blink1Id2;
+ blink1.AddFile(id2); //add a virtual file for each json method
+
+ root.AddDirectory(blink1);
+ bhI.Root = root;
+ bhI.Start();
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine(e.ToString());
+ }
+ }
+
+ public delegate string GetJSONStringResponse(HttpRequest request, blink1Server bs);
+
+// /blink1/id -- Display blink1_id and blink1 serial numbers (if any)
+
+ static string blink1Id(HttpRequest request, blink1Server bs)//example
+ {
+ string serial = bs.getId();
+ return @"{
+""blink1_id"": ""44288083" + serial + @""",
+ ""blink1_serialnums"": [
+ """ + serial + @"""
+ ],
+ ""status"": ""blink1 id "+ DateTime.Now + @"""
+}";
+ }
+
+ static string blink1Id2(HttpRequest request, blink1Server bs)//example
+ {
+ return @"\n\n{ suck it }\n\n";
+ }
+
+// /blink1/regenerateblinkid -- Generate, save, and return new blink1_id
+
+// /blink1/enumerate -- Re-enumerate and List available blink(1) devices
+
+// /blink1/fadeToRGB -- Send fadeToRGB command to blink(1) with hex color & fade time
+
+// /blink1/on -- Stop pattern playback and send fadeToRGB command to blink(1) with #FFFFFF & 0.1 sec fade time
+
+// /blink1/off -- Stop pattern playback and send fadeToRGB command to blink(1) with #000000 & 0.1 sec fade time
+
+// /blink1/lastColor -- Return the last color command sent to blink(1)
+
+//Input Selection //interface methods to patterns and watchers
+
+// /blink1/input/ -- List configured inputs, enable or disable input watching
+
+// /blink1/input/del -- Remove a configured input
+
+// /blink1/input/delall -- Remove all configured inputs
+
+// /blink1/input/ifttt -- Add and Start watching messages from IFTTT webservice
+
+// /blink1/input/file -- Add and Start file watcher on given filepath
+
+// /blink1/input/url -- Add and Start URL watcher on given URL
+
+// /blink1/input/script -- Add and Start command-line script executer
+
+// /blink1/input/scriptlist -- List available scripts to run
+
+// /blink1/input/cpuload -- Add and Start CPU load watching input
+
+// /blink1/input/netload -- Start network load watching input
+
+//Color Patterns //patterns
+
+// /blink1/pattern/ -- List saved color patterns
+
+// /blink1/pattern/add -- Add color pattern to color pattern list
+
+// /blink1/pattern/del -- Remove color pattern from color pattern list
+
+// /blink1/pattern/delall -- Remove all color patterns from color pattern list
+
+// /blink1/pattern/play -- Play/test a specific color pattern
+
+// /blink1/pattern/stop -- Stop a pattern playback, for a given pattern or all patterns
+
+
+ public class Blink1JSONFile : IFile
+ {
+ public blink1Server bs;
+ public Blink1JSONFile(string name, IDirectory parent, blink1Server bsp)
+ {
+ this.name = name;
+ this.parent = parent;
+ this.bs = bsp;
+ GetStringResponse = delegate(HttpRequest input, blink1Server bsa)
+ {
+ return input.ToString();
+ };
+
+ }
+
+ string name;
+ IDirectory parent;
+
+ public GetJSONStringResponse GetStringResponse;
+
+ public void OnFileRequested(HttpRequest request,
+ IDirectory directory)
+ {
+ // Assign a MemoryStream to hold the response content.
+ request.Response.ResponseContent = new MemoryStream();
+
+ // Create a StreamWriter to which we
+ // can write some text, and write to it.
+ StreamWriter writer =
+ new StreamWriter(request.Response.ResponseContent);
+
+ writer.WriteLine(GetStringResponse(request, bs));
+
+ // Don't forget to flush!
+ writer.Flush();
+ }
+
+ public string ContentType { get { return ContentTypes.GetExtensionType(".txt"); } }
+ public string Name { get { return name; } }
+ public IDirectory Parent { get { return parent; } }
+
+ public void Dispose()
+ {
+ }
+ }
+
+ }
+
+ public class blink1Server
+ {
+ Blink1 blink1;
+ public blink1Server()
+ {
+ blink1 = new Blink1();
+ }
+// "Usage: \n"
+//" %s <cmd> [options]\n"
+//"where <cmd> is one of:\n"
+//" --blink <numtimes> Blink on/off (specify --rgb before to blink a color)\n"
+//" --random <numtimes> Flash a number of random colors \n"
+//" --rgb <red>,<green>,<blue> Fade to RGB value\n"
+//" --on Turn blink(1) full-on white \n"
+//" --red Turn blink(1) off \n"
+//" --green Turn blink(1) red \n"
+//" --blue Turn blink(1) green \n"
+//" --off Turn blink(1) blue \n"
+//" --savergb <r>,<g>,<b>,<pos> Write pattern RGB value at pos\n"
+//" --readrgb <pos> Read pattern RGB value at pos\n"
+//" --play <1/0,pos> Start playing color sequence (at pos)\n"
+//" --servertickle <1/0> Turn on/off servertickle (uses -t msec) \n"
+//" --list List connected blink(1) devices \n"
+//" Nerd functions: (not used normally) \n"
+//" --hidread Read a blink(1) USB HID GetFeature report \n"
+//" --hidwrite <listofbytes> Write a blink(1) USB HID SetFeature report \n"
+//" --eeread <addr> Read an EEPROM byte from blink(1)\n"
+//" --eewrite <addr>,<val> Write an EEPROM byte to blink(1) \n"
+//" --version Display blink(1) firmware version \n"
+//"and [options] are: \n"
+//" -g -nogamma Disable autogamma correction\n"
+//" -d dNums --id all|deviceIds Use these blink(1) ids (from --list) \n"
+//" -m ms, --millis=millis Set millisecs for color fading (default 300)\n"
+//" -t ms, --delay=millis Set millisecs between events (default 500)\n"
+//" --vid=vid --pid=pid Specifcy alternate USB VID & PID\n"
+//" -v, --verbose verbose debugging msgs\n"
+ /// <summary>
+ /// DEPRECATED: use blink1Lib object instead where possible
+ /// </summary>
+ /// <param name="args"></param>
+ /// <returns></returns>
+ string runBlinkProcess(string args)
+ {
+ try
+ {
+ Process serverSideProcess = new Process();
+ serverSideProcess.StartInfo = new ProcessStartInfo("blink1-tool.exe");
+ serverSideProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
+ serverSideProcess.StartInfo.Arguments = args;
+ serverSideProcess.StartInfo.UseShellExecute = false;
+ serverSideProcess.StartInfo.RedirectStandardOutput = true;
+ serverSideProcess.Start();
+ string output = serverSideProcess.StandardOutput.ReadToEnd();
+ serverSideProcess.WaitForExit();
+ if (output != null && output != "")
+ {
+ return output;
+ }
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine(e.ToString());
+ }
+ return "";
+ }
+
+ public string getId(){
+ if (blink1.enumerate() > 0)
+ {
+ string re = blink1.getCachedSerial(0);
+ return re;
+ }
+ else return "";
+ }
+
+
+ public void sendPatternToBlink1(Color[] param)
+ {
+ for (int i = 0; i < param.Length; i++)
+ {
+ Color c = param[i];
+ //runBlinkProcess(string.Format("-- savergb {0} {1} {2} {3}", c.R, c.G, c.B, i));
+ blink1.setPatternAtPosition(c.R, c.G, c.B, 500, i);
+ }
+ }
+
+ Timer delayTrigger = new Timer();
+ Timer blink1Poll = new Timer();
+
+
+
+ public enum IFTTT
+ {
+ }
+
+ public void parseIFTTT()
+ {
+ }
+
+
+
+ interface json
+ {
+ }
+
+ public void sendSingleColor(Color c)
+ {
+ blink1.setRGB(c.R, c.G, c.B);
+ }
+
+
+
+
+ }
+}

0 comments on commit 3627b62

Please sign in to comment.