Skip to content

Commit e05d93f

Browse files
author
Peter Waher
committed
Source code for the MQTT chapter of the book "Learning Internet of Things".
1 parent f4775b0 commit e05d93f

File tree

91 files changed

+140921
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+140921
-0
lines changed

Actuator/Actuator.csproj

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5+
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
6+
<ProjectGuid>{92EE92D4-6E73-48C7-BC7B-986F545DE099}</ProjectGuid>
7+
<OutputType>Exe</OutputType>
8+
<RootNamespace>Actuator</RootNamespace>
9+
<AssemblyName>Actuator</AssemblyName>
10+
</PropertyGroup>
11+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
12+
<DebugSymbols>true</DebugSymbols>
13+
<DebugType>full</DebugType>
14+
<Optimize>false</Optimize>
15+
<OutputPath>bin\Debug</OutputPath>
16+
<DefineConstants>DEBUG;</DefineConstants>
17+
<ErrorReport>prompt</ErrorReport>
18+
<WarningLevel>4</WarningLevel>
19+
<PlatformTarget>x86</PlatformTarget>
20+
<Externalconsole>true</Externalconsole>
21+
<CustomCommands>
22+
<CustomCommands>
23+
<Command type="AfterBuild" command="CopyToRaspberryPi.bat" workingdir="${ProjectDir}" />
24+
</CustomCommands>
25+
</CustomCommands>
26+
</PropertyGroup>
27+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
28+
<DebugType>full</DebugType>
29+
<Optimize>true</Optimize>
30+
<OutputPath>bin\Release</OutputPath>
31+
<ErrorReport>prompt</ErrorReport>
32+
<WarningLevel>4</WarningLevel>
33+
<PlatformTarget>x86</PlatformTarget>
34+
<Externalconsole>true</Externalconsole>
35+
</PropertyGroup>
36+
<ItemGroup>
37+
<Reference Include="System" />
38+
<Reference Include="Clayster.Library.Data">
39+
<HintPath>..\Clayster\Clayster.Library.Data.dll</HintPath>
40+
</Reference>
41+
<Reference Include="Clayster.Library.EventLog">
42+
<HintPath>..\Clayster\Clayster.Library.EventLog.dll</HintPath>
43+
</Reference>
44+
<Reference Include="Clayster.Library.Internet">
45+
<HintPath>..\Clayster\Clayster.Library.Internet.dll</HintPath>
46+
</Reference>
47+
<Reference Include="System.Xml" />
48+
<Reference Include="Clayster.Library.Math">
49+
<HintPath>..\Clayster\Clayster.Library.Math.dll</HintPath>
50+
</Reference>
51+
<Reference Include="System.Web.Services" />
52+
<Reference Include="System.Web" />
53+
</ItemGroup>
54+
<ItemGroup>
55+
<Compile Include="Program.cs" />
56+
<Compile Include="Properties\AssemblyInfo.cs" />
57+
<Compile Include="LoginCredentials.cs" />
58+
<Compile Include="SessionAuthentication.cs" />
59+
<Compile Include="State.cs" />
60+
</ItemGroup>
61+
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
62+
<ItemGroup>
63+
<ProjectReference Include="..\Clayster.Library.IoT\Clayster.Library.IoT.csproj">
64+
<Project>{A2004BE1-37BA-45D7-9DCE-1CB63D7ABAA9}</Project>
65+
<Name>Clayster.Library.IoT</Name>
66+
</ProjectReference>
67+
<ProjectReference Include="..\Clayster.Library.RaspberryPi\Clayster.Library.RaspberryPi.csproj">
68+
<Project>{86C3A3A9-FBE0-485C-8B9C-D093A7F52FDB}</Project>
69+
<Name>Clayster.Library.RaspberryPi</Name>
70+
</ProjectReference>
71+
</ItemGroup>
72+
<ItemGroup>
73+
<None Include="CopyToRaspberryPi.bat" />
74+
</ItemGroup>
75+
</Project>

Actuator/CopyToRaspberryPi.bat

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/System.Data.SQLite.dll pi@192.168.0.23:
2+
rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/MySql.Data.dll pi@192.168.0.23:
3+
rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Internet.dll pi@192.168.0.23:
4+
rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.EventLog.dll pi@192.168.0.23:
5+
rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Data.dll pi@192.168.0.23:
6+
rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Math.dll pi@192.168.0.23:
7+
rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Language.dll pi@192.168.0.23:
8+
rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.RaspberryPi.dll pi@192.168.0.23:
9+
rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.IoT.dll pi@192.168.0.23:
10+
rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Actuator.exe pi@192.168.0.23:

Actuator/LoginCredentials.cs

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
using System;
2+
using Clayster.Library.Data;
3+
4+
namespace Actuator
5+
{
6+
public class LoginCredentials : DBObject
7+
{
8+
private string userName = string.Empty;
9+
private string passwordHash = string.Empty;
10+
11+
public LoginCredentials ()
12+
: base (MainClass.db)
13+
{
14+
}
15+
16+
[DBShortString(DB.ShortStringClipLength)]
17+
public string UserName
18+
{
19+
get { return this.userName; }
20+
set
21+
{
22+
if (this.userName != value)
23+
{
24+
this.userName = value;
25+
this.Modified = true;
26+
}
27+
}
28+
}
29+
30+
[DBEncryptedShortString]
31+
public string PasswordHash
32+
{
33+
get { return this.passwordHash; }
34+
set
35+
{
36+
if (this.passwordHash != value)
37+
{
38+
this.passwordHash = value;
39+
this.Modified = true;
40+
}
41+
}
42+
}
43+
44+
public static LoginCredentials LoadCredentials ()
45+
{
46+
return MainClass.db.FindObjects<LoginCredentials> ().GetEarliestCreatedDeleteOthers ();
47+
}
48+
}
49+
}

0 commit comments

Comments
 (0)