Browse files

win app: packaging experimenting, lock obj for blink1lib, setting of …

….net target
  • Loading branch information...
1 parent 18597b6 commit 7a899d32e0613e960e1f58de33c54684e6620178 @todbot committed Jan 14, 2013
View
19 libraries/README.md
@@ -0,0 +1,19 @@
+
+Do not use anything in this directory
+-------------------------------------
+
+It is badly named and will be changed soon.
+
+This directory currently holds parts of the Java/Processing library and
+the HTML for the Blink1Control Windows & Mac applications.
+
+You're probably looking for something else.
+
+- blink1-lib C library source -- look in blink1/commandline/
+
+- Blink1Lib .NET library source -- look in blink1/windows/Blink1Lib/
+
+- Java/Procesing library source -- look in blink1/java/
+
+
+
View
3 windows/Blink1Control/Blink1Control.sln
@@ -28,18 +28,21 @@ Global
{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}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {4FE2AE76-BA05-44BC-A04E-5CAF5D7A7D2F}.Debug|x86.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
{4FE2AE76-BA05-44BC-A04E-5CAF5D7A7D2F}.Release|x86.ActiveCfg = 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}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {A9AE40FF-1A21-414A-9FE7-3BE13644CC6D}.Debug|x86.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
{A9AE40FF-1A21-414A-9FE7-3BE13644CC6D}.Release|x86.ActiveCfg = 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}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {3E1BEF4C-CC09-4C31-AFB5-15A951811AC6}.Debug|x86.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
{3E1BEF4C-CC09-4C31-AFB5-15A951811AC6}.Release|x86.ActiveCfg = Release|Any CPU
View
16 windows/Blink1Control/Blink1Control/App.config
@@ -1,27 +1,27 @@
-<?xml version="1.0" encoding="utf-8" ?>
+<?xml version="1.0"?>
<configuration>
<configSections>
- <sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
- <section name="Blink1Control.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
+ <sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <section name="Blink1Control.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false"/>
</sectionGroup>
</configSections>
<startup useLegacyV2RuntimeActivationPolicy="true">
- <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
- </startup>
+
+ <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/></startup>
<userSettings>
<Blink1Control.Properties.Settings>
<setting name="hostId" serializeAs="String">
<value>00000000</value>
</setting>
<setting name="inputs" serializeAs="String">
- <value />
+ <value/>
</setting>
<setting name="patterns" serializeAs="String">
- <value />
+ <value/>
</setting>
<setting name="logToScreen" serializeAs="String">
<value>True</value>
</setting>
</Blink1Control.Properties.Settings>
</userSettings>
-</configuration>
+</configuration>
View
26 windows/Blink1Control/Blink1Control/Blink1Control.csproj
@@ -12,7 +12,9 @@
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<IsWebBootstrapper>false</IsWebBootstrapper>
- <PublishUrl>C:\Users\biff\Desktop\blink1publish\</PublishUrl>
+ <TargetFrameworkProfile>
+ </TargetFrameworkProfile>
+ <PublishUrl>Y:\blink1\windows\Blink1ControlInstaller\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
@@ -22,10 +24,14 @@
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
- <AutorunEnabled>true</AutorunEnabled>
- <ApplicationRevision>1</ApplicationRevision>
+ <ProductName>Blink1Control</ProductName>
+ <PublisherName>ThingM Corp</PublisherName>
+ <WebPage>publish.htm</WebPage>
+ <OpenBrowserOnPublish>false</OpenBrowserOnPublish>
+ <ApplicationRevision>11</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
+ <CreateDesktopShortcut>true</CreateDesktopShortcut>
<PublishWizardCompleted>true</PublishWizardCompleted>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
@@ -38,6 +44,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
+ <Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
@@ -47,6 +54,7 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
+ <Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
@@ -81,7 +89,10 @@
<GenerateManifests>true</GenerateManifests>
</PropertyGroup>
<PropertyGroup>
- <SignManifests>true</SignManifests>
+ <SignManifests>false</SignManifests>
+ </PropertyGroup>
+ <PropertyGroup>
+ <ApplicationIcon>blink1-icon.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="CefSharp">
@@ -139,7 +150,9 @@
</Compile>
</ItemGroup>
<ItemGroup>
- <None Include="App.config" />
+ <None Include="App.config">
+ <SubType>Designer</SubType>
+ </None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Blink1Lib\Blink1Lib\Blink1Lib.csproj">
@@ -175,6 +188,9 @@
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
+ <ItemGroup>
+ <Content Include="blink1-icon.ico" />
+ </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>
View
9 windows/Blink1Control/Blink1Control/Blink1Server.cs
@@ -122,6 +122,7 @@ public void saveSettings()
public Blink1Server()
{
Log("Blink1Server!");
+ blink1.open();
loadSettings();
@@ -770,10 +771,12 @@ public void stopAllPatterns()
/// </summary>
public void fadeToRGB(double secs, Color c)
{
- Log("fadeToRGB: rgb:" + ColorTranslator.ToHtml(c) + " secs:" + secs);
- blink1.open();
+ Log("fadeToRGB: rgb:" + ColorTranslator.ToHtml(c) + " secs:" + secs.ToString("F2", CultureInfo.InvariantCulture));
+ //blink1.open();
blink1.fadeToRGB((int)(secs * 1000), c.R, c.G, c.B);
- blink1.close();
+ //blink1.close();
+ // FIXME: this method crashes when called successively.
+ // FIXME: I think we can't close because I'm doing hid_exit() in blink1_close()
}
/// <summary>
View
6 windows/Blink1Control/Blink1Control/Properties/AssemblyInfo.cs
@@ -8,9 +8,9 @@
[assembly: AssemblyTitle("Blink1Control")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("Microsoft")]
+[assembly: AssemblyCompany("ThingM")]
[assembly: AssemblyProduct("Blink1Control")]
-[assembly: AssemblyCopyright("Copyright © Microsoft 2013")]
+[assembly: AssemblyCopyright("Copyright © ThingM 2013")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
@@ -33,4 +33,4 @@
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("0.9.5.0")]
View
1 windows/Blink1Control/JSON/Newtonsoft.Json/Newtonsoft.Json.csproj
@@ -59,6 +59,7 @@
</CodeAnalysisRules>
<CodeAnalysisRuleSet>Newtonsoft.Json.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit>
+ <PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
View
BIN windows/Blink1Control/JSON/Newtonsoft.Json/bin/Debug/Net40/Newtonsoft.Json.dll
Binary file not shown.
View
4 ...link1Control/JSON/Newtonsoft.Json/bin/Debug/Net40/Newtonsoft.Json.dll.CodeAnalysisLog.xml
@@ -12,14 +12,14 @@
<Members>
<Member Name="#op_Explicit(Newtonsoft.Json.Linq.JToken):System.DateTimeOffset" Kind="Method" Static="True" Accessibility="Public" ExternallyVisible="True">
<Messages>
- <Message Id="System.DateTimeOffset.Parse(System.String)" TypeName="SpecifyIFormatProvider" Category="Microsoft.Globalization" CheckId="CA1305" Status="Active" Created="2013-01-13 00:17:01Z" FixCategory="NonBreaking">
+ <Message Id="System.DateTimeOffset.Parse(System.String)" TypeName="SpecifyIFormatProvider" Category="Microsoft.Globalization" CheckId="CA1305" Status="Active" Created="2013-01-15 03:52:50Z" FixCategory="NonBreaking">
<Issue Name="IFormatProviderAlternate" Certainty="95" Level="Error" Path="y:\blink1\windows\Blink1Control\JSON\Newtonsoft.Json\Linq" File="JToken.cs" Line="426">Because the behavior of 'DateTimeOffset.Parse(string)' could vary based on the current user's locale settings, replace this call in 'JToken.explicit operator DateTimeOffset(JToken)' with a call to 'DateTimeOffset.Parse(string, IFormatProvider)'. If the result of 'DateTimeOffset.Parse(string, IFormatProvider)' will be based on input from the user, specify 'CultureInfo.CurrentCulture' as the 'IFormatProvider' parameter. Otherwise, if the result will based on input stored and accessed by software, such as when it is loaded from disk or from a database, specify 'CultureInfo.InvariantCulture'.</Issue>
</Message>
</Messages>
</Member>
<Member Name="#op_Explicit(Newtonsoft.Json.Linq.JToken):System.Nullable`1&lt;System.DateTimeOffset&gt;" Kind="Method" Static="True" Accessibility="Public" ExternallyVisible="True">
<Messages>
- <Message Id="System.DateTimeOffset.Parse(System.String)" TypeName="SpecifyIFormatProvider" Category="Microsoft.Globalization" CheckId="CA1305" Status="Active" Created="2013-01-13 00:17:01Z" FixCategory="NonBreaking">
+ <Message Id="System.DateTimeOffset.Parse(System.String)" TypeName="SpecifyIFormatProvider" Category="Microsoft.Globalization" CheckId="CA1305" Status="Active" Created="2013-01-15 03:52:50Z" FixCategory="NonBreaking">
<Issue Name="IFormatProviderAlternate" Certainty="95" Level="Error" Path="y:\blink1\windows\Blink1Control\JSON\Newtonsoft.Json\Linq" File="JToken.cs" Line="499">Because the behavior of 'DateTimeOffset.Parse(string)' could vary based on the current user's locale settings, replace this call in 'JToken.explicit operator DateTimeOffset?(JToken)' with a call to 'DateTimeOffset.Parse(string, IFormatProvider)'. If the result of 'DateTimeOffset.Parse(string, IFormatProvider)' will be based on input from the user, specify 'CultureInfo.CurrentCulture' as the 'IFormatProvider' parameter. Otherwise, if the result will based on input stored and accessed by software, such as when it is loaded from disk or from a database, specify 'CultureInfo.InvariantCulture'.</Issue>
</Message>
</Messages>
View
1 .../Blink1Control/JSON/Newtonsoft.Json/obj/Debug/Newtonsoft.Json.csproj.FileListAbsolute.txt
@@ -11,6 +11,5 @@ Y:\blink1\windows\Blink1Control\JSON\Newtonsoft.Json\bin\Debug\Net40\Newtonsoft.
Y:\blink1\windows\Blink1Control\JSON\Newtonsoft.Json\bin\Debug\Net40\Newtonsoft.Json.pdb
Y:\blink1\windows\Blink1Control\JSON\Newtonsoft.Json\bin\Debug\Net40\Newtonsoft.Json.dll.CodeAnalysisLog.xml
Y:\blink1\windows\Blink1Control\JSON\Newtonsoft.Json\bin\Debug\Net40\Newtonsoft.Json.dll.lastcodeanalysissucceeded
-Y:\blink1\windows\Blink1Control\JSON\Newtonsoft.Json\obj\Debug\Newtonsoft.Json.csprojResolveAssemblyReference.cache
Y:\blink1\windows\Blink1Control\JSON\Newtonsoft.Json\obj\Debug\Newtonsoft.Json.dll
Y:\blink1\windows\Blink1Control\JSON\Newtonsoft.Json\obj\Debug\Newtonsoft.Json.pdb
View
BIN windows/Blink1Control/JSON/Newtonsoft.Json/obj/Debug/Newtonsoft.Json.dll
Binary file not shown.
View
4 windows/Blink1Control/MiniHttpd/MiniHttpd.csproj
@@ -25,7 +25,8 @@
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<OldToolsVersion>0.0</OldToolsVersion>
- <TargetFrameworkProfile />
+ <TargetFrameworkProfile>
+ </TargetFrameworkProfile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<OutputPath>bin\Debug\</OutputPath>
@@ -47,6 +48,7 @@
<DebugType>full</DebugType>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>false</Prefer32Bit>
+ <PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<OutputPath>bin\Release\</OutputPath>
View
BIN windows/Blink1Control/MiniHttpd/bin/Debug/MiniHttpd.dll
Binary file not shown.
View
5 windows/Blink1Control/MiniHttpd/obj/Debug/MiniHttpd.csproj.FileListAbsolute.txt
@@ -4,3 +4,8 @@ C:\Users\justin\Documents\GitHub\blink1\windows\MiniHttpd\bin\Debug\MiniHttpdDoc
C:\Users\justin\Documents\GitHub\blink1\windows\MiniHttpd\obj\Debug\MiniHttpd.csprojResolveAssemblyReference.cache
C:\Users\justin\Documents\GitHub\blink1\windows\MiniHttpd\obj\Debug\MiniHttpd.dll
C:\Users\justin\Documents\GitHub\blink1\windows\MiniHttpd\obj\Debug\MiniHttpd.pdb
+Y:\blink1\windows\Blink1Control\MiniHttpd\bin\Debug\MiniHttpd.dll
+Y:\blink1\windows\Blink1Control\MiniHttpd\bin\Debug\MiniHttpd.pdb
+Y:\blink1\windows\Blink1Control\MiniHttpd\bin\Debug\MiniHttpdDocumentation.xml
+Y:\blink1\windows\Blink1Control\MiniHttpd\obj\Debug\MiniHttpd.dll
+Y:\blink1\windows\Blink1Control\MiniHttpd\obj\Debug\MiniHttpd.pdb
View
BIN windows/Blink1Control/MiniHttpd/obj/Debug/MiniHttpd.dll
Binary file not shown.
View
39 windows/Blink1Lib/Blink1Lib/Blink1.cs
@@ -10,6 +10,8 @@ namespace Blink1Lib
{
public class Blink1
{
+ private readonly object lock_ = new object();
+
/// <summary>
/// Returns the blink(1) uid (aka IFTTT key)
/// </summary>
@@ -69,7 +71,9 @@ public string regenerateBlink1Id()
/// <returns>true if device was opened, false if no device available.</returns>
public Boolean open()
{
- dev = blink1_open();
+ lock (lock_) {
+ dev = blink1_open();
+ }
if (dev == null) return false;
return true;
}
@@ -81,7 +85,9 @@ public Boolean open()
/// <returns>true if device was opened, false otherwise</returns>
public Boolean openById(int i)
{
- dev = blink1_openById(i);
+ lock (lock_) {
+ dev = blink1_openById(i);
+ }
if (dev == null) return false;
return true;
}
@@ -91,7 +97,9 @@ public Boolean openById(int i)
/// </summary>
public void close()
{
- blink1_close(dev);
+ lock (lock_) {
+ blink1_close(dev);
+ }
}
/// <summary>
@@ -103,7 +111,9 @@ public void close()
public void setRGB(int r, int g, int b)
{
lastColor = Color.FromArgb(r, g, b);
- blink1_setRGB(dev, r, g, b);
+ lock (lock_) {
+ blink1_setRGB(dev, r, g, b);
+ }
}
/// <summary>
@@ -116,7 +126,9 @@ public void setRGB(int r, int g, int b)
public void fadeToRGB(int millis, int r, int g, int b)
{
lastColor = Color.FromArgb(r, g, b);
- blink1_fadeToRGB(dev, millis, r, g, b);
+ lock (lock_) {
+ blink1_fadeToRGB(dev, millis, r, g, b);
+ }
}
/// <summary>
@@ -138,7 +150,11 @@ public static String colorToHexCode(Color c)
/// <returns>number of blink1 devices</returns>
public int enumerate()
{
- return blink1_enumerate();
+ int n = 0;
+ lock (lock_) {
+ n = blink1_enumerate();
+ }
+ return n;
}
/// <summary>
@@ -164,13 +180,14 @@ public string getCachedSerial(int i)
public bool setPatternAtPosition(int r, int g, int b, int millis, int pos)
{
- int ret = blink1_writePatternLine(dev, millis, r, g, b, pos);
- if (ret > -1)
- {
+ int ret = -1;
+ lock (lock_) {
+ blink1_writePatternLine(dev, millis, r, g, b, pos);
+ }
+ if (ret > -1) {
return true;
}
- else
- return false;
+ return false;
}
// see: http://msdn.microsoft.com/en-us/magazine/cc164123.aspx#S7
View
10 windows/Blink1Lib/Blink1Lib/Blink1Lib.csproj
@@ -11,6 +11,8 @@
<AssemblyName>Blink1</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
+ <TargetFrameworkProfile>
+ </TargetFrameworkProfile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@@ -20,6 +22,8 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
+ <Prefer32Bit>false</Prefer32Bit>
+ <PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@@ -28,6 +32,11 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
+ <Prefer32Bit>false</Prefer32Bit>
+ </PropertyGroup>
+ <PropertyGroup>
+ <ApplicationIcon>
+ </ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
@@ -44,6 +53,7 @@
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
+ <Content Include="blink1-icon.ico" />
<Content Include="blink1-lib.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
View
4 windows/Blink1Lib/Blink1Lib/Properties/AssemblyInfo.cs
@@ -8,9 +8,9 @@
[assembly: AssemblyTitle("Blink1")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("Microsoft")]
+[assembly: AssemblyCompany("ThingM")]
[assembly: AssemblyProduct("Blink1")]
-[assembly: AssemblyCopyright("Copyright © Microsoft 2012")]
+[assembly: AssemblyCopyright("Copyright © ThingM 2013")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

0 comments on commit 7a899d3

Please sign in to comment.