├── .gitattributes ├── License ├── Module 1 ├── Chapter02 │ ├── .gitattributes │ ├── .gitignore │ ├── Actuator │ │ ├── Actuator.csproj │ │ ├── CopyToRaspberryPi.bat │ │ ├── LoginCredentials.cs │ │ ├── Program.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ ├── SessionAuthentication.cs │ │ └── State.cs │ ├── Clayster.Library.IoT │ │ ├── Clayster.Library.IoT.csproj │ │ ├── NodeReference.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ └── SensorData │ │ │ ├── Export.cs │ │ │ ├── Field.cs │ │ │ ├── FieldBoolean.cs │ │ │ ├── FieldDateTime.cs │ │ │ ├── FieldEnum.cs │ │ │ ├── FieldLanguageStep.cs │ │ │ ├── FieldNumeric.cs │ │ │ ├── FieldStatus.cs │ │ │ ├── FieldString.cs │ │ │ ├── FieldTimeSpan.cs │ │ │ ├── ISensorDataExport.cs │ │ │ ├── Import.cs │ │ │ ├── ReadoutRequest.cs │ │ │ ├── ReadoutType.cs │ │ │ ├── SensorDataJsonExport.cs │ │ │ ├── SensorDataRdfExport.cs │ │ │ ├── SensorDataTurtleExport.cs │ │ │ └── SensorDataXmlExport.cs │ ├── Clayster.Library.RaspberryPi │ │ ├── Clayster.Library.RaspberryPi.csproj │ │ ├── Devices │ │ │ ├── ADC │ │ │ │ └── AD799x.cs │ │ │ ├── Cameras │ │ │ │ └── LinkSpriteJpegColorCamera.cs │ │ │ └── Temperature │ │ │ │ └── TexasInstrumentsTMP102.cs │ │ ├── DigitalInput.cs │ │ ├── DigitalOutput.cs │ │ ├── GPIO.cs │ │ ├── I2C.cs │ │ ├── MyClass.cs │ │ ├── ParallelDigitalInput.cs │ │ ├── ParallelDigitalOutput.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ ├── SoftwarePwm.cs │ │ └── Uart.cs │ ├── Clayster │ │ ├── Clayster.Library.Data.Doc.XML │ │ ├── Clayster.Library.Data.dll │ │ ├── Clayster.Library.EventLog.Doc.XML │ │ ├── Clayster.Library.EventLog.dll │ │ ├── Clayster.Library.Internet.Doc.XML │ │ ├── Clayster.Library.Internet.dll │ │ ├── Clayster.Library.Language.Doc.XML │ │ ├── Clayster.Library.Language.dll │ │ ├── Clayster.Library.Math.Doc.XML │ │ ├── Clayster.Library.Math.dll │ │ ├── MySql.Data.dll │ │ └── System.Data.SQLite.dll │ ├── Controller │ │ ├── Controller.csproj │ │ ├── CopyToRaspberryPi.bat │ │ ├── Program.cs │ │ └── Properties │ │ │ └── AssemblyInfo.cs │ ├── LearningIoT.sln │ ├── README.md │ ├── Sensor │ │ ├── CopyToRaspberryPi.bat │ │ ├── LoginCredentials.cs │ │ ├── PendingEvent.cs │ │ ├── Program.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ ├── Record.cs │ │ ├── Sensor.csproj │ │ └── SessionAuthentication.cs │ ├── Sensor1 │ │ ├── CopyToRaspberryPi.bat │ │ ├── Program.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ └── Sensor1.csproj │ ├── Sensor2 │ │ ├── CopyToRaspberryPi.bat │ │ ├── Program.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ ├── Record.cs │ │ └── Sensor2.csproj │ ├── Sensor3 │ │ ├── CopyToRaspberryPi.bat │ │ ├── Program.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ ├── Record.cs │ │ └── Sensor3.csproj │ ├── Sensor4 │ │ ├── CopyToRaspberryPi.bat │ │ ├── Program.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ ├── Record.cs │ │ └── Sensor4.csproj │ ├── Sensor5 │ │ ├── CopyToRaspberryPi.bat │ │ ├── LoginCredentials.cs │ │ ├── Program.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ ├── Record.cs │ │ ├── Sensor5.csproj │ │ └── SessionAuthentication.cs │ └── Sensor6 │ │ ├── CopyToRaspberryPi.bat │ │ ├── LoginCredentials.cs │ │ ├── PendingEvent.cs │ │ ├── Program.cs │ │ ├── Properties │ │ └── AssemblyInfo.cs │ │ ├── Record.cs │ │ ├── Sensor6.csproj │ │ └── SessionAuthentication.cs ├── Chapter03 │ ├── .gitattributes │ ├── .gitignore │ ├── Camera │ │ ├── Camera.csproj │ │ ├── CopyToRaspberryPi.bat │ │ ├── DefaultSettings.cs │ │ ├── DigitalSecurityCameraStillImage.cs │ │ ├── LoginCredentials.cs │ │ ├── Program.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ ├── SessionAuthentication.cs │ │ └── UPnP │ │ │ ├── 128x128.png │ │ │ ├── 16x16.png │ │ │ ├── 24x24.png │ │ │ ├── 256x256.png │ │ │ ├── 32x32.png │ │ │ ├── 48x48.png │ │ │ ├── 64x64.png │ │ │ ├── CameraDevice.Layout.xml │ │ │ ├── CameraDevice.xml │ │ │ ├── StillImageService.Layout.xml │ │ │ └── StillImageService.xml │ ├── Clayster.Library.IoT │ │ ├── Clayster.Library.IoT.csproj │ │ ├── NodeReference.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ └── SensorData │ │ │ ├── Export.cs │ │ │ ├── Field.cs │ │ │ ├── FieldBoolean.cs │ │ │ ├── FieldDateTime.cs │ │ │ ├── FieldEnum.cs │ │ │ ├── FieldLanguageStep.cs │ │ │ ├── FieldNumeric.cs │ │ │ ├── FieldStatus.cs │ │ │ ├── FieldString.cs │ │ │ ├── FieldTimeSpan.cs │ │ │ ├── ISensorDataExport.cs │ │ │ ├── Import.cs │ │ │ ├── ReadoutRequest.cs │ │ │ ├── ReadoutType.cs │ │ │ ├── SensorDataJsonExport.cs │ │ │ ├── SensorDataRdfExport.cs │ │ │ ├── SensorDataTurtleExport.cs │ │ │ └── SensorDataXmlExport.cs │ ├── Clayster.Library.RaspberryPi │ │ ├── Clayster.Library.RaspberryPi.csproj │ │ ├── Devices │ │ │ ├── ADC │ │ │ │ └── AD799x.cs │ │ │ ├── Cameras │ │ │ │ └── LinkSpriteJpegColorCamera.cs │ │ │ └── Temperature │ │ │ │ └── TexasInstrumentsTMP102.cs │ │ ├── DigitalInput.cs │ │ ├── DigitalOutput.cs │ │ ├── GPIO.cs │ │ ├── I2C.cs │ │ ├── MyClass.cs │ │ ├── ParallelDigitalInput.cs │ │ ├── ParallelDigitalOutput.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ ├── SoftwarePwm.cs │ │ └── Uart.cs │ ├── Clayster │ │ ├── Clayster.Library.Data.Doc.XML │ │ ├── Clayster.Library.Data.dll │ │ ├── Clayster.Library.EventLog.Doc.XML │ │ ├── Clayster.Library.EventLog.dll │ │ ├── Clayster.Library.Internet.Doc.XML │ │ ├── Clayster.Library.Internet.dll │ │ ├── Clayster.Library.Language.Doc.XML │ │ ├── Clayster.Library.Language.dll │ │ ├── Clayster.Library.Math.Doc.XML │ │ ├── Clayster.Library.Math.dll │ │ ├── MySql.Data.dll │ │ └── System.Data.SQLite.dll │ ├── Controller │ │ ├── Controller.csproj │ │ ├── CopyToRaspberryPi.bat │ │ ├── MailSettings.cs │ │ ├── Program.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ └── Subscription.cs │ └── LearningIoT.sln ├── Chapter04 │ ├── .gitattributes │ ├── .gitignore │ ├── Actuator │ │ ├── Actuator.csproj │ │ ├── CopyToRaspberryPi.bat │ │ ├── LoginCredentials.cs │ │ ├── Program.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ ├── SessionAuthentication.cs │ │ └── State.cs │ ├── Camera │ │ ├── Camera.csproj │ │ ├── CopyToRaspberryPi.bat │ │ ├── DefaultSettings.cs │ │ ├── DigitalSecurityCameraStillImage.cs │ │ ├── LoginCredentials.cs │ │ ├── Program.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ ├── SessionAuthentication.cs │ │ └── UPnP │ │ │ ├── 128x128.png │ │ │ ├── 16x16.png │ │ │ ├── 24x24.png │ │ │ ├── 256x256.png │ │ │ ├── 32x32.png │ │ │ ├── 48x48.png │ │ │ ├── 64x64.png │ │ │ ├── CameraDevice.Layout.xml │ │ │ ├── CameraDevice.xml │ │ │ ├── StillImageService.Layout.xml │ │ │ └── StillImageService.xml │ ├── Clayster.Library.IoT │ │ ├── Clayster.Library.IoT.csproj │ │ ├── NodeReference.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ └── SensorData │ │ │ ├── Export.cs │ │ │ ├── Field.cs │ │ │ ├── FieldBoolean.cs │ │ │ ├── FieldDateTime.cs │ │ │ ├── FieldEnum.cs │ │ │ ├── FieldLanguageStep.cs │ │ │ ├── FieldNumeric.cs │ │ │ ├── FieldStatus.cs │ │ │ ├── FieldString.cs │ │ │ ├── FieldTimeSpan.cs │ │ │ ├── ISensorDataExport.cs │ │ │ ├── Import.cs │ │ │ ├── ReadoutRequest.cs │ │ │ ├── ReadoutType.cs │ │ │ ├── SensorDataJsonExport.cs │ │ │ ├── SensorDataRdfExport.cs │ │ │ ├── SensorDataTurtleExport.cs │ │ │ └── SensorDataXmlExport.cs │ ├── Clayster.Library.RaspberryPi │ │ ├── Clayster.Library.RaspberryPi.csproj │ │ ├── Devices │ │ │ ├── ADC │ │ │ │ └── AD799x.cs │ │ │ ├── Cameras │ │ │ │ └── LinkSpriteJpegColorCamera.cs │ │ │ └── Temperature │ │ │ │ └── TexasInstrumentsTMP102.cs │ │ ├── DigitalInput.cs │ │ ├── DigitalOutput.cs │ │ ├── GPIO.cs │ │ ├── I2C.cs │ │ ├── MyClass.cs │ │ ├── ParallelDigitalInput.cs │ │ ├── ParallelDigitalOutput.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ ├── SoftwarePwm.cs │ │ └── Uart.cs │ ├── Clayster │ │ ├── Clayster.Library.Data.Doc.XML │ │ ├── Clayster.Library.Data.dll │ │ ├── Clayster.Library.EventLog.Doc.XML │ │ ├── Clayster.Library.EventLog.dll │ │ ├── Clayster.Library.Internet.Doc.XML │ │ ├── Clayster.Library.Internet.dll │ │ ├── Clayster.Library.Language.Doc.XML │ │ ├── Clayster.Library.Language.dll │ │ ├── Clayster.Library.Math.Doc.XML │ │ ├── Clayster.Library.Math.dll │ │ ├── MySql.Data.dll │ │ └── System.Data.SQLite.dll │ ├── Controller │ │ ├── Controller.csproj │ │ ├── CopyToRaspberryPi.bat │ │ ├── MailSettings.cs │ │ ├── Program.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ └── Subscription.cs │ ├── LearningIoT.sln │ └── Sensor │ │ ├── CopyToRaspberryPi.bat │ │ ├── LoginCredentials.cs │ │ ├── PendingEvent.cs │ │ ├── Program.cs │ │ ├── Properties │ │ └── AssemblyInfo.cs │ │ ├── Record.cs │ │ ├── Sensor.csproj │ │ └── SessionAuthentication.cs ├── Chapter05 │ ├── .gitattributes │ ├── .gitignore │ ├── Actuator │ │ ├── Actuator.csproj │ │ ├── CopyToRaspberryPi.bat │ │ ├── LoginCredentials.cs │ │ ├── Program.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ ├── SessionAuthentication.cs │ │ └── State.cs │ ├── Camera │ │ ├── Camera.csproj │ │ ├── CopyToRaspberryPi.bat │ │ ├── DefaultSettings.cs │ │ ├── DigitalSecurityCameraStillImage.cs │ │ ├── LoginCredentials.cs │ │ ├── Program.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ ├── SessionAuthentication.cs │ │ └── UPnP │ │ │ ├── 128x128.png │ │ │ ├── 16x16.png │ │ │ ├── 24x24.png │ │ │ ├── 256x256.png │ │ │ ├── 32x32.png │ │ │ ├── 48x48.png │ │ │ ├── 64x64.png │ │ │ ├── CameraDevice.Layout.xml │ │ │ ├── CameraDevice.xml │ │ │ ├── StillImageService.Layout.xml │ │ │ └── StillImageService.xml │ ├── Clayster.Library.IoT │ │ ├── Clayster.Library.IoT.csproj │ │ ├── NodeReference.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ └── SensorData │ │ │ ├── Export.cs │ │ │ ├── Field.cs │ │ │ ├── FieldBoolean.cs │ │ │ ├── FieldDateTime.cs │ │ │ ├── FieldEnum.cs │ │ │ ├── FieldLanguageStep.cs │ │ │ ├── FieldNumeric.cs │ │ │ ├── FieldStatus.cs │ │ │ ├── FieldString.cs │ │ │ ├── FieldTimeSpan.cs │ │ │ ├── ISensorDataExport.cs │ │ │ ├── Import.cs │ │ │ ├── ReadoutRequest.cs │ │ │ ├── ReadoutType.cs │ │ │ ├── SensorDataJsonExport.cs │ │ │ ├── SensorDataRdfExport.cs │ │ │ ├── SensorDataTurtleExport.cs │ │ │ └── SensorDataXmlExport.cs │ ├── Clayster.Library.RaspberryPi │ │ ├── Clayster.Library.RaspberryPi.csproj │ │ ├── Devices │ │ │ ├── ADC │ │ │ │ └── AD799x.cs │ │ │ ├── Cameras │ │ │ │ └── LinkSpriteJpegColorCamera.cs │ │ │ └── Temperature │ │ │ │ └── TexasInstrumentsTMP102.cs │ │ ├── DigitalInput.cs │ │ ├── DigitalOutput.cs │ │ ├── GPIO.cs │ │ ├── I2C.cs │ │ ├── MyClass.cs │ │ ├── ParallelDigitalInput.cs │ │ ├── ParallelDigitalOutput.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ ├── SoftwarePwm.cs │ │ └── Uart.cs │ ├── Clayster │ │ ├── Clayster.Library.Data.Doc.XML │ │ ├── Clayster.Library.Data.dll │ │ ├── Clayster.Library.EventLog.Doc.XML │ │ ├── Clayster.Library.EventLog.dll │ │ ├── Clayster.Library.Internet.Doc.XML │ │ ├── Clayster.Library.Internet.dll │ │ ├── Clayster.Library.Language.Doc.XML │ │ ├── Clayster.Library.Language.dll │ │ ├── Clayster.Library.Math.Doc.XML │ │ ├── Clayster.Library.Math.dll │ │ ├── MySql.Data.dll │ │ └── System.Data.SQLite.dll │ ├── Controller │ │ ├── Controller.csproj │ │ ├── CopyToRaspberryPi.bat │ │ ├── MailSettings.cs │ │ ├── Program.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ └── Subscription.cs │ ├── LearningIoT.sln │ └── Sensor │ │ ├── CopyToRaspberryPi.bat │ │ ├── LoginCredentials.cs │ │ ├── PendingEvent.cs │ │ ├── Program.cs │ │ ├── Properties │ │ └── AssemblyInfo.cs │ │ ├── Record.cs │ │ ├── Sensor.csproj │ │ └── SessionAuthentication.cs ├── Chapter06 │ ├── .gitattributes │ ├── .gitignore │ ├── Actuator │ │ ├── Actuator.csproj │ │ ├── CopyToRaspberryPi.bat │ │ ├── LoginCredentials.cs │ │ ├── Program.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ ├── SessionAuthentication.cs │ │ ├── State.cs │ │ └── XmppSettings.cs │ ├── Camera │ │ ├── Camera.csproj │ │ ├── CopyToRaspberryPi.bat │ │ ├── DefaultSettings.cs │ │ ├── DigitalSecurityCameraStillImage.cs │ │ ├── LoginCredentials.cs │ │ ├── Program.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ ├── SessionAuthentication.cs │ │ ├── UPnP │ │ │ ├── 128x128.png │ │ │ ├── 16x16.png │ │ │ ├── 24x24.png │ │ │ ├── 256x256.png │ │ │ ├── 32x32.png │ │ │ ├── 48x48.png │ │ │ ├── 64x64.png │ │ │ ├── CameraDevice.Layout.xml │ │ │ ├── CameraDevice.xml │ │ │ ├── StillImageService.Layout.xml │ │ │ └── StillImageService.xml │ │ └── XmppSettings.cs │ ├── Clayster.Library.IoT │ │ ├── Clayster.Library.IoT.csproj │ │ ├── NodeReference.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ ├── Provisioning │ │ │ ├── CacheItem.cs │ │ │ ├── CanControlEventArgs.cs │ │ │ ├── CanReadEventArgs.cs │ │ │ ├── ClaimedEventArgs.cs │ │ │ ├── IsFriendEventArgs.cs │ │ │ ├── JidEventArgs.cs │ │ │ ├── NodeReferenceEventArgs.cs │ │ │ ├── NumericalTag.cs │ │ │ ├── ProvisioningServer.cs │ │ │ ├── StringTag.cs │ │ │ ├── Tag.cs │ │ │ └── ThingRegistry.cs │ │ ├── SensorData │ │ │ ├── Export.cs │ │ │ ├── Field.cs │ │ │ ├── FieldBoolean.cs │ │ │ ├── FieldDateTime.cs │ │ │ ├── FieldEnum.cs │ │ │ ├── FieldGrid.cs │ │ │ ├── FieldLanguageStep.cs │ │ │ ├── FieldNumeric.cs │ │ │ ├── FieldStatus.cs │ │ │ ├── FieldString.cs │ │ │ ├── FieldTimeSpan.cs │ │ │ ├── ISensorDataExport.cs │ │ │ ├── Import.cs │ │ │ ├── PartitionedExport.cs │ │ │ ├── ReadoutRequest.cs │ │ │ ├── ReadoutType.cs │ │ │ ├── SensorDataHtmlExport.cs │ │ │ ├── SensorDataJsonExport.cs │ │ │ ├── SensorDataRdfExport.cs │ │ │ ├── SensorDataTerminalExport.cs │ │ │ ├── SensorDataTextExport.cs │ │ │ ├── SensorDataTurtleExport.cs │ │ │ └── SensorDataXmlExport.cs │ │ └── XmppInterfaces │ │ │ ├── ControlFormEventArgs.cs │ │ │ ├── ControlParameters │ │ │ ├── BooleanControlParameter.cs │ │ │ ├── ColorAlphaControlParameter.cs │ │ │ ├── ColorControlParameter.cs │ │ │ ├── ControlParameter.cs │ │ │ ├── DateControlParameter.cs │ │ │ ├── DateTimeControlParameter.cs │ │ │ ├── DoubleControlParameter.cs │ │ │ ├── DurationControlParameter.cs │ │ │ ├── IControlParameter.cs │ │ │ ├── Int32ControlParameter.cs │ │ │ ├── Int64ControlParameter.cs │ │ │ ├── StringControlParameter.cs │ │ │ └── TimeControlParameter.cs │ │ │ ├── FieldCondition.cs │ │ │ ├── ReadoutError.cs │ │ │ ├── SensorDataEventArgs.cs │ │ │ ├── XmppChatServer.cs │ │ │ ├── XmppControlClient.cs │ │ │ ├── XmppControlServer.cs │ │ │ ├── XmppInteroperabilityClient.cs │ │ │ ├── XmppInteroperabilityServer.cs │ │ │ ├── XmppSensorClient.cs │ │ │ └── XmppSensorServer.cs │ ├── Clayster.Library.RaspberryPi │ │ ├── Clayster.Library.RaspberryPi.csproj │ │ ├── Devices │ │ │ ├── ADC │ │ │ │ └── AD799x.cs │ │ │ ├── Cameras │ │ │ │ └── LinkSpriteJpegColorCamera.cs │ │ │ └── Temperature │ │ │ │ └── TexasInstrumentsTMP102.cs │ │ ├── DigitalInput.cs │ │ ├── DigitalOutput.cs │ │ ├── GPIO.cs │ │ ├── I2C.cs │ │ ├── MyClass.cs │ │ ├── ParallelDigitalInput.cs │ │ ├── ParallelDigitalOutput.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ ├── SoftwarePwm.cs │ │ └── Uart.cs │ ├── Clayster │ │ ├── Clayster.Library.Data.Doc.XML │ │ ├── Clayster.Library.Data.dll │ │ ├── Clayster.Library.EventLog.Doc.XML │ │ ├── Clayster.Library.EventLog.dll │ │ ├── Clayster.Library.Internet.Doc.XML │ │ ├── Clayster.Library.Internet.dll │ │ ├── Clayster.Library.Language.Doc.XML │ │ ├── Clayster.Library.Language.dll │ │ ├── Clayster.Library.Math.Doc.XML │ │ ├── Clayster.Library.Math.dll │ │ ├── MySql.Data.dll │ │ └── System.Data.SQLite.dll │ ├── Controller │ │ ├── Controller.csproj │ │ ├── CopyToRaspberryPi.bat │ │ ├── MailSettings.cs │ │ ├── Program.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ ├── Subscription.cs │ │ └── XmppSettings.cs │ ├── LearningIoT.sln │ └── Sensor │ │ ├── CopyToRaspberryPi.bat │ │ ├── LoginCredentials.cs │ │ ├── PendingEvent.cs │ │ ├── Program.cs │ │ ├── Properties │ │ └── AssemblyInfo.cs │ │ ├── Record.cs │ │ ├── Sensor.csproj │ │ ├── SessionAuthentication.cs │ │ └── XmppSettings.cs ├── Chapter07 │ ├── .gitattributes │ ├── .gitignore │ ├── Controller2 │ │ ├── Actuator.cs │ │ ├── CamStorage.cs │ │ ├── Camera.cs │ │ ├── Controller.cs │ │ ├── Controller2.csproj │ │ ├── Controller2.packagemanifest │ │ ├── CopyToRaspberryPi.bat │ │ ├── LearningIoT.cer │ │ ├── MailSettings.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ ├── Sensor.cs │ │ └── TestApp.cs │ └── LearningIoT.sln └── Chapter08 │ ├── .gitattributes │ ├── .gitignore │ ├── CoapGateway │ ├── CoapContent.cs │ ├── CoapFolder.cs │ ├── CoapGateway.csproj │ ├── CoapGateway.packagemanifest │ ├── CoapNode.cs │ ├── CoapPort.cs │ ├── CoapServer.cs │ ├── CoapSimpleContent.cs │ ├── CoapTopologyBridge.cs │ ├── ContentTypes │ │ ├── Complex │ │ │ ├── CoapFields.cs │ │ │ ├── CoapJson.cs │ │ │ ├── CoapXep0323.cs │ │ │ └── CoapXml.cs │ │ └── Simple │ │ │ ├── CoapBoolean.cs │ │ │ ├── CoapDateTime.cs │ │ │ ├── CoapDuration.cs │ │ │ ├── CoapNumber.cs │ │ │ ├── CoapPhysicalMagnitude.cs │ │ │ └── CoapString.cs │ ├── CopyToRaspberryPi.bat │ ├── Language │ │ └── CoapGateway.xml │ ├── LearningIoT.cer │ ├── Properties │ │ └── AssemblyInfo.cs │ └── Schema │ │ ├── CoapTopology.xsd │ │ └── CoapTopologyNoImport.xsd │ └── LearningIoT.sln ├── Module 2 ├── Chapter01 │ ├── Chapter1-1 │ │ └── B04844_01_01.ino │ ├── Chapter1-2 │ │ └── B04844_01_02.ino │ ├── Chapter1-3 │ │ └── B04844_01_03.ino │ ├── Chapter1-4 │ │ └── B04844_01_04.ino │ ├── Chapter1-5 │ │ └── B04844_01_05.ino │ ├── Chapter1-6 │ │ └── B04844_01_06.ino │ └── Chapter1-7 │ │ └── B04844_01_07.ino ├── Chapter02 │ ├── Chapter2-Code │ │ ├── chapter2-1 │ │ │ └── B04844_02_01.ino │ │ ├── chapter2-2 │ │ │ └── B04844_02_02.ino │ │ ├── chapter2-3 │ │ │ └── B04844_02_03.ino │ │ ├── chapter2-4 │ │ │ └── B04844_02_04.ino │ │ ├── chapter2-5 │ │ │ └── B04844_02_05.ino │ │ ├── chapter2-6 │ │ │ └── B04844_02_06.ino │ │ ├── chapter2-7 │ │ │ └── B04844_02_07.ino │ │ └── drv2605.pdf │ └── Chapter2-Libraries │ │ └── Adafruit_DRV2605_Library-master.zip ├── Chapter03 │ ├── Chapter3-1 │ │ └── B04844_03_01.ino │ ├── Chapter3-2 │ │ └── B04844_03_02.ino │ ├── Chapter3-3 │ │ └── B04844_03_03.ino │ ├── Chapter3-4 │ │ └── B04844_03_04.ino │ └── Chapter3-5 │ │ └── B04844_03_05.ino ├── Chapter04 │ ├── Chapter4-Codes │ │ ├── B04844_04_01 │ │ │ └── B04844_04_01.ino │ │ ├── B04844_04_02 │ │ │ └── B04844_04_02.ino │ │ ├── B04844_04_03 │ │ │ └── B04844_04_03.ino │ │ └── B04844_04_04 │ │ │ └── B04844_04_04.ino │ └── Chapter4-Resources │ │ └── Adafruit-VC0706-Serial-Camera-Library-master │ │ └── Adafruit-VC0706-Serial-Camera-Library-master │ │ ├── Adafruit_VC0706.cpp │ │ ├── Adafruit_VC0706.h │ │ ├── README.txt │ │ ├── getimage0706.py │ │ ├── library.properties │ │ └── raspi_camera.py ├── Chapter05 │ ├── Chapter5-Codes │ │ ├── B04844_05_01 │ │ │ └── B04844_05_01.ino │ │ └── index.html │ └── Chapter5-Software │ │ ├── FlexiTimer2 │ │ └── FlexiTimer2 │ │ │ ├── FlexiTimer2.cpp │ │ │ ├── FlexiTimer2.h │ │ │ ├── examples │ │ │ └── FlashLed │ │ │ │ └── FlashLed.pde │ │ │ └── keywords.txt │ │ └── NearBusEther_v16 │ │ └── NearBusEther_v16 │ │ ├── NearbusEther_v16.cpp │ │ ├── NearbusEther_v16.h │ │ └── examples │ │ └── Hello_World_Ether │ │ └── Hello_World_Ether.ino ├── Chapter06 │ ├── Chapter6-Codes │ │ ├── B04844_06_01 │ │ │ └── B04844_06_01.ino │ │ ├── B04844_06_02 │ │ │ └── B04844_06_02.ino │ │ └── B04844_06_03 │ │ │ └── B04844_06_03.ino │ └── Chapter6-Resouces │ │ └── TinyGPSPlus-master.zip ├── Chapter07 │ ├── B04844_07_01.ino │ └── twitter_test.py └── Chapter08 │ ├── Chapter8-Codes │ ├── B04844_08_01 │ │ └── B04844_08_01.ino │ ├── B04844_08_02 │ │ └── B04844_08_02.ino │ ├── B04844_08_03 │ │ └── B04844_08_03.ino │ ├── B04844_08_04 │ │ └── B04844_08_04.ino │ └── B04844_08_05 │ │ └── B04844_08_05.ino │ └── Chapter8-Software │ └── Arduino-IRremote-master │ ├── .gitignore │ ├── .travis.yml │ ├── Contributors.md │ ├── IRremote.cpp │ ├── IRremote.h │ ├── IRremoteInt.h │ ├── LICENSE.txt │ ├── README.md │ ├── changelog.md │ ├── examples │ ├── AiwaRCT501SendDemo │ │ └── AiwaRCT501SendDemo.ino │ ├── IRrecord │ │ └── IRrecord.ino │ ├── IRrecvDemo │ │ └── IRrecvDemo.ino │ ├── IRrecvDump │ │ └── IRrecvDump.ino │ ├── IRrecvDumpV2 │ │ └── IRrecvDumpV2.ino │ ├── IRrelay │ │ └── IRrelay.ino │ ├── IRsendDemo │ │ └── IRsendDemo.ino │ ├── IRtest │ │ └── IRtest.ino │ ├── IRtest2 │ │ └── IRtest2.ino │ └── JVCPanasonicSendDemo │ │ └── JVCPanasonicSendDemo.ino │ ├── irISR.cpp │ ├── irPronto.cpp │ ├── irRecv.cpp │ ├── irSend.cpp │ ├── ir_Aiwa.cpp │ ├── ir_Denon.cpp │ ├── ir_Dish.cpp │ ├── ir_JVC.cpp │ ├── ir_LG.cpp │ ├── ir_Mitsubishi.cpp │ ├── ir_NEC.cpp │ ├── ir_Panasonic.cpp │ ├── ir_RC5_RC6.cpp │ ├── ir_Samsung.cpp │ ├── ir_Sanyo.cpp │ ├── ir_Sharp.cpp │ ├── ir_Sony.cpp │ ├── ir_Template.cpp │ ├── ir_Whynter.cpp │ ├── keywords.txt │ ├── library.json │ └── library.properties └── README.md /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | -------------------------------------------------------------------------------- /License: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 Packt 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Module 1/Chapter02/.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | *.sln merge=union 7 | *.csproj merge=union 8 | *.vbproj merge=union 9 | *.fsproj merge=union 10 | *.dbproj merge=union 11 | 12 | # Standard to msysgit 13 | *.doc diff=astextplain 14 | *.DOC diff=astextplain 15 | *.docx diff=astextplain 16 | *.DOCX diff=astextplain 17 | *.dot diff=astextplain 18 | *.DOT diff=astextplain 19 | *.pdf diff=astextplain 20 | *.PDF diff=astextplain 21 | *.rtf diff=astextplain 22 | *.RTF diff=astextplain 23 | -------------------------------------------------------------------------------- /Module 1/Chapter02/Actuator/CopyToRaspberryPi.bat: -------------------------------------------------------------------------------- 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: 11 | -------------------------------------------------------------------------------- /Module 1/Chapter02/Actuator/LoginCredentials.cs: -------------------------------------------------------------------------------- 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 ().GetEarliestCreatedDeleteOthers (); 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /Module 1/Chapter02/Actuator/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | 4 | // Information about this assembly is defined by the following attributes. 5 | // Change them to the values specific to your project. 6 | 7 | [assembly: AssemblyTitle ("Actuator")] 8 | [assembly: AssemblyDescription ("Implements an actuator, with digital and PWM output.")] 9 | [assembly: AssemblyConfiguration ("")] 10 | [assembly: AssemblyCompany ("Clayster")] 11 | [assembly: AssemblyProduct ("")] 12 | [assembly: AssemblyCopyright ("Peter Waher")] 13 | [assembly: AssemblyTrademark ("Clayster")] 14 | [assembly: AssemblyCulture ("")] 15 | 16 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". 17 | // The form "{Major}.{Minor}.*" will automatically update the build and revision, 18 | // and "{Major}.{Minor}.{Build}.*" will update just the revision. 19 | 20 | [assembly: AssemblyVersion ("1.0.*")] 21 | 22 | // The following attributes are used to specify the signing key for the assembly, 23 | // if desired. See the Mono documentation for more information about signing. 24 | 25 | //[assembly: AssemblyDelaySign(false)] 26 | //[assembly: AssemblyKeyFile("")] 27 | 28 | -------------------------------------------------------------------------------- /Module 1/Chapter02/Actuator/SessionAuthentication.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Clayster.Library.Internet.HTTP; 3 | 4 | namespace Actuator 5 | { 6 | public class SessionAuthentication : HttpServerAuthenticationMethod 7 | { 8 | public SessionAuthentication () 9 | { 10 | } 11 | 12 | public override string Challenge 13 | { 14 | get 15 | { 16 | return string.Empty; 17 | } 18 | } 19 | 20 | public override object Authorize (HttpHeader Header, HttpServer.Method Method, IHttpServerResource Resource, System.Net.EndPoint RemoteEndPoint, out string UserName, out UnauthorizedReason Reason) 21 | { 22 | string SessionId = Header.GetCookie ("SessionId"); 23 | 24 | if (MainClass.CheckSession (SessionId, out UserName)) 25 | { 26 | Reason = UnauthorizedReason.NoError; 27 | return UserName; 28 | } else 29 | { 30 | Reason = UnauthorizedReason.OldCredentialsTryAgain; 31 | return null; 32 | } 33 | } 34 | 35 | } 36 | } 37 | 38 | -------------------------------------------------------------------------------- /Module 1/Chapter02/Clayster.Library.IoT/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Reflection; 3 | using System.Runtime.CompilerServices; 4 | 5 | // Information about this assembly is defined by the following attributes. 6 | // Change them to the values specific to your project. 7 | 8 | [assembly: AssemblyTitle ("Clayster.Library.IoT")] 9 | [assembly: AssemblyDescription ("Library for Interoperability in Internet of Things")] 10 | [assembly: AssemblyConfiguration ("")] 11 | [assembly: AssemblyCompany ("Clayster")] 12 | [assembly: AssemblyProduct ("")] 13 | [assembly: AssemblyCopyright ("Peter Waher")] 14 | [assembly: AssemblyTrademark ("Clayster")] 15 | [assembly: AssemblyCulture ("")] 16 | [assembly: CLSCompliant (true)] 17 | 18 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". 19 | // The form "{Major}.{Minor}.*" will automatically update the build and revision, 20 | // and "{Major}.{Minor}.{Build}.*" will update just the revision. 21 | 22 | [assembly: AssemblyVersion ("1.0.*")] 23 | 24 | // The following attributes are used to specify the signing key for the assembly, 25 | // if desired. See the Mono documentation for more information about signing. 26 | 27 | //[assembly: AssemblyDelaySign(false)] 28 | //[assembly: AssemblyKeyFile("")] 29 | 30 | -------------------------------------------------------------------------------- /Module 1/Chapter02/Clayster.Library.IoT/SensorData/Field.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter02/Clayster.Library.IoT/SensorData/Field.cs -------------------------------------------------------------------------------- /Module 1/Chapter02/Clayster.Library.IoT/SensorData/FieldBoolean.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter02/Clayster.Library.IoT/SensorData/FieldBoolean.cs -------------------------------------------------------------------------------- /Module 1/Chapter02/Clayster.Library.IoT/SensorData/FieldDateTime.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter02/Clayster.Library.IoT/SensorData/FieldDateTime.cs -------------------------------------------------------------------------------- /Module 1/Chapter02/Clayster.Library.IoT/SensorData/FieldEnum.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter02/Clayster.Library.IoT/SensorData/FieldEnum.cs -------------------------------------------------------------------------------- /Module 1/Chapter02/Clayster.Library.IoT/SensorData/FieldNumeric.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter02/Clayster.Library.IoT/SensorData/FieldNumeric.cs -------------------------------------------------------------------------------- /Module 1/Chapter02/Clayster.Library.IoT/SensorData/FieldStatus.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Clayster.Library.IoT.SensorData 4 | { 5 | /// 6 | /// Status of the value. 7 | /// 8 | [Flags] 9 | [CLSCompliant(true)] 10 | public enum FieldStatus 11 | { 12 | /// 13 | /// The corresponding value is missing. 14 | /// 15 | Missing = 1, 16 | 17 | /// 18 | /// The value is an automatic estimate 19 | /// 20 | AutomaticEstimate = 2, 21 | 22 | /// 23 | /// The value is a manual estimate 24 | /// 25 | ManualEstimate = 4, 26 | 27 | /// 28 | /// The value is a manually read value. 29 | /// 30 | ManualReadout = 8, 31 | 32 | /// 33 | /// The value is an automatically read value. 34 | /// 35 | AutomaticReadout = 16, 36 | 37 | /// 38 | /// Time in meter differs from time on server. 39 | /// 40 | TimeOffset = 32, 41 | 42 | /// 43 | /// Value flagged with a warning. 44 | /// 45 | Warning = 64, 46 | 47 | /// 48 | /// Value flagged with an error. 49 | /// 50 | Error = 128, 51 | 52 | /// 53 | /// Value has been signed and approved. 54 | /// 55 | Signed = 256, 56 | 57 | /// 58 | /// Value has been invoiced. 59 | /// 60 | Invoiced = 512, 61 | 62 | /// 63 | /// Value is the last of a series of values. The next value comprises the 64 | /// start of a new series. 65 | /// 66 | EndOfSeries = 1024, 67 | 68 | /// 69 | /// Power failure has occurred in the corresponding period. 70 | /// 71 | PowerFailure = 2048, 72 | 73 | /// 74 | /// Value has been invoiced and confirmed by receiver of invoice. 75 | /// 76 | InvoicedConfirmed = 4096 77 | } 78 | } 79 | 80 | -------------------------------------------------------------------------------- /Module 1/Chapter02/Clayster.Library.IoT/SensorData/FieldString.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter02/Clayster.Library.IoT/SensorData/FieldString.cs -------------------------------------------------------------------------------- /Module 1/Chapter02/Clayster.Library.IoT/SensorData/FieldTimeSpan.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter02/Clayster.Library.IoT/SensorData/FieldTimeSpan.cs -------------------------------------------------------------------------------- /Module 1/Chapter02/Clayster.Library.RaspberryPi/MyClass.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Clayster.Library.RaspberryPi 4 | { 5 | public class MyClass 6 | { 7 | public MyClass () 8 | { 9 | } 10 | } 11 | } 12 | 13 | -------------------------------------------------------------------------------- /Module 1/Chapter02/Clayster.Library.RaspberryPi/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | 4 | // Information about this assembly is defined by the following attributes. 5 | // Change them to the values specific to your project. 6 | 7 | [assembly: AssemblyTitle ("Clayster.Library.RaspberryPi")] 8 | [assembly: AssemblyDescription ("Hardware abstraction layer for the RaspberryPi.")] 9 | [assembly: AssemblyConfiguration ("")] 10 | [assembly: AssemblyCompany ("Clayster")] 11 | [assembly: AssemblyProduct ("")] 12 | [assembly: AssemblyCopyright ("Peter Waher")] 13 | [assembly: AssemblyTrademark ("Clayster")] 14 | [assembly: AssemblyCulture ("")] 15 | 16 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". 17 | // The form "{Major}.{Minor}.*" will automatically update the build and revision, 18 | // and "{Major}.{Minor}.{Build}.*" will update just the revision. 19 | 20 | [assembly: AssemblyVersion ("1.0.*")] 21 | 22 | // The following attributes are used to specify the signing key for the assembly, 23 | // if desired. See the Mono documentation for more information about signing. 24 | 25 | //[assembly: AssemblyDelaySign(false)] 26 | //[assembly: AssemblyKeyFile("")] 27 | 28 | -------------------------------------------------------------------------------- /Module 1/Chapter02/Clayster/Clayster.Library.Data.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter02/Clayster/Clayster.Library.Data.dll -------------------------------------------------------------------------------- /Module 1/Chapter02/Clayster/Clayster.Library.EventLog.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter02/Clayster/Clayster.Library.EventLog.dll -------------------------------------------------------------------------------- /Module 1/Chapter02/Clayster/Clayster.Library.Internet.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter02/Clayster/Clayster.Library.Internet.dll -------------------------------------------------------------------------------- /Module 1/Chapter02/Clayster/Clayster.Library.Language.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter02/Clayster/Clayster.Library.Language.dll -------------------------------------------------------------------------------- /Module 1/Chapter02/Clayster/Clayster.Library.Math.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter02/Clayster/Clayster.Library.Math.dll -------------------------------------------------------------------------------- /Module 1/Chapter02/Clayster/MySql.Data.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter02/Clayster/MySql.Data.dll -------------------------------------------------------------------------------- /Module 1/Chapter02/Clayster/System.Data.SQLite.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter02/Clayster/System.Data.SQLite.dll -------------------------------------------------------------------------------- /Module 1/Chapter02/Controller/CopyToRaspberryPi.bat: -------------------------------------------------------------------------------- 1 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/System.Data.SQLite.dll pi@192.168.0.26: 2 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/MySql.Data.dll pi@192.168.0.26: 3 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Internet.dll pi@192.168.0.26: 4 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.EventLog.dll pi@192.168.0.26: 5 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Data.dll pi@192.168.0.26: 6 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Math.dll pi@192.168.0.26: 7 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Language.dll pi@192.168.0.26: 8 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.IoT.dll pi@192.168.0.26: 9 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Controller.exe pi@192.168.0.26: 10 | -------------------------------------------------------------------------------- /Module 1/Chapter02/Controller/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | 4 | // Information about this assembly is defined by the following attributes. 5 | // Change them to the values specific to your project. 6 | 7 | [assembly: AssemblyTitle ("Controller")] 8 | [assembly: AssemblyDescription ("Implements a controller, controlling an actuator based on values read from a sensor.")] 9 | [assembly: AssemblyConfiguration ("")] 10 | [assembly: AssemblyCompany ("Clayster")] 11 | [assembly: AssemblyProduct ("")] 12 | [assembly: AssemblyCopyright ("Peter Waher")] 13 | [assembly: AssemblyTrademark ("Clayster")] 14 | [assembly: AssemblyCulture ("")] 15 | 16 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". 17 | // The form "{Major}.{Minor}.*" will automatically update the build and revision, 18 | // and "{Major}.{Minor}.{Build}.*" will update just the revision. 19 | 20 | [assembly: AssemblyVersion ("1.0.*")] 21 | 22 | // The following attributes are used to specify the signing key for the assembly, 23 | // if desired. See the Mono documentation for more information about signing. 24 | 25 | //[assembly: AssemblyDelaySign(false)] 26 | //[assembly: AssemblyKeyFile("")] 27 | 28 | -------------------------------------------------------------------------------- /Module 1/Chapter02/Sensor/CopyToRaspberryPi.bat: -------------------------------------------------------------------------------- 1 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/System.Data.SQLite.dll pi@192.168.0.29: 2 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/MySql.Data.dll pi@192.168.0.29: 3 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Internet.dll pi@192.168.0.29: 4 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.EventLog.dll pi@192.168.0.29: 5 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Data.dll pi@192.168.0.29: 6 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Math.dll pi@192.168.0.29: 7 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Language.dll pi@192.168.0.29: 8 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.RaspberryPi.dll pi@192.168.0.29: 9 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.IoT.dll pi@192.168.0.29: 10 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Sensor.exe pi@192.168.0.29: 11 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Certificate.pfx pi@192.168.0.29: 12 | -------------------------------------------------------------------------------- /Module 1/Chapter02/Sensor/LoginCredentials.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Clayster.Library.Data; 3 | 4 | namespace Sensor 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 ().GetEarliestCreatedDeleteOthers (); 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /Module 1/Chapter02/Sensor/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | 4 | // Information about this assembly is defined by the following attributes. 5 | // Change them to the values specific to your project. 6 | 7 | [assembly: AssemblyTitle ("Sensor")] 8 | [assembly: AssemblyDescription ("Implements a sensor, sensing Temperature, Light and Movement.")] 9 | [assembly: AssemblyConfiguration ("")] 10 | [assembly: AssemblyCompany ("Clayster")] 11 | [assembly: AssemblyProduct ("")] 12 | [assembly: AssemblyCopyright ("Peter Waher")] 13 | [assembly: AssemblyTrademark ("Clayster")] 14 | [assembly: AssemblyCulture ("")] 15 | 16 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". 17 | // The form "{Major}.{Minor}.*" will automatically update the build and revision, 18 | // and "{Major}.{Minor}.{Build}.*" will update just the revision. 19 | 20 | [assembly: AssemblyVersion ("1.0.*")] 21 | 22 | // The following attributes are used to specify the signing key for the assembly, 23 | // if desired. See the Mono documentation for more information about signing. 24 | 25 | //[assembly: AssemblyDelaySign(false)] 26 | //[assembly: AssemblyKeyFile("")] 27 | 28 | -------------------------------------------------------------------------------- /Module 1/Chapter02/Sensor/SessionAuthentication.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Clayster.Library.Internet.HTTP; 3 | 4 | namespace Sensor 5 | { 6 | public class SessionAuthentication : HttpServerAuthenticationMethod 7 | { 8 | public SessionAuthentication () 9 | { 10 | } 11 | 12 | public override string Challenge 13 | { 14 | get 15 | { 16 | return string.Empty; 17 | } 18 | } 19 | 20 | public override object Authorize (HttpHeader Header, HttpServer.Method Method, IHttpServerResource Resource, System.Net.EndPoint RemoteEndPoint, out string UserName, out UnauthorizedReason Reason) 21 | { 22 | string SessionId = Header.GetCookie ("SessionId"); 23 | 24 | if (MainClass.CheckSession (SessionId, out UserName)) 25 | { 26 | Reason = UnauthorizedReason.NoError; 27 | return UserName; 28 | } else 29 | { 30 | Reason = UnauthorizedReason.OldCredentialsTryAgain; 31 | return null; 32 | } 33 | } 34 | 35 | } 36 | } 37 | 38 | -------------------------------------------------------------------------------- /Module 1/Chapter02/Sensor1/CopyToRaspberryPi.bat: -------------------------------------------------------------------------------- 1 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/System.Data.SQLite.dll pi@192.168.0.29: 2 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/MySql.Data.dll pi@192.168.0.29: 3 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Internet.dll pi@192.168.0.29: 4 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.EventLog.dll pi@192.168.0.29: 5 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Data.dll pi@192.168.0.29: 6 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Math.dll pi@192.168.0.29: 7 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Language.dll pi@192.168.0.29: 8 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.RaspberryPi.dll pi@192.168.0.29: 9 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.IoT.dll pi@192.168.0.29: 10 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Sensor.exe pi@192.168.0.29: 11 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Certificate.pfx pi@192.168.0.29: 12 | -------------------------------------------------------------------------------- /Module 1/Chapter02/Sensor1/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading; 3 | using Clayster.Library.EventLog; 4 | using Clayster.Library.EventLog.EventSinks.Misc; 5 | 6 | namespace Sensor 7 | { 8 | class MainClass 9 | { 10 | public static int Main (string[] args) 11 | { 12 | bool Executing = true; 13 | 14 | Log.Register (new ConsoleOutEventLog (80)); 15 | Log.Information ("Initializing application..."); 16 | 17 | Console.CancelKeyPress += (object sender, ConsoleCancelEventArgs e) => 18 | { 19 | e.Cancel = true; 20 | Executing = false; 21 | }; 22 | 23 | // Main loop 24 | 25 | Log.Information ("Initialization complete. Application started..."); 26 | 27 | try 28 | { 29 | while (Executing) 30 | { 31 | System.Threading.Thread.Sleep (1000); 32 | } 33 | } catch (Exception ex) 34 | { 35 | Log.Exception (ex); 36 | } finally 37 | { 38 | Log.Information ("Terminating application."); 39 | Log.Flush (); 40 | Log.Terminate (); 41 | } 42 | 43 | return 0; 44 | } 45 | 46 | } 47 | } -------------------------------------------------------------------------------- /Module 1/Chapter02/Sensor1/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | 4 | // Information about this assembly is defined by the following attributes. 5 | // Change them to the values specific to your project. 6 | 7 | [assembly: AssemblyTitle ("Sensor")] 8 | [assembly: AssemblyDescription ("Implements a sensor, sensing Temperature, Light and Movement.")] 9 | [assembly: AssemblyConfiguration ("")] 10 | [assembly: AssemblyCompany ("Clayster")] 11 | [assembly: AssemblyProduct ("")] 12 | [assembly: AssemblyCopyright ("Peter Waher")] 13 | [assembly: AssemblyTrademark ("Clayster")] 14 | [assembly: AssemblyCulture ("")] 15 | 16 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". 17 | // The form "{Major}.{Minor}.*" will automatically update the build and revision, 18 | // and "{Major}.{Minor}.{Build}.*" will update just the revision. 19 | 20 | [assembly: AssemblyVersion ("1.0.*")] 21 | 22 | // The following attributes are used to specify the signing key for the assembly, 23 | // if desired. See the Mono documentation for more information about signing. 24 | 25 | //[assembly: AssemblyDelaySign(false)] 26 | //[assembly: AssemblyKeyFile("")] 27 | 28 | -------------------------------------------------------------------------------- /Module 1/Chapter02/Sensor2/CopyToRaspberryPi.bat: -------------------------------------------------------------------------------- 1 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/System.Data.SQLite.dll pi@192.168.0.29: 2 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/MySql.Data.dll pi@192.168.0.29: 3 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Internet.dll pi@192.168.0.29: 4 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.EventLog.dll pi@192.168.0.29: 5 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Data.dll pi@192.168.0.29: 6 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Math.dll pi@192.168.0.29: 7 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Language.dll pi@192.168.0.29: 8 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.RaspberryPi.dll pi@192.168.0.29: 9 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.IoT.dll pi@192.168.0.29: 10 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Sensor.exe pi@192.168.0.29: 11 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Certificate.pfx pi@192.168.0.29: 12 | -------------------------------------------------------------------------------- /Module 1/Chapter02/Sensor2/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | 4 | // Information about this assembly is defined by the following attributes. 5 | // Change them to the values specific to your project. 6 | 7 | [assembly: AssemblyTitle ("Sensor")] 8 | [assembly: AssemblyDescription ("Implements a sensor, sensing Temperature, Light and Movement.")] 9 | [assembly: AssemblyConfiguration ("")] 10 | [assembly: AssemblyCompany ("Clayster")] 11 | [assembly: AssemblyProduct ("")] 12 | [assembly: AssemblyCopyright ("Peter Waher")] 13 | [assembly: AssemblyTrademark ("Clayster")] 14 | [assembly: AssemblyCulture ("")] 15 | 16 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". 17 | // The form "{Major}.{Minor}.*" will automatically update the build and revision, 18 | // and "{Major}.{Minor}.{Build}.*" will update just the revision. 19 | 20 | [assembly: AssemblyVersion ("1.0.*")] 21 | 22 | // The following attributes are used to specify the signing key for the assembly, 23 | // if desired. See the Mono documentation for more information about signing. 24 | 25 | //[assembly: AssemblyDelaySign(false)] 26 | //[assembly: AssemblyKeyFile("")] 27 | 28 | -------------------------------------------------------------------------------- /Module 1/Chapter02/Sensor3/CopyToRaspberryPi.bat: -------------------------------------------------------------------------------- 1 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/System.Data.SQLite.dll pi@192.168.0.29: 2 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/MySql.Data.dll pi@192.168.0.29: 3 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Internet.dll pi@192.168.0.29: 4 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.EventLog.dll pi@192.168.0.29: 5 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Data.dll pi@192.168.0.29: 6 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Math.dll pi@192.168.0.29: 7 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Language.dll pi@192.168.0.29: 8 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.RaspberryPi.dll pi@192.168.0.29: 9 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.IoT.dll pi@192.168.0.29: 10 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Sensor.exe pi@192.168.0.29: 11 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Certificate.pfx pi@192.168.0.29: 12 | -------------------------------------------------------------------------------- /Module 1/Chapter02/Sensor3/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | 4 | // Information about this assembly is defined by the following attributes. 5 | // Change them to the values specific to your project. 6 | 7 | [assembly: AssemblyTitle ("Sensor")] 8 | [assembly: AssemblyDescription ("Implements a sensor, sensing Temperature, Light and Movement.")] 9 | [assembly: AssemblyConfiguration ("")] 10 | [assembly: AssemblyCompany ("Clayster")] 11 | [assembly: AssemblyProduct ("")] 12 | [assembly: AssemblyCopyright ("Peter Waher")] 13 | [assembly: AssemblyTrademark ("Clayster")] 14 | [assembly: AssemblyCulture ("")] 15 | 16 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". 17 | // The form "{Major}.{Minor}.*" will automatically update the build and revision, 18 | // and "{Major}.{Minor}.{Build}.*" will update just the revision. 19 | 20 | [assembly: AssemblyVersion ("1.0.*")] 21 | 22 | // The following attributes are used to specify the signing key for the assembly, 23 | // if desired. See the Mono documentation for more information about signing. 24 | 25 | //[assembly: AssemblyDelaySign(false)] 26 | //[assembly: AssemblyKeyFile("")] 27 | 28 | -------------------------------------------------------------------------------- /Module 1/Chapter02/Sensor4/CopyToRaspberryPi.bat: -------------------------------------------------------------------------------- 1 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/System.Data.SQLite.dll pi@192.168.0.29: 2 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/MySql.Data.dll pi@192.168.0.29: 3 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Internet.dll pi@192.168.0.29: 4 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.EventLog.dll pi@192.168.0.29: 5 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Data.dll pi@192.168.0.29: 6 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Math.dll pi@192.168.0.29: 7 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Language.dll pi@192.168.0.29: 8 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.RaspberryPi.dll pi@192.168.0.29: 9 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.IoT.dll pi@192.168.0.29: 10 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Sensor.exe pi@192.168.0.29: 11 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Certificate.pfx pi@192.168.0.29: 12 | -------------------------------------------------------------------------------- /Module 1/Chapter02/Sensor4/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | 4 | // Information about this assembly is defined by the following attributes. 5 | // Change them to the values specific to your project. 6 | 7 | [assembly: AssemblyTitle ("Sensor")] 8 | [assembly: AssemblyDescription ("Implements a sensor, sensing Temperature, Light and Movement.")] 9 | [assembly: AssemblyConfiguration ("")] 10 | [assembly: AssemblyCompany ("Clayster")] 11 | [assembly: AssemblyProduct ("")] 12 | [assembly: AssemblyCopyright ("Peter Waher")] 13 | [assembly: AssemblyTrademark ("Clayster")] 14 | [assembly: AssemblyCulture ("")] 15 | 16 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". 17 | // The form "{Major}.{Minor}.*" will automatically update the build and revision, 18 | // and "{Major}.{Minor}.{Build}.*" will update just the revision. 19 | 20 | [assembly: AssemblyVersion ("1.0.*")] 21 | 22 | // The following attributes are used to specify the signing key for the assembly, 23 | // if desired. See the Mono documentation for more information about signing. 24 | 25 | //[assembly: AssemblyDelaySign(false)] 26 | //[assembly: AssemblyKeyFile("")] 27 | 28 | -------------------------------------------------------------------------------- /Module 1/Chapter02/Sensor5/CopyToRaspberryPi.bat: -------------------------------------------------------------------------------- 1 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/System.Data.SQLite.dll pi@192.168.0.29: 2 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/MySql.Data.dll pi@192.168.0.29: 3 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Internet.dll pi@192.168.0.29: 4 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.EventLog.dll pi@192.168.0.29: 5 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Data.dll pi@192.168.0.29: 6 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Math.dll pi@192.168.0.29: 7 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Language.dll pi@192.168.0.29: 8 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.RaspberryPi.dll pi@192.168.0.29: 9 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.IoT.dll pi@192.168.0.29: 10 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Sensor.exe pi@192.168.0.29: 11 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Certificate.pfx pi@192.168.0.29: 12 | -------------------------------------------------------------------------------- /Module 1/Chapter02/Sensor5/LoginCredentials.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Clayster.Library.Data; 3 | 4 | namespace Sensor 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 ().GetEarliestCreatedDeleteOthers (); 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /Module 1/Chapter02/Sensor5/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | 4 | // Information about this assembly is defined by the following attributes. 5 | // Change them to the values specific to your project. 6 | 7 | [assembly: AssemblyTitle ("Sensor")] 8 | [assembly: AssemblyDescription ("Implements a sensor, sensing Temperature, Light and Movement.")] 9 | [assembly: AssemblyConfiguration ("")] 10 | [assembly: AssemblyCompany ("Clayster")] 11 | [assembly: AssemblyProduct ("")] 12 | [assembly: AssemblyCopyright ("Peter Waher")] 13 | [assembly: AssemblyTrademark ("Clayster")] 14 | [assembly: AssemblyCulture ("")] 15 | 16 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". 17 | // The form "{Major}.{Minor}.*" will automatically update the build and revision, 18 | // and "{Major}.{Minor}.{Build}.*" will update just the revision. 19 | 20 | [assembly: AssemblyVersion ("1.0.*")] 21 | 22 | // The following attributes are used to specify the signing key for the assembly, 23 | // if desired. See the Mono documentation for more information about signing. 24 | 25 | //[assembly: AssemblyDelaySign(false)] 26 | //[assembly: AssemblyKeyFile("")] 27 | 28 | -------------------------------------------------------------------------------- /Module 1/Chapter02/Sensor5/SessionAuthentication.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Clayster.Library.Internet.HTTP; 3 | 4 | namespace Sensor 5 | { 6 | public class SessionAuthentication : HttpServerAuthenticationMethod 7 | { 8 | public SessionAuthentication () 9 | { 10 | } 11 | 12 | public override string Challenge 13 | { 14 | get 15 | { 16 | return string.Empty; 17 | } 18 | } 19 | 20 | public override object Authorize (HttpHeader Header, HttpServer.Method Method, IHttpServerResource Resource, System.Net.EndPoint RemoteEndPoint, out string UserName, out UnauthorizedReason Reason) 21 | { 22 | string SessionId = Header.GetCookie ("SessionId"); 23 | 24 | if (MainClass.CheckSession (SessionId, out UserName)) 25 | { 26 | Reason = UnauthorizedReason.NoError; 27 | return UserName; 28 | } else 29 | { 30 | Reason = UnauthorizedReason.OldCredentialsTryAgain; 31 | return null; 32 | } 33 | } 34 | 35 | } 36 | } 37 | 38 | -------------------------------------------------------------------------------- /Module 1/Chapter02/Sensor6/CopyToRaspberryPi.bat: -------------------------------------------------------------------------------- 1 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/System.Data.SQLite.dll pi@192.168.0.29: 2 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/MySql.Data.dll pi@192.168.0.29: 3 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Internet.dll pi@192.168.0.29: 4 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.EventLog.dll pi@192.168.0.29: 5 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Data.dll pi@192.168.0.29: 6 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Math.dll pi@192.168.0.29: 7 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Language.dll pi@192.168.0.29: 8 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.RaspberryPi.dll pi@192.168.0.29: 9 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.IoT.dll pi@192.168.0.29: 10 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Sensor.exe pi@192.168.0.29: 11 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Certificate.pfx pi@192.168.0.29: 12 | -------------------------------------------------------------------------------- /Module 1/Chapter02/Sensor6/LoginCredentials.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Clayster.Library.Data; 3 | 4 | namespace Sensor 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 ().GetEarliestCreatedDeleteOthers (); 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /Module 1/Chapter02/Sensor6/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | 4 | // Information about this assembly is defined by the following attributes. 5 | // Change them to the values specific to your project. 6 | 7 | [assembly: AssemblyTitle ("Sensor")] 8 | [assembly: AssemblyDescription ("Implements a sensor, sensing Temperature, Light and Movement.")] 9 | [assembly: AssemblyConfiguration ("")] 10 | [assembly: AssemblyCompany ("Clayster")] 11 | [assembly: AssemblyProduct ("")] 12 | [assembly: AssemblyCopyright ("Peter Waher")] 13 | [assembly: AssemblyTrademark ("Clayster")] 14 | [assembly: AssemblyCulture ("")] 15 | 16 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". 17 | // The form "{Major}.{Minor}.*" will automatically update the build and revision, 18 | // and "{Major}.{Minor}.{Build}.*" will update just the revision. 19 | 20 | [assembly: AssemblyVersion ("1.0.*")] 21 | 22 | // The following attributes are used to specify the signing key for the assembly, 23 | // if desired. See the Mono documentation for more information about signing. 24 | 25 | //[assembly: AssemblyDelaySign(false)] 26 | //[assembly: AssemblyKeyFile("")] 27 | 28 | -------------------------------------------------------------------------------- /Module 1/Chapter02/Sensor6/SessionAuthentication.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Clayster.Library.Internet.HTTP; 3 | 4 | namespace Sensor 5 | { 6 | public class SessionAuthentication : HttpServerAuthenticationMethod 7 | { 8 | public SessionAuthentication () 9 | { 10 | } 11 | 12 | public override string Challenge 13 | { 14 | get 15 | { 16 | return string.Empty; 17 | } 18 | } 19 | 20 | public override object Authorize (HttpHeader Header, HttpServer.Method Method, IHttpServerResource Resource, System.Net.EndPoint RemoteEndPoint, out string UserName, out UnauthorizedReason Reason) 21 | { 22 | string SessionId = Header.GetCookie ("SessionId"); 23 | 24 | if (MainClass.CheckSession (SessionId, out UserName)) 25 | { 26 | Reason = UnauthorizedReason.NoError; 27 | return UserName; 28 | } else 29 | { 30 | Reason = UnauthorizedReason.OldCredentialsTryAgain; 31 | return null; 32 | } 33 | } 34 | 35 | } 36 | } 37 | 38 | -------------------------------------------------------------------------------- /Module 1/Chapter03/.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | *.sln merge=union 7 | *.csproj merge=union 8 | *.vbproj merge=union 9 | *.fsproj merge=union 10 | *.dbproj merge=union 11 | 12 | # Standard to msysgit 13 | *.doc diff=astextplain 14 | *.DOC diff=astextplain 15 | *.docx diff=astextplain 16 | *.DOCX diff=astextplain 17 | *.dot diff=astextplain 18 | *.DOT diff=astextplain 19 | *.pdf diff=astextplain 20 | *.PDF diff=astextplain 21 | *.rtf diff=astextplain 22 | *.RTF diff=astextplain 23 | -------------------------------------------------------------------------------- /Module 1/Chapter03/Camera/CopyToRaspberryPi.bat: -------------------------------------------------------------------------------- 1 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/System.Data.SQLite.dll pi@192.168.0.28: 2 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/MySql.Data.dll pi@192.168.0.28: 3 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Internet.dll pi@192.168.0.28: 4 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.EventLog.dll pi@192.168.0.28: 5 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Data.dll pi@192.168.0.28: 6 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Math.dll pi@192.168.0.28: 7 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Language.dll pi@192.168.0.28: 8 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.RaspberryPi.dll pi@192.168.0.28: 9 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Camera.exe pi@192.168.0.28: -------------------------------------------------------------------------------- /Module 1/Chapter03/Camera/LoginCredentials.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Clayster.Library.Data; 3 | 4 | namespace Camera 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 ().GetEarliestCreatedDeleteOthers (); 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /Module 1/Chapter03/Camera/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | 4 | // Information about this assembly is defined by the following attributes. 5 | // Change them to the values specific to your project. 6 | 7 | [assembly: AssemblyTitle ("Camera")] 8 | [assembly: AssemblyDescription ("Implements a camera, publishing it on the local area network using UPnP.")] 9 | [assembly: AssemblyConfiguration ("")] 10 | [assembly: AssemblyCompany ("Clayster")] 11 | [assembly: AssemblyProduct ("")] 12 | [assembly: AssemblyCopyright ("Peter Waher")] 13 | [assembly: AssemblyTrademark ("Clayster")] 14 | [assembly: AssemblyCulture ("")] 15 | 16 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". 17 | // The form "{Major}.{Minor}.*" will automatically update the build and revision, 18 | // and "{Major}.{Minor}.{Build}.*" will update just the revision. 19 | 20 | [assembly: AssemblyVersion ("1.0.*")] -------------------------------------------------------------------------------- /Module 1/Chapter03/Camera/SessionAuthentication.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Clayster.Library.Internet.HTTP; 3 | 4 | namespace Camera 5 | { 6 | public class SessionAuthentication : HttpServerAuthenticationMethod 7 | { 8 | public SessionAuthentication () 9 | { 10 | } 11 | 12 | public override string Challenge 13 | { 14 | get 15 | { 16 | return string.Empty; 17 | } 18 | } 19 | 20 | public override object Authorize (HttpHeader Header, HttpServer.Method Method, IHttpServerResource Resource, System.Net.EndPoint RemoteEndPoint, out string UserName, out UnauthorizedReason Reason) 21 | { 22 | string SessionId = Header.GetCookie ("SessionId"); 23 | 24 | if (MainClass.CheckSession (SessionId, out UserName)) 25 | { 26 | Reason = UnauthorizedReason.NoError; 27 | return UserName; 28 | } else 29 | { 30 | Reason = UnauthorizedReason.OldCredentialsTryAgain; 31 | return null; 32 | } 33 | } 34 | 35 | } 36 | } 37 | 38 | -------------------------------------------------------------------------------- /Module 1/Chapter03/Camera/UPnP/128x128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter03/Camera/UPnP/128x128.png -------------------------------------------------------------------------------- /Module 1/Chapter03/Camera/UPnP/16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter03/Camera/UPnP/16x16.png -------------------------------------------------------------------------------- /Module 1/Chapter03/Camera/UPnP/24x24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter03/Camera/UPnP/24x24.png -------------------------------------------------------------------------------- /Module 1/Chapter03/Camera/UPnP/256x256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter03/Camera/UPnP/256x256.png -------------------------------------------------------------------------------- /Module 1/Chapter03/Camera/UPnP/32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter03/Camera/UPnP/32x32.png -------------------------------------------------------------------------------- /Module 1/Chapter03/Camera/UPnP/48x48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter03/Camera/UPnP/48x48.png -------------------------------------------------------------------------------- /Module 1/Chapter03/Camera/UPnP/64x64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter03/Camera/UPnP/64x64.png -------------------------------------------------------------------------------- /Module 1/Chapter03/Clayster.Library.IoT/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Reflection; 3 | using System.Runtime.CompilerServices; 4 | 5 | // Information about this assembly is defined by the following attributes. 6 | // Change them to the values specific to your project. 7 | 8 | [assembly: AssemblyTitle ("Clayster.Library.IoT")] 9 | [assembly: AssemblyDescription ("Library for Interoperability in Internet of Things")] 10 | [assembly: AssemblyConfiguration ("")] 11 | [assembly: AssemblyCompany ("Clayster")] 12 | [assembly: AssemblyProduct ("")] 13 | [assembly: AssemblyCopyright ("Peter Waher")] 14 | [assembly: AssemblyTrademark ("Clayster")] 15 | [assembly: AssemblyCulture ("")] 16 | [assembly: CLSCompliant (true)] 17 | 18 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". 19 | // The form "{Major}.{Minor}.*" will automatically update the build and revision, 20 | // and "{Major}.{Minor}.{Build}.*" will update just the revision. 21 | 22 | [assembly: AssemblyVersion ("1.0.*")] 23 | 24 | // The following attributes are used to specify the signing key for the assembly, 25 | // if desired. See the Mono documentation for more information about signing. 26 | 27 | //[assembly: AssemblyDelaySign(false)] 28 | //[assembly: AssemblyKeyFile("")] 29 | 30 | -------------------------------------------------------------------------------- /Module 1/Chapter03/Clayster.Library.IoT/SensorData/Field.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter03/Clayster.Library.IoT/SensorData/Field.cs -------------------------------------------------------------------------------- /Module 1/Chapter03/Clayster.Library.IoT/SensorData/FieldBoolean.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter03/Clayster.Library.IoT/SensorData/FieldBoolean.cs -------------------------------------------------------------------------------- /Module 1/Chapter03/Clayster.Library.IoT/SensorData/FieldDateTime.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter03/Clayster.Library.IoT/SensorData/FieldDateTime.cs -------------------------------------------------------------------------------- /Module 1/Chapter03/Clayster.Library.IoT/SensorData/FieldEnum.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter03/Clayster.Library.IoT/SensorData/FieldEnum.cs -------------------------------------------------------------------------------- /Module 1/Chapter03/Clayster.Library.IoT/SensorData/FieldNumeric.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter03/Clayster.Library.IoT/SensorData/FieldNumeric.cs -------------------------------------------------------------------------------- /Module 1/Chapter03/Clayster.Library.IoT/SensorData/FieldStatus.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Clayster.Library.IoT.SensorData 4 | { 5 | /// 6 | /// Status of the value. 7 | /// 8 | [Flags] 9 | [CLSCompliant(true)] 10 | public enum FieldStatus 11 | { 12 | /// 13 | /// The corresponding value is missing. 14 | /// 15 | Missing = 1, 16 | 17 | /// 18 | /// The value is an automatic estimate 19 | /// 20 | AutomaticEstimate = 2, 21 | 22 | /// 23 | /// The value is a manual estimate 24 | /// 25 | ManualEstimate = 4, 26 | 27 | /// 28 | /// The value is a manually read value. 29 | /// 30 | ManualReadout = 8, 31 | 32 | /// 33 | /// The value is an automatically read value. 34 | /// 35 | AutomaticReadout = 16, 36 | 37 | /// 38 | /// Time in meter differs from time on server. 39 | /// 40 | TimeOffset = 32, 41 | 42 | /// 43 | /// Value flagged with a warning. 44 | /// 45 | Warning = 64, 46 | 47 | /// 48 | /// Value flagged with an error. 49 | /// 50 | Error = 128, 51 | 52 | /// 53 | /// Value has been signed and approved. 54 | /// 55 | Signed = 256, 56 | 57 | /// 58 | /// Value has been invoiced. 59 | /// 60 | Invoiced = 512, 61 | 62 | /// 63 | /// Value is the last of a series of values. The next value comprises the 64 | /// start of a new series. 65 | /// 66 | EndOfSeries = 1024, 67 | 68 | /// 69 | /// Power failure has occurred in the corresponding period. 70 | /// 71 | PowerFailure = 2048, 72 | 73 | /// 74 | /// Value has been invoiced and confirmed by receiver of invoice. 75 | /// 76 | InvoicedConfirmed = 4096 77 | } 78 | } 79 | 80 | -------------------------------------------------------------------------------- /Module 1/Chapter03/Clayster.Library.IoT/SensorData/FieldString.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter03/Clayster.Library.IoT/SensorData/FieldString.cs -------------------------------------------------------------------------------- /Module 1/Chapter03/Clayster.Library.IoT/SensorData/FieldTimeSpan.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter03/Clayster.Library.IoT/SensorData/FieldTimeSpan.cs -------------------------------------------------------------------------------- /Module 1/Chapter03/Clayster.Library.RaspberryPi/MyClass.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Clayster.Library.RaspberryPi 4 | { 5 | public class MyClass 6 | { 7 | public MyClass () 8 | { 9 | } 10 | } 11 | } 12 | 13 | -------------------------------------------------------------------------------- /Module 1/Chapter03/Clayster.Library.RaspberryPi/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | 4 | // Information about this assembly is defined by the following attributes. 5 | // Change them to the values specific to your project. 6 | 7 | [assembly: AssemblyTitle ("Clayster.Library.RaspberryPi")] 8 | [assembly: AssemblyDescription ("Hardware abstraction layer for the RaspberryPi.")] 9 | [assembly: AssemblyConfiguration ("")] 10 | [assembly: AssemblyCompany ("Clayster")] 11 | [assembly: AssemblyProduct ("")] 12 | [assembly: AssemblyCopyright ("Peter Waher")] 13 | [assembly: AssemblyTrademark ("Clayster")] 14 | [assembly: AssemblyCulture ("")] 15 | 16 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". 17 | // The form "{Major}.{Minor}.*" will automatically update the build and revision, 18 | // and "{Major}.{Minor}.{Build}.*" will update just the revision. 19 | 20 | [assembly: AssemblyVersion ("1.0.*")] 21 | 22 | // The following attributes are used to specify the signing key for the assembly, 23 | // if desired. See the Mono documentation for more information about signing. 24 | 25 | //[assembly: AssemblyDelaySign(false)] 26 | //[assembly: AssemblyKeyFile("")] 27 | 28 | -------------------------------------------------------------------------------- /Module 1/Chapter03/Clayster/Clayster.Library.Data.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter03/Clayster/Clayster.Library.Data.dll -------------------------------------------------------------------------------- /Module 1/Chapter03/Clayster/Clayster.Library.EventLog.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter03/Clayster/Clayster.Library.EventLog.dll -------------------------------------------------------------------------------- /Module 1/Chapter03/Clayster/Clayster.Library.Internet.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter03/Clayster/Clayster.Library.Internet.dll -------------------------------------------------------------------------------- /Module 1/Chapter03/Clayster/Clayster.Library.Language.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter03/Clayster/Clayster.Library.Language.dll -------------------------------------------------------------------------------- /Module 1/Chapter03/Clayster/Clayster.Library.Math.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter03/Clayster/Clayster.Library.Math.dll -------------------------------------------------------------------------------- /Module 1/Chapter03/Clayster/MySql.Data.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter03/Clayster/MySql.Data.dll -------------------------------------------------------------------------------- /Module 1/Chapter03/Clayster/System.Data.SQLite.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter03/Clayster/System.Data.SQLite.dll -------------------------------------------------------------------------------- /Module 1/Chapter03/Controller/CopyToRaspberryPi.bat: -------------------------------------------------------------------------------- 1 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/System.Data.SQLite.dll pi@192.168.0.26: 2 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/MySql.Data.dll pi@192.168.0.26: 3 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Internet.dll pi@192.168.0.26: 4 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.EventLog.dll pi@192.168.0.26: 5 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Data.dll pi@192.168.0.26: 6 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Math.dll pi@192.168.0.26: 7 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Language.dll pi@192.168.0.26: 8 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.IoT.dll pi@192.168.0.26: 9 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Controller.exe pi@192.168.0.26: 10 | -------------------------------------------------------------------------------- /Module 1/Chapter03/Controller/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | 4 | // Information about this assembly is defined by the following attributes. 5 | // Change them to the values specific to your project. 6 | 7 | [assembly: AssemblyTitle ("Controller")] 8 | [assembly: AssemblyDescription ("Implements a controller, controlling an actuator based on values read from a sensor.")] 9 | [assembly: AssemblyConfiguration ("")] 10 | [assembly: AssemblyCompany ("Clayster")] 11 | [assembly: AssemblyProduct ("")] 12 | [assembly: AssemblyCopyright ("Peter Waher")] 13 | [assembly: AssemblyTrademark ("Clayster")] 14 | [assembly: AssemblyCulture ("")] 15 | 16 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". 17 | // The form "{Major}.{Minor}.*" will automatically update the build and revision, 18 | // and "{Major}.{Minor}.{Build}.*" will update just the revision. 19 | 20 | [assembly: AssemblyVersion ("1.0.*")] 21 | 22 | // The following attributes are used to specify the signing key for the assembly, 23 | // if desired. See the Mono documentation for more information about signing. 24 | 25 | //[assembly: AssemblyDelaySign(false)] 26 | //[assembly: AssemblyKeyFile("")] 27 | 28 | -------------------------------------------------------------------------------- /Module 1/Chapter03/Controller/Subscription.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Clayster.Library.Internet.UPnP; 3 | 4 | namespace Controller 5 | { 6 | public class Subscription 7 | { 8 | private string sid; 9 | private string udn; 10 | private string localIp; 11 | private IUPnPService service; 12 | 13 | public Subscription (string Udn, string Sid, IUPnPService Service, string LocalIp) 14 | { 15 | this.sid = Sid; 16 | this.udn = Udn; 17 | this.service = Service; 18 | this.localIp = LocalIp; 19 | } 20 | 21 | public string UDN 22 | { 23 | get{return this.udn;} 24 | } 25 | 26 | public string SID 27 | { 28 | get{return this.sid;} 29 | } 30 | 31 | public IUPnPService Service 32 | { 33 | get{return this.service;} 34 | } 35 | 36 | public string LocalIp 37 | { 38 | get{return this.localIp;} 39 | } 40 | 41 | } 42 | } 43 | 44 | -------------------------------------------------------------------------------- /Module 1/Chapter04/.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | *.sln merge=union 7 | *.csproj merge=union 8 | *.vbproj merge=union 9 | *.fsproj merge=union 10 | *.dbproj merge=union 11 | 12 | # Standard to msysgit 13 | *.doc diff=astextplain 14 | *.DOC diff=astextplain 15 | *.docx diff=astextplain 16 | *.DOCX diff=astextplain 17 | *.dot diff=astextplain 18 | *.DOT diff=astextplain 19 | *.pdf diff=astextplain 20 | *.PDF diff=astextplain 21 | *.rtf diff=astextplain 22 | *.RTF diff=astextplain 23 | -------------------------------------------------------------------------------- /Module 1/Chapter04/Actuator/CopyToRaspberryPi.bat: -------------------------------------------------------------------------------- 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: 11 | -------------------------------------------------------------------------------- /Module 1/Chapter04/Actuator/LoginCredentials.cs: -------------------------------------------------------------------------------- 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 ().GetEarliestCreatedDeleteOthers (); 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /Module 1/Chapter04/Actuator/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | 4 | // Information about this assembly is defined by the following attributes. 5 | // Change them to the values specific to your project. 6 | 7 | [assembly: AssemblyTitle ("Actuator")] 8 | [assembly: AssemblyDescription ("Implements an actuator, with digital and PWM output.")] 9 | [assembly: AssemblyConfiguration ("")] 10 | [assembly: AssemblyCompany ("Clayster")] 11 | [assembly: AssemblyProduct ("")] 12 | [assembly: AssemblyCopyright ("Peter Waher")] 13 | [assembly: AssemblyTrademark ("Clayster")] 14 | [assembly: AssemblyCulture ("")] 15 | 16 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". 17 | // The form "{Major}.{Minor}.*" will automatically update the build and revision, 18 | // and "{Major}.{Minor}.{Build}.*" will update just the revision. 19 | 20 | [assembly: AssemblyVersion ("1.0.*")] 21 | 22 | // The following attributes are used to specify the signing key for the assembly, 23 | // if desired. See the Mono documentation for more information about signing. 24 | 25 | //[assembly: AssemblyDelaySign(false)] 26 | //[assembly: AssemblyKeyFile("")] 27 | 28 | -------------------------------------------------------------------------------- /Module 1/Chapter04/Actuator/SessionAuthentication.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Clayster.Library.Internet.HTTP; 3 | 4 | namespace Actuator 5 | { 6 | public class SessionAuthentication : HttpServerAuthenticationMethod 7 | { 8 | public SessionAuthentication () 9 | { 10 | } 11 | 12 | public override string Challenge 13 | { 14 | get 15 | { 16 | return string.Empty; 17 | } 18 | } 19 | 20 | public override object Authorize (HttpHeader Header, HttpServer.Method Method, IHttpServerResource Resource, System.Net.EndPoint RemoteEndPoint, out string UserName, out UnauthorizedReason Reason) 21 | { 22 | string SessionId = Header.GetCookie ("SessionId"); 23 | 24 | if (MainClass.CheckSession (SessionId, out UserName)) 25 | { 26 | Reason = UnauthorizedReason.NoError; 27 | return UserName; 28 | } else 29 | { 30 | Reason = UnauthorizedReason.OldCredentialsTryAgain; 31 | return null; 32 | } 33 | } 34 | 35 | } 36 | } 37 | 38 | -------------------------------------------------------------------------------- /Module 1/Chapter04/Camera/CopyToRaspberryPi.bat: -------------------------------------------------------------------------------- 1 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/System.Data.SQLite.dll pi@192.168.0.28: 2 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/MySql.Data.dll pi@192.168.0.28: 3 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Internet.dll pi@192.168.0.28: 4 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.EventLog.dll pi@192.168.0.28: 5 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Data.dll pi@192.168.0.28: 6 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Math.dll pi@192.168.0.28: 7 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Language.dll pi@192.168.0.28: 8 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.RaspberryPi.dll pi@192.168.0.28: 9 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Camera.exe pi@192.168.0.28: -------------------------------------------------------------------------------- /Module 1/Chapter04/Camera/LoginCredentials.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Clayster.Library.Data; 3 | 4 | namespace Camera 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 ().GetEarliestCreatedDeleteOthers (); 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /Module 1/Chapter04/Camera/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | 4 | // Information about this assembly is defined by the following attributes. 5 | // Change them to the values specific to your project. 6 | 7 | [assembly: AssemblyTitle ("Camera")] 8 | [assembly: AssemblyDescription ("Implements a camera, publishing it on the local area network using UPnP.")] 9 | [assembly: AssemblyConfiguration ("")] 10 | [assembly: AssemblyCompany ("Clayster")] 11 | [assembly: AssemblyProduct ("")] 12 | [assembly: AssemblyCopyright ("Peter Waher")] 13 | [assembly: AssemblyTrademark ("Clayster")] 14 | [assembly: AssemblyCulture ("")] 15 | 16 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". 17 | // The form "{Major}.{Minor}.*" will automatically update the build and revision, 18 | // and "{Major}.{Minor}.{Build}.*" will update just the revision. 19 | 20 | [assembly: AssemblyVersion ("1.0.*")] -------------------------------------------------------------------------------- /Module 1/Chapter04/Camera/SessionAuthentication.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Clayster.Library.Internet.HTTP; 3 | 4 | namespace Camera 5 | { 6 | public class SessionAuthentication : HttpServerAuthenticationMethod 7 | { 8 | public SessionAuthentication () 9 | { 10 | } 11 | 12 | public override string Challenge 13 | { 14 | get 15 | { 16 | return string.Empty; 17 | } 18 | } 19 | 20 | public override object Authorize (HttpHeader Header, HttpServer.Method Method, IHttpServerResource Resource, System.Net.EndPoint RemoteEndPoint, out string UserName, out UnauthorizedReason Reason) 21 | { 22 | string SessionId = Header.GetCookie ("SessionId"); 23 | 24 | if (MainClass.CheckSession (SessionId, out UserName)) 25 | { 26 | Reason = UnauthorizedReason.NoError; 27 | return UserName; 28 | } else 29 | { 30 | Reason = UnauthorizedReason.OldCredentialsTryAgain; 31 | return null; 32 | } 33 | } 34 | 35 | } 36 | } 37 | 38 | -------------------------------------------------------------------------------- /Module 1/Chapter04/Camera/UPnP/128x128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter04/Camera/UPnP/128x128.png -------------------------------------------------------------------------------- /Module 1/Chapter04/Camera/UPnP/16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter04/Camera/UPnP/16x16.png -------------------------------------------------------------------------------- /Module 1/Chapter04/Camera/UPnP/24x24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter04/Camera/UPnP/24x24.png -------------------------------------------------------------------------------- /Module 1/Chapter04/Camera/UPnP/256x256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter04/Camera/UPnP/256x256.png -------------------------------------------------------------------------------- /Module 1/Chapter04/Camera/UPnP/32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter04/Camera/UPnP/32x32.png -------------------------------------------------------------------------------- /Module 1/Chapter04/Camera/UPnP/48x48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter04/Camera/UPnP/48x48.png -------------------------------------------------------------------------------- /Module 1/Chapter04/Camera/UPnP/64x64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter04/Camera/UPnP/64x64.png -------------------------------------------------------------------------------- /Module 1/Chapter04/Clayster.Library.IoT/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Reflection; 3 | using System.Runtime.CompilerServices; 4 | 5 | // Information about this assembly is defined by the following attributes. 6 | // Change them to the values specific to your project. 7 | 8 | [assembly: AssemblyTitle ("Clayster.Library.IoT")] 9 | [assembly: AssemblyDescription ("Library for Interoperability in Internet of Things")] 10 | [assembly: AssemblyConfiguration ("")] 11 | [assembly: AssemblyCompany ("Clayster")] 12 | [assembly: AssemblyProduct ("")] 13 | [assembly: AssemblyCopyright ("Peter Waher")] 14 | [assembly: AssemblyTrademark ("Clayster")] 15 | [assembly: AssemblyCulture ("")] 16 | [assembly: CLSCompliant (true)] 17 | 18 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". 19 | // The form "{Major}.{Minor}.*" will automatically update the build and revision, 20 | // and "{Major}.{Minor}.{Build}.*" will update just the revision. 21 | 22 | [assembly: AssemblyVersion ("1.0.*")] 23 | 24 | // The following attributes are used to specify the signing key for the assembly, 25 | // if desired. See the Mono documentation for more information about signing. 26 | 27 | //[assembly: AssemblyDelaySign(false)] 28 | //[assembly: AssemblyKeyFile("")] 29 | 30 | -------------------------------------------------------------------------------- /Module 1/Chapter04/Clayster.Library.IoT/SensorData/Field.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter04/Clayster.Library.IoT/SensorData/Field.cs -------------------------------------------------------------------------------- /Module 1/Chapter04/Clayster.Library.IoT/SensorData/FieldBoolean.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter04/Clayster.Library.IoT/SensorData/FieldBoolean.cs -------------------------------------------------------------------------------- /Module 1/Chapter04/Clayster.Library.IoT/SensorData/FieldDateTime.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter04/Clayster.Library.IoT/SensorData/FieldDateTime.cs -------------------------------------------------------------------------------- /Module 1/Chapter04/Clayster.Library.IoT/SensorData/FieldEnum.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter04/Clayster.Library.IoT/SensorData/FieldEnum.cs -------------------------------------------------------------------------------- /Module 1/Chapter04/Clayster.Library.IoT/SensorData/FieldNumeric.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter04/Clayster.Library.IoT/SensorData/FieldNumeric.cs -------------------------------------------------------------------------------- /Module 1/Chapter04/Clayster.Library.IoT/SensorData/FieldStatus.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Clayster.Library.IoT.SensorData 4 | { 5 | /// 6 | /// Status of the value. 7 | /// 8 | [Flags] 9 | [CLSCompliant(true)] 10 | public enum FieldStatus 11 | { 12 | /// 13 | /// The corresponding value is missing. 14 | /// 15 | Missing = 1, 16 | 17 | /// 18 | /// The value is an automatic estimate 19 | /// 20 | AutomaticEstimate = 2, 21 | 22 | /// 23 | /// The value is a manual estimate 24 | /// 25 | ManualEstimate = 4, 26 | 27 | /// 28 | /// The value is a manually read value. 29 | /// 30 | ManualReadout = 8, 31 | 32 | /// 33 | /// The value is an automatically read value. 34 | /// 35 | AutomaticReadout = 16, 36 | 37 | /// 38 | /// Time in meter differs from time on server. 39 | /// 40 | TimeOffset = 32, 41 | 42 | /// 43 | /// Value flagged with a warning. 44 | /// 45 | Warning = 64, 46 | 47 | /// 48 | /// Value flagged with an error. 49 | /// 50 | Error = 128, 51 | 52 | /// 53 | /// Value has been signed and approved. 54 | /// 55 | Signed = 256, 56 | 57 | /// 58 | /// Value has been invoiced. 59 | /// 60 | Invoiced = 512, 61 | 62 | /// 63 | /// Value is the last of a series of values. The next value comprises the 64 | /// start of a new series. 65 | /// 66 | EndOfSeries = 1024, 67 | 68 | /// 69 | /// Power failure has occurred in the corresponding period. 70 | /// 71 | PowerFailure = 2048, 72 | 73 | /// 74 | /// Value has been invoiced and confirmed by receiver of invoice. 75 | /// 76 | InvoicedConfirmed = 4096 77 | } 78 | } 79 | 80 | -------------------------------------------------------------------------------- /Module 1/Chapter04/Clayster.Library.IoT/SensorData/FieldString.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter04/Clayster.Library.IoT/SensorData/FieldString.cs -------------------------------------------------------------------------------- /Module 1/Chapter04/Clayster.Library.IoT/SensorData/FieldTimeSpan.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter04/Clayster.Library.IoT/SensorData/FieldTimeSpan.cs -------------------------------------------------------------------------------- /Module 1/Chapter04/Clayster.Library.RaspberryPi/MyClass.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Clayster.Library.RaspberryPi 4 | { 5 | public class MyClass 6 | { 7 | public MyClass () 8 | { 9 | } 10 | } 11 | } 12 | 13 | -------------------------------------------------------------------------------- /Module 1/Chapter04/Clayster.Library.RaspberryPi/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | 4 | // Information about this assembly is defined by the following attributes. 5 | // Change them to the values specific to your project. 6 | 7 | [assembly: AssemblyTitle ("Clayster.Library.RaspberryPi")] 8 | [assembly: AssemblyDescription ("Hardware abstraction layer for the RaspberryPi.")] 9 | [assembly: AssemblyConfiguration ("")] 10 | [assembly: AssemblyCompany ("Clayster")] 11 | [assembly: AssemblyProduct ("")] 12 | [assembly: AssemblyCopyright ("Peter Waher")] 13 | [assembly: AssemblyTrademark ("Clayster")] 14 | [assembly: AssemblyCulture ("")] 15 | 16 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". 17 | // The form "{Major}.{Minor}.*" will automatically update the build and revision, 18 | // and "{Major}.{Minor}.{Build}.*" will update just the revision. 19 | 20 | [assembly: AssemblyVersion ("1.0.*")] 21 | 22 | // The following attributes are used to specify the signing key for the assembly, 23 | // if desired. See the Mono documentation for more information about signing. 24 | 25 | //[assembly: AssemblyDelaySign(false)] 26 | //[assembly: AssemblyKeyFile("")] 27 | 28 | -------------------------------------------------------------------------------- /Module 1/Chapter04/Clayster/Clayster.Library.Data.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter04/Clayster/Clayster.Library.Data.dll -------------------------------------------------------------------------------- /Module 1/Chapter04/Clayster/Clayster.Library.EventLog.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter04/Clayster/Clayster.Library.EventLog.dll -------------------------------------------------------------------------------- /Module 1/Chapter04/Clayster/Clayster.Library.Internet.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter04/Clayster/Clayster.Library.Internet.dll -------------------------------------------------------------------------------- /Module 1/Chapter04/Clayster/Clayster.Library.Language.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter04/Clayster/Clayster.Library.Language.dll -------------------------------------------------------------------------------- /Module 1/Chapter04/Clayster/Clayster.Library.Math.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter04/Clayster/Clayster.Library.Math.dll -------------------------------------------------------------------------------- /Module 1/Chapter04/Clayster/MySql.Data.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter04/Clayster/MySql.Data.dll -------------------------------------------------------------------------------- /Module 1/Chapter04/Clayster/System.Data.SQLite.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter04/Clayster/System.Data.SQLite.dll -------------------------------------------------------------------------------- /Module 1/Chapter04/Controller/CopyToRaspberryPi.bat: -------------------------------------------------------------------------------- 1 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/System.Data.SQLite.dll pi@192.168.0.14: 2 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/MySql.Data.dll pi@192.168.0.14: 3 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Internet.dll pi@192.168.0.14: 4 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.EventLog.dll pi@192.168.0.14: 5 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Data.dll pi@192.168.0.14: 6 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Math.dll pi@192.168.0.14: 7 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Language.dll pi@192.168.0.14: 8 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.IoT.dll pi@192.168.0.14: 9 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Controller.exe pi@192.168.0.14: 10 | -------------------------------------------------------------------------------- /Module 1/Chapter04/Controller/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | 4 | // Information about this assembly is defined by the following attributes. 5 | // Change them to the values specific to your project. 6 | 7 | [assembly: AssemblyTitle ("Controller")] 8 | [assembly: AssemblyDescription ("Implements a controller, controlling an actuator based on values read from a sensor.")] 9 | [assembly: AssemblyConfiguration ("")] 10 | [assembly: AssemblyCompany ("Clayster")] 11 | [assembly: AssemblyProduct ("")] 12 | [assembly: AssemblyCopyright ("Peter Waher")] 13 | [assembly: AssemblyTrademark ("Clayster")] 14 | [assembly: AssemblyCulture ("")] 15 | 16 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". 17 | // The form "{Major}.{Minor}.*" will automatically update the build and revision, 18 | // and "{Major}.{Minor}.{Build}.*" will update just the revision. 19 | 20 | [assembly: AssemblyVersion ("1.0.*")] 21 | 22 | // The following attributes are used to specify the signing key for the assembly, 23 | // if desired. See the Mono documentation for more information about signing. 24 | 25 | //[assembly: AssemblyDelaySign(false)] 26 | //[assembly: AssemblyKeyFile("")] 27 | 28 | -------------------------------------------------------------------------------- /Module 1/Chapter04/Controller/Subscription.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Clayster.Library.Internet.UPnP; 3 | 4 | namespace Controller 5 | { 6 | public class Subscription 7 | { 8 | private string sid; 9 | private string udn; 10 | private string localIp; 11 | private IUPnPService service; 12 | 13 | public Subscription (string Udn, string Sid, IUPnPService Service, string LocalIp) 14 | { 15 | this.sid = Sid; 16 | this.udn = Udn; 17 | this.service = Service; 18 | this.localIp = LocalIp; 19 | } 20 | 21 | public string UDN 22 | { 23 | get{return this.udn;} 24 | } 25 | 26 | public string SID 27 | { 28 | get{return this.sid;} 29 | } 30 | 31 | public IUPnPService Service 32 | { 33 | get{return this.service;} 34 | } 35 | 36 | public string LocalIp 37 | { 38 | get{return this.localIp;} 39 | } 40 | 41 | } 42 | } 43 | 44 | -------------------------------------------------------------------------------- /Module 1/Chapter04/Sensor/CopyToRaspberryPi.bat: -------------------------------------------------------------------------------- 1 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/System.Data.SQLite.dll pi@192.168.0.15: 2 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/MySql.Data.dll pi@192.168.0.15: 3 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Internet.dll pi@192.168.0.15: 4 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.EventLog.dll pi@192.168.0.15: 5 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Data.dll pi@192.168.0.15: 6 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Math.dll pi@192.168.0.15: 7 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Language.dll pi@192.168.0.15: 8 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.RaspberryPi.dll pi@192.168.0.15: 9 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.IoT.dll pi@192.168.0.15: 10 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Sensor.exe pi@192.168.0.15: 11 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Certificate.pfx pi@192.168.0.15: 12 | -------------------------------------------------------------------------------- /Module 1/Chapter04/Sensor/LoginCredentials.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Clayster.Library.Data; 3 | 4 | namespace Sensor 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 ().GetEarliestCreatedDeleteOthers (); 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /Module 1/Chapter04/Sensor/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | 4 | // Information about this assembly is defined by the following attributes. 5 | // Change them to the values specific to your project. 6 | 7 | [assembly: AssemblyTitle ("Sensor")] 8 | [assembly: AssemblyDescription ("Implements a sensor, sensing Temperature, Light and Movement.")] 9 | [assembly: AssemblyConfiguration ("")] 10 | [assembly: AssemblyCompany ("Clayster")] 11 | [assembly: AssemblyProduct ("")] 12 | [assembly: AssemblyCopyright ("Peter Waher")] 13 | [assembly: AssemblyTrademark ("Clayster")] 14 | [assembly: AssemblyCulture ("")] 15 | 16 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". 17 | // The form "{Major}.{Minor}.*" will automatically update the build and revision, 18 | // and "{Major}.{Minor}.{Build}.*" will update just the revision. 19 | 20 | [assembly: AssemblyVersion ("1.0.*")] 21 | 22 | // The following attributes are used to specify the signing key for the assembly, 23 | // if desired. See the Mono documentation for more information about signing. 24 | 25 | //[assembly: AssemblyDelaySign(false)] 26 | //[assembly: AssemblyKeyFile("")] 27 | 28 | -------------------------------------------------------------------------------- /Module 1/Chapter04/Sensor/SessionAuthentication.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Clayster.Library.Internet.HTTP; 3 | 4 | namespace Sensor 5 | { 6 | public class SessionAuthentication : HttpServerAuthenticationMethod 7 | { 8 | public SessionAuthentication () 9 | { 10 | } 11 | 12 | public override string Challenge 13 | { 14 | get 15 | { 16 | return string.Empty; 17 | } 18 | } 19 | 20 | public override object Authorize (HttpHeader Header, HttpServer.Method Method, IHttpServerResource Resource, System.Net.EndPoint RemoteEndPoint, out string UserName, out UnauthorizedReason Reason) 21 | { 22 | string SessionId = Header.GetCookie ("SessionId"); 23 | 24 | if (MainClass.CheckSession (SessionId, out UserName)) 25 | { 26 | Reason = UnauthorizedReason.NoError; 27 | return UserName; 28 | } else 29 | { 30 | Reason = UnauthorizedReason.OldCredentialsTryAgain; 31 | return null; 32 | } 33 | } 34 | 35 | } 36 | } 37 | 38 | -------------------------------------------------------------------------------- /Module 1/Chapter05/.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | *.sln merge=union 7 | *.csproj merge=union 8 | *.vbproj merge=union 9 | *.fsproj merge=union 10 | *.dbproj merge=union 11 | 12 | # Standard to msysgit 13 | *.doc diff=astextplain 14 | *.DOC diff=astextplain 15 | *.docx diff=astextplain 16 | *.DOCX diff=astextplain 17 | *.dot diff=astextplain 18 | *.DOT diff=astextplain 19 | *.pdf diff=astextplain 20 | *.PDF diff=astextplain 21 | *.rtf diff=astextplain 22 | *.RTF diff=astextplain 23 | -------------------------------------------------------------------------------- /Module 1/Chapter05/Actuator/CopyToRaspberryPi.bat: -------------------------------------------------------------------------------- 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: 11 | -------------------------------------------------------------------------------- /Module 1/Chapter05/Actuator/LoginCredentials.cs: -------------------------------------------------------------------------------- 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 ().GetEarliestCreatedDeleteOthers (); 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /Module 1/Chapter05/Actuator/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | 4 | // Information about this assembly is defined by the following attributes. 5 | // Change them to the values specific to your project. 6 | 7 | [assembly: AssemblyTitle ("Actuator")] 8 | [assembly: AssemblyDescription ("Implements an actuator, with digital and PWM output.")] 9 | [assembly: AssemblyConfiguration ("")] 10 | [assembly: AssemblyCompany ("Clayster")] 11 | [assembly: AssemblyProduct ("")] 12 | [assembly: AssemblyCopyright ("Peter Waher")] 13 | [assembly: AssemblyTrademark ("Clayster")] 14 | [assembly: AssemblyCulture ("")] 15 | 16 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". 17 | // The form "{Major}.{Minor}.*" will automatically update the build and revision, 18 | // and "{Major}.{Minor}.{Build}.*" will update just the revision. 19 | 20 | [assembly: AssemblyVersion ("1.0.*")] 21 | 22 | // The following attributes are used to specify the signing key for the assembly, 23 | // if desired. See the Mono documentation for more information about signing. 24 | 25 | //[assembly: AssemblyDelaySign(false)] 26 | //[assembly: AssemblyKeyFile("")] 27 | 28 | -------------------------------------------------------------------------------- /Module 1/Chapter05/Actuator/SessionAuthentication.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Clayster.Library.Internet.HTTP; 3 | 4 | namespace Actuator 5 | { 6 | public class SessionAuthentication : HttpServerAuthenticationMethod 7 | { 8 | public SessionAuthentication () 9 | { 10 | } 11 | 12 | public override string Challenge 13 | { 14 | get 15 | { 16 | return string.Empty; 17 | } 18 | } 19 | 20 | public override object Authorize (HttpHeader Header, HttpServer.Method Method, IHttpServerResource Resource, System.Net.EndPoint RemoteEndPoint, out string UserName, out UnauthorizedReason Reason) 21 | { 22 | string SessionId = Header.GetCookie ("SessionId"); 23 | 24 | if (MainClass.CheckSession (SessionId, out UserName)) 25 | { 26 | Reason = UnauthorizedReason.NoError; 27 | return UserName; 28 | } else 29 | { 30 | Reason = UnauthorizedReason.OldCredentialsTryAgain; 31 | return null; 32 | } 33 | } 34 | 35 | } 36 | } 37 | 38 | -------------------------------------------------------------------------------- /Module 1/Chapter05/Camera/CopyToRaspberryPi.bat: -------------------------------------------------------------------------------- 1 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/System.Data.SQLite.dll pi@192.168.0.28: 2 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/MySql.Data.dll pi@192.168.0.28: 3 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Internet.dll pi@192.168.0.28: 4 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.EventLog.dll pi@192.168.0.28: 5 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Data.dll pi@192.168.0.28: 6 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Math.dll pi@192.168.0.28: 7 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Language.dll pi@192.168.0.28: 8 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.RaspberryPi.dll pi@192.168.0.28: 9 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Camera.exe pi@192.168.0.28: -------------------------------------------------------------------------------- /Module 1/Chapter05/Camera/LoginCredentials.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Clayster.Library.Data; 3 | 4 | namespace Camera 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 ().GetEarliestCreatedDeleteOthers (); 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /Module 1/Chapter05/Camera/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | 4 | // Information about this assembly is defined by the following attributes. 5 | // Change them to the values specific to your project. 6 | 7 | [assembly: AssemblyTitle ("Camera")] 8 | [assembly: AssemblyDescription ("Implements a camera, publishing it on the local area network using UPnP.")] 9 | [assembly: AssemblyConfiguration ("")] 10 | [assembly: AssemblyCompany ("Clayster")] 11 | [assembly: AssemblyProduct ("")] 12 | [assembly: AssemblyCopyright ("Peter Waher")] 13 | [assembly: AssemblyTrademark ("Clayster")] 14 | [assembly: AssemblyCulture ("")] 15 | 16 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". 17 | // The form "{Major}.{Minor}.*" will automatically update the build and revision, 18 | // and "{Major}.{Minor}.{Build}.*" will update just the revision. 19 | 20 | [assembly: AssemblyVersion ("1.0.*")] -------------------------------------------------------------------------------- /Module 1/Chapter05/Camera/SessionAuthentication.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Clayster.Library.Internet.HTTP; 3 | 4 | namespace Camera 5 | { 6 | public class SessionAuthentication : HttpServerAuthenticationMethod 7 | { 8 | public SessionAuthentication () 9 | { 10 | } 11 | 12 | public override string Challenge 13 | { 14 | get 15 | { 16 | return string.Empty; 17 | } 18 | } 19 | 20 | public override object Authorize (HttpHeader Header, HttpServer.Method Method, IHttpServerResource Resource, System.Net.EndPoint RemoteEndPoint, out string UserName, out UnauthorizedReason Reason) 21 | { 22 | string SessionId = Header.GetCookie ("SessionId"); 23 | 24 | if (MainClass.CheckSession (SessionId, out UserName)) 25 | { 26 | Reason = UnauthorizedReason.NoError; 27 | return UserName; 28 | } else 29 | { 30 | Reason = UnauthorizedReason.OldCredentialsTryAgain; 31 | return null; 32 | } 33 | } 34 | 35 | } 36 | } 37 | 38 | -------------------------------------------------------------------------------- /Module 1/Chapter05/Camera/UPnP/128x128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter05/Camera/UPnP/128x128.png -------------------------------------------------------------------------------- /Module 1/Chapter05/Camera/UPnP/16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter05/Camera/UPnP/16x16.png -------------------------------------------------------------------------------- /Module 1/Chapter05/Camera/UPnP/24x24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter05/Camera/UPnP/24x24.png -------------------------------------------------------------------------------- /Module 1/Chapter05/Camera/UPnP/256x256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter05/Camera/UPnP/256x256.png -------------------------------------------------------------------------------- /Module 1/Chapter05/Camera/UPnP/32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter05/Camera/UPnP/32x32.png -------------------------------------------------------------------------------- /Module 1/Chapter05/Camera/UPnP/48x48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter05/Camera/UPnP/48x48.png -------------------------------------------------------------------------------- /Module 1/Chapter05/Camera/UPnP/64x64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter05/Camera/UPnP/64x64.png -------------------------------------------------------------------------------- /Module 1/Chapter05/Clayster.Library.IoT/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Reflection; 3 | using System.Runtime.CompilerServices; 4 | 5 | // Information about this assembly is defined by the following attributes. 6 | // Change them to the values specific to your project. 7 | 8 | [assembly: AssemblyTitle ("Clayster.Library.IoT")] 9 | [assembly: AssemblyDescription ("Library for Interoperability in Internet of Things")] 10 | [assembly: AssemblyConfiguration ("")] 11 | [assembly: AssemblyCompany ("Clayster")] 12 | [assembly: AssemblyProduct ("")] 13 | [assembly: AssemblyCopyright ("Peter Waher")] 14 | [assembly: AssemblyTrademark ("Clayster")] 15 | [assembly: AssemblyCulture ("")] 16 | [assembly: CLSCompliant (true)] 17 | 18 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". 19 | // The form "{Major}.{Minor}.*" will automatically update the build and revision, 20 | // and "{Major}.{Minor}.{Build}.*" will update just the revision. 21 | 22 | [assembly: AssemblyVersion ("1.0.*")] 23 | 24 | // The following attributes are used to specify the signing key for the assembly, 25 | // if desired. See the Mono documentation for more information about signing. 26 | 27 | //[assembly: AssemblyDelaySign(false)] 28 | //[assembly: AssemblyKeyFile("")] 29 | 30 | -------------------------------------------------------------------------------- /Module 1/Chapter05/Clayster.Library.IoT/SensorData/Field.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter05/Clayster.Library.IoT/SensorData/Field.cs -------------------------------------------------------------------------------- /Module 1/Chapter05/Clayster.Library.IoT/SensorData/FieldBoolean.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter05/Clayster.Library.IoT/SensorData/FieldBoolean.cs -------------------------------------------------------------------------------- /Module 1/Chapter05/Clayster.Library.IoT/SensorData/FieldDateTime.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter05/Clayster.Library.IoT/SensorData/FieldDateTime.cs -------------------------------------------------------------------------------- /Module 1/Chapter05/Clayster.Library.IoT/SensorData/FieldEnum.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter05/Clayster.Library.IoT/SensorData/FieldEnum.cs -------------------------------------------------------------------------------- /Module 1/Chapter05/Clayster.Library.IoT/SensorData/FieldNumeric.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter05/Clayster.Library.IoT/SensorData/FieldNumeric.cs -------------------------------------------------------------------------------- /Module 1/Chapter05/Clayster.Library.IoT/SensorData/FieldStatus.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Clayster.Library.IoT.SensorData 4 | { 5 | /// 6 | /// Status of the value. 7 | /// 8 | [Flags] 9 | [CLSCompliant(true)] 10 | public enum FieldStatus 11 | { 12 | /// 13 | /// The corresponding value is missing. 14 | /// 15 | Missing = 1, 16 | 17 | /// 18 | /// The value is an automatic estimate 19 | /// 20 | AutomaticEstimate = 2, 21 | 22 | /// 23 | /// The value is a manual estimate 24 | /// 25 | ManualEstimate = 4, 26 | 27 | /// 28 | /// The value is a manually read value. 29 | /// 30 | ManualReadout = 8, 31 | 32 | /// 33 | /// The value is an automatically read value. 34 | /// 35 | AutomaticReadout = 16, 36 | 37 | /// 38 | /// Time in meter differs from time on server. 39 | /// 40 | TimeOffset = 32, 41 | 42 | /// 43 | /// Value flagged with a warning. 44 | /// 45 | Warning = 64, 46 | 47 | /// 48 | /// Value flagged with an error. 49 | /// 50 | Error = 128, 51 | 52 | /// 53 | /// Value has been signed and approved. 54 | /// 55 | Signed = 256, 56 | 57 | /// 58 | /// Value has been invoiced. 59 | /// 60 | Invoiced = 512, 61 | 62 | /// 63 | /// Value is the last of a series of values. The next value comprises the 64 | /// start of a new series. 65 | /// 66 | EndOfSeries = 1024, 67 | 68 | /// 69 | /// Power failure has occurred in the corresponding period. 70 | /// 71 | PowerFailure = 2048, 72 | 73 | /// 74 | /// Value has been invoiced and confirmed by receiver of invoice. 75 | /// 76 | InvoicedConfirmed = 4096 77 | } 78 | } 79 | 80 | -------------------------------------------------------------------------------- /Module 1/Chapter05/Clayster.Library.IoT/SensorData/FieldString.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter05/Clayster.Library.IoT/SensorData/FieldString.cs -------------------------------------------------------------------------------- /Module 1/Chapter05/Clayster.Library.IoT/SensorData/FieldTimeSpan.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter05/Clayster.Library.IoT/SensorData/FieldTimeSpan.cs -------------------------------------------------------------------------------- /Module 1/Chapter05/Clayster.Library.RaspberryPi/MyClass.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Clayster.Library.RaspberryPi 4 | { 5 | public class MyClass 6 | { 7 | public MyClass () 8 | { 9 | } 10 | } 11 | } 12 | 13 | -------------------------------------------------------------------------------- /Module 1/Chapter05/Clayster.Library.RaspberryPi/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | 4 | // Information about this assembly is defined by the following attributes. 5 | // Change them to the values specific to your project. 6 | 7 | [assembly: AssemblyTitle ("Clayster.Library.RaspberryPi")] 8 | [assembly: AssemblyDescription ("Hardware abstraction layer for the RaspberryPi.")] 9 | [assembly: AssemblyConfiguration ("")] 10 | [assembly: AssemblyCompany ("Clayster")] 11 | [assembly: AssemblyProduct ("")] 12 | [assembly: AssemblyCopyright ("Peter Waher")] 13 | [assembly: AssemblyTrademark ("Clayster")] 14 | [assembly: AssemblyCulture ("")] 15 | 16 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". 17 | // The form "{Major}.{Minor}.*" will automatically update the build and revision, 18 | // and "{Major}.{Minor}.{Build}.*" will update just the revision. 19 | 20 | [assembly: AssemblyVersion ("1.0.*")] 21 | 22 | // The following attributes are used to specify the signing key for the assembly, 23 | // if desired. See the Mono documentation for more information about signing. 24 | 25 | //[assembly: AssemblyDelaySign(false)] 26 | //[assembly: AssemblyKeyFile("")] 27 | 28 | -------------------------------------------------------------------------------- /Module 1/Chapter05/Clayster/Clayster.Library.Data.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter05/Clayster/Clayster.Library.Data.dll -------------------------------------------------------------------------------- /Module 1/Chapter05/Clayster/Clayster.Library.EventLog.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter05/Clayster/Clayster.Library.EventLog.dll -------------------------------------------------------------------------------- /Module 1/Chapter05/Clayster/Clayster.Library.Internet.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter05/Clayster/Clayster.Library.Internet.dll -------------------------------------------------------------------------------- /Module 1/Chapter05/Clayster/Clayster.Library.Language.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter05/Clayster/Clayster.Library.Language.dll -------------------------------------------------------------------------------- /Module 1/Chapter05/Clayster/Clayster.Library.Math.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter05/Clayster/Clayster.Library.Math.dll -------------------------------------------------------------------------------- /Module 1/Chapter05/Clayster/MySql.Data.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter05/Clayster/MySql.Data.dll -------------------------------------------------------------------------------- /Module 1/Chapter05/Clayster/System.Data.SQLite.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter05/Clayster/System.Data.SQLite.dll -------------------------------------------------------------------------------- /Module 1/Chapter05/Controller/CopyToRaspberryPi.bat: -------------------------------------------------------------------------------- 1 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/System.Data.SQLite.dll pi@192.168.0.14: 2 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/MySql.Data.dll pi@192.168.0.14: 3 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Internet.dll pi@192.168.0.14: 4 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.EventLog.dll pi@192.168.0.14: 5 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Data.dll pi@192.168.0.14: 6 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Math.dll pi@192.168.0.14: 7 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Language.dll pi@192.168.0.14: 8 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.IoT.dll pi@192.168.0.14: 9 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Controller.exe pi@192.168.0.14: 10 | -------------------------------------------------------------------------------- /Module 1/Chapter05/Controller/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | 4 | // Information about this assembly is defined by the following attributes. 5 | // Change them to the values specific to your project. 6 | 7 | [assembly: AssemblyTitle ("Controller")] 8 | [assembly: AssemblyDescription ("Implements a controller, controlling an actuator based on values read from a sensor.")] 9 | [assembly: AssemblyConfiguration ("")] 10 | [assembly: AssemblyCompany ("Clayster")] 11 | [assembly: AssemblyProduct ("")] 12 | [assembly: AssemblyCopyright ("Peter Waher")] 13 | [assembly: AssemblyTrademark ("Clayster")] 14 | [assembly: AssemblyCulture ("")] 15 | 16 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". 17 | // The form "{Major}.{Minor}.*" will automatically update the build and revision, 18 | // and "{Major}.{Minor}.{Build}.*" will update just the revision. 19 | 20 | [assembly: AssemblyVersion ("1.0.*")] 21 | 22 | // The following attributes are used to specify the signing key for the assembly, 23 | // if desired. See the Mono documentation for more information about signing. 24 | 25 | //[assembly: AssemblyDelaySign(false)] 26 | //[assembly: AssemblyKeyFile("")] 27 | 28 | -------------------------------------------------------------------------------- /Module 1/Chapter05/Controller/Subscription.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Clayster.Library.Internet.UPnP; 3 | 4 | namespace Controller 5 | { 6 | public class Subscription 7 | { 8 | private string sid; 9 | private string udn; 10 | private string localIp; 11 | private IUPnPService service; 12 | 13 | public Subscription (string Udn, string Sid, IUPnPService Service, string LocalIp) 14 | { 15 | this.sid = Sid; 16 | this.udn = Udn; 17 | this.service = Service; 18 | this.localIp = LocalIp; 19 | } 20 | 21 | public string UDN 22 | { 23 | get{return this.udn;} 24 | } 25 | 26 | public string SID 27 | { 28 | get{return this.sid;} 29 | } 30 | 31 | public IUPnPService Service 32 | { 33 | get{return this.service;} 34 | } 35 | 36 | public string LocalIp 37 | { 38 | get{return this.localIp;} 39 | } 40 | 41 | } 42 | } 43 | 44 | -------------------------------------------------------------------------------- /Module 1/Chapter05/Sensor/CopyToRaspberryPi.bat: -------------------------------------------------------------------------------- 1 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/System.Data.SQLite.dll pi@192.168.0.15: 2 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/MySql.Data.dll pi@192.168.0.15: 3 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Internet.dll pi@192.168.0.15: 4 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.EventLog.dll pi@192.168.0.15: 5 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Data.dll pi@192.168.0.15: 6 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Math.dll pi@192.168.0.15: 7 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Language.dll pi@192.168.0.15: 8 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.RaspberryPi.dll pi@192.168.0.15: 9 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.IoT.dll pi@192.168.0.15: 10 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Sensor.exe pi@192.168.0.15: 11 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Certificate.pfx pi@192.168.0.15: 12 | -------------------------------------------------------------------------------- /Module 1/Chapter05/Sensor/LoginCredentials.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Clayster.Library.Data; 3 | 4 | namespace Sensor 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 ().GetEarliestCreatedDeleteOthers (); 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /Module 1/Chapter05/Sensor/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | 4 | // Information about this assembly is defined by the following attributes. 5 | // Change them to the values specific to your project. 6 | 7 | [assembly: AssemblyTitle ("Sensor")] 8 | [assembly: AssemblyDescription ("Implements a sensor, sensing Temperature, Light and Movement.")] 9 | [assembly: AssemblyConfiguration ("")] 10 | [assembly: AssemblyCompany ("Clayster")] 11 | [assembly: AssemblyProduct ("")] 12 | [assembly: AssemblyCopyright ("Peter Waher")] 13 | [assembly: AssemblyTrademark ("Clayster")] 14 | [assembly: AssemblyCulture ("")] 15 | 16 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". 17 | // The form "{Major}.{Minor}.*" will automatically update the build and revision, 18 | // and "{Major}.{Minor}.{Build}.*" will update just the revision. 19 | 20 | [assembly: AssemblyVersion ("1.0.*")] 21 | 22 | // The following attributes are used to specify the signing key for the assembly, 23 | // if desired. See the Mono documentation for more information about signing. 24 | 25 | //[assembly: AssemblyDelaySign(false)] 26 | //[assembly: AssemblyKeyFile("")] 27 | 28 | -------------------------------------------------------------------------------- /Module 1/Chapter05/Sensor/SessionAuthentication.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Clayster.Library.Internet.HTTP; 3 | 4 | namespace Sensor 5 | { 6 | public class SessionAuthentication : HttpServerAuthenticationMethod 7 | { 8 | public SessionAuthentication () 9 | { 10 | } 11 | 12 | public override string Challenge 13 | { 14 | get 15 | { 16 | return string.Empty; 17 | } 18 | } 19 | 20 | public override object Authorize (HttpHeader Header, HttpServer.Method Method, IHttpServerResource Resource, System.Net.EndPoint RemoteEndPoint, out string UserName, out UnauthorizedReason Reason) 21 | { 22 | string SessionId = Header.GetCookie ("SessionId"); 23 | 24 | if (MainClass.CheckSession (SessionId, out UserName)) 25 | { 26 | Reason = UnauthorizedReason.NoError; 27 | return UserName; 28 | } else 29 | { 30 | Reason = UnauthorizedReason.OldCredentialsTryAgain; 31 | return null; 32 | } 33 | } 34 | 35 | } 36 | } 37 | 38 | -------------------------------------------------------------------------------- /Module 1/Chapter06/.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | *.sln merge=union 7 | *.csproj merge=union 8 | *.vbproj merge=union 9 | *.fsproj merge=union 10 | *.dbproj merge=union 11 | 12 | # Standard to msysgit 13 | *.doc diff=astextplain 14 | *.DOC diff=astextplain 15 | *.docx diff=astextplain 16 | *.DOCX diff=astextplain 17 | *.dot diff=astextplain 18 | *.DOT diff=astextplain 19 | *.pdf diff=astextplain 20 | *.PDF diff=astextplain 21 | *.rtf diff=astextplain 22 | *.RTF diff=astextplain 23 | -------------------------------------------------------------------------------- /Module 1/Chapter06/Actuator/CopyToRaspberryPi.bat: -------------------------------------------------------------------------------- 1 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/System.Data.SQLite.dll pi@192.168.0.13: 2 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/MySql.Data.dll pi@192.168.0.13: 3 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Internet.dll pi@192.168.0.13: 4 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.EventLog.dll pi@192.168.0.13: 5 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Data.dll pi@192.168.0.13: 6 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Math.dll pi@192.168.0.13: 7 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Language.dll pi@192.168.0.13: 8 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.RaspberryPi.dll pi@192.168.0.13: 9 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.IoT.dll pi@192.168.0.13: 10 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Actuator.exe pi@192.168.0.13: 11 | -------------------------------------------------------------------------------- /Module 1/Chapter06/Actuator/LoginCredentials.cs: -------------------------------------------------------------------------------- 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 ().GetEarliestCreatedDeleteOthers (); 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /Module 1/Chapter06/Actuator/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | 4 | // Information about this assembly is defined by the following attributes. 5 | // Change them to the values specific to your project. 6 | 7 | [assembly: AssemblyTitle ("Actuator")] 8 | [assembly: AssemblyDescription ("Implements an actuator, with digital and PWM output.")] 9 | [assembly: AssemblyConfiguration ("")] 10 | [assembly: AssemblyCompany ("Clayster")] 11 | [assembly: AssemblyProduct ("")] 12 | [assembly: AssemblyCopyright ("Peter Waher")] 13 | [assembly: AssemblyTrademark ("Clayster")] 14 | [assembly: AssemblyCulture ("")] 15 | 16 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". 17 | // The form "{Major}.{Minor}.*" will automatically update the build and revision, 18 | // and "{Major}.{Minor}.{Build}.*" will update just the revision. 19 | 20 | [assembly: AssemblyVersion ("1.0.*")] 21 | 22 | // The following attributes are used to specify the signing key for the assembly, 23 | // if desired. See the Mono documentation for more information about signing. 24 | 25 | //[assembly: AssemblyDelaySign(false)] 26 | //[assembly: AssemblyKeyFile("")] 27 | 28 | -------------------------------------------------------------------------------- /Module 1/Chapter06/Actuator/SessionAuthentication.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Clayster.Library.Internet.HTTP; 3 | 4 | namespace Actuator 5 | { 6 | public class SessionAuthentication : HttpServerAuthenticationMethod 7 | { 8 | public SessionAuthentication () 9 | { 10 | } 11 | 12 | public override string Challenge 13 | { 14 | get 15 | { 16 | return string.Empty; 17 | } 18 | } 19 | 20 | public override object Authorize (HttpHeader Header, HttpServer.Method Method, IHttpServerResource Resource, System.Net.EndPoint RemoteEndPoint, out string UserName, out UnauthorizedReason Reason) 21 | { 22 | string SessionId = Header.GetCookie ("SessionId"); 23 | 24 | if (MainClass.CheckSession (SessionId, out UserName)) 25 | { 26 | Reason = UnauthorizedReason.NoError; 27 | return UserName; 28 | } else 29 | { 30 | Reason = UnauthorizedReason.OldCredentialsTryAgain; 31 | return null; 32 | } 33 | } 34 | 35 | } 36 | } 37 | 38 | -------------------------------------------------------------------------------- /Module 1/Chapter06/Camera/CopyToRaspberryPi.bat: -------------------------------------------------------------------------------- 1 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/System.Data.SQLite.dll pi@192.168.0.20: 2 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/MySql.Data.dll pi@192.168.0.20: 3 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Internet.dll pi@192.168.0.20: 4 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.EventLog.dll pi@192.168.0.20: 5 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Data.dll pi@192.168.0.20: 6 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Math.dll pi@192.168.0.20: 7 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Language.dll pi@192.168.0.20: 8 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.IoT.dll pi@192.168.0.20: 9 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.RaspberryPi.dll pi@192.168.0.20: 10 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Camera.exe pi@192.168.0.20: -------------------------------------------------------------------------------- /Module 1/Chapter06/Camera/LoginCredentials.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Clayster.Library.Data; 3 | 4 | namespace Camera 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 ().GetEarliestCreatedDeleteOthers (); 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /Module 1/Chapter06/Camera/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | 4 | // Information about this assembly is defined by the following attributes. 5 | // Change them to the values specific to your project. 6 | 7 | [assembly: AssemblyTitle ("Camera")] 8 | [assembly: AssemblyDescription ("Implements a camera, publishing it on the local area network using UPnP.")] 9 | [assembly: AssemblyConfiguration ("")] 10 | [assembly: AssemblyCompany ("Clayster")] 11 | [assembly: AssemblyProduct ("")] 12 | [assembly: AssemblyCopyright ("Peter Waher")] 13 | [assembly: AssemblyTrademark ("Clayster")] 14 | [assembly: AssemblyCulture ("")] 15 | 16 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". 17 | // The form "{Major}.{Minor}.*" will automatically update the build and revision, 18 | // and "{Major}.{Minor}.{Build}.*" will update just the revision. 19 | 20 | [assembly: AssemblyVersion ("1.0.*")] -------------------------------------------------------------------------------- /Module 1/Chapter06/Camera/SessionAuthentication.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Clayster.Library.Internet.HTTP; 3 | 4 | namespace Camera 5 | { 6 | public class SessionAuthentication : HttpServerAuthenticationMethod 7 | { 8 | public SessionAuthentication () 9 | { 10 | } 11 | 12 | public override string Challenge 13 | { 14 | get 15 | { 16 | return string.Empty; 17 | } 18 | } 19 | 20 | public override object Authorize (HttpHeader Header, HttpServer.Method Method, IHttpServerResource Resource, System.Net.EndPoint RemoteEndPoint, out string UserName, out UnauthorizedReason Reason) 21 | { 22 | string SessionId = Header.GetCookie ("SessionId"); 23 | 24 | if (MainClass.CheckSession (SessionId, out UserName)) 25 | { 26 | Reason = UnauthorizedReason.NoError; 27 | return UserName; 28 | } else 29 | { 30 | Reason = UnauthorizedReason.OldCredentialsTryAgain; 31 | return null; 32 | } 33 | } 34 | 35 | } 36 | } 37 | 38 | -------------------------------------------------------------------------------- /Module 1/Chapter06/Camera/UPnP/128x128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter06/Camera/UPnP/128x128.png -------------------------------------------------------------------------------- /Module 1/Chapter06/Camera/UPnP/16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter06/Camera/UPnP/16x16.png -------------------------------------------------------------------------------- /Module 1/Chapter06/Camera/UPnP/24x24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter06/Camera/UPnP/24x24.png -------------------------------------------------------------------------------- /Module 1/Chapter06/Camera/UPnP/256x256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter06/Camera/UPnP/256x256.png -------------------------------------------------------------------------------- /Module 1/Chapter06/Camera/UPnP/32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter06/Camera/UPnP/32x32.png -------------------------------------------------------------------------------- /Module 1/Chapter06/Camera/UPnP/48x48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter06/Camera/UPnP/48x48.png -------------------------------------------------------------------------------- /Module 1/Chapter06/Camera/UPnP/64x64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter06/Camera/UPnP/64x64.png -------------------------------------------------------------------------------- /Module 1/Chapter06/Clayster.Library.IoT/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Reflection; 3 | using System.Runtime.CompilerServices; 4 | 5 | // Information about this assembly is defined by the following attributes. 6 | // Change them to the values specific to your project. 7 | 8 | [assembly: AssemblyTitle ("Clayster.Library.IoT")] 9 | [assembly: AssemblyDescription ("Library for Interoperability in Internet of Things")] 10 | [assembly: AssemblyConfiguration ("")] 11 | [assembly: AssemblyCompany ("Clayster")] 12 | [assembly: AssemblyProduct ("")] 13 | [assembly: AssemblyCopyright ("Peter Waher")] 14 | [assembly: AssemblyTrademark ("Clayster")] 15 | [assembly: AssemblyCulture ("")] 16 | [assembly: CLSCompliant (true)] 17 | 18 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". 19 | // The form "{Major}.{Minor}.*" will automatically update the build and revision, 20 | // and "{Major}.{Minor}.{Build}.*" will update just the revision. 21 | 22 | [assembly: AssemblyVersion ("1.0.*")] 23 | 24 | // The following attributes are used to specify the signing key for the assembly, 25 | // if desired. See the Mono documentation for more information about signing. 26 | 27 | //[assembly: AssemblyDelaySign(false)] 28 | //[assembly: AssemblyKeyFile("")] 29 | 30 | -------------------------------------------------------------------------------- /Module 1/Chapter06/Clayster.Library.IoT/Provisioning/ClaimedEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Clayster.Library.Internet.XMPP; 3 | 4 | namespace Clayster.Library.IoT.Provisioning 5 | { 6 | /// 7 | /// Delegate used for events. 8 | /// 9 | public delegate void ClaimedEventHandler (object Sender, ClaimedEventArgs e); 10 | 11 | /// 12 | /// Event arguments for events. 13 | /// 14 | /// 15 | /// © Clayster, 2014 16 | /// 17 | /// Author: Peter Waher 18 | /// 19 | [CLSCompliant (true)] 20 | [Serializable] 21 | public class ClaimedEventArgs : NodeReferenceEventArgs 22 | { 23 | private string owner; 24 | private bool pub; 25 | 26 | /// 27 | /// Event arguments for events. 28 | /// 29 | /// Node ID. 30 | /// Source ID. 31 | /// Cache type. 32 | /// Owner JID. 33 | /// If device is public or not. 34 | public ClaimedEventArgs (string NodeId, string SourceId, string CacheType, string Owner, bool Public) 35 | : base (NodeId, SourceId, CacheType) 36 | { 37 | this.owner = Owner; 38 | this.pub = Public; 39 | } 40 | 41 | /// 42 | /// JID of the owner. 43 | /// 44 | public string Owner{ get { return this.owner; } } 45 | 46 | /// 47 | /// If the device is public. 48 | /// 49 | public bool Public{ get { return this.pub; } } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Module 1/Chapter06/Clayster.Library.IoT/Provisioning/IsFriendEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Clayster.Library.Internet.XMPP; 3 | 4 | namespace Clayster.Library.IoT.Provisioning 5 | { 6 | /// 7 | /// Delegate used for callbacks. 8 | /// 9 | public delegate void IsFriendCallback (IsFriendEventArgs e); 10 | 11 | /// 12 | /// Event arguments for callbacks. 13 | /// 14 | /// 15 | /// © Clayster, 2014 16 | /// 17 | /// Author: Peter Waher 18 | /// 19 | [CLSCompliant (true)] 20 | [Serializable] 21 | public class IsFriendEventArgs : JidEventArgs 22 | { 23 | private bool result; 24 | private bool secondaryTrustAllowed; 25 | private object state; 26 | 27 | /// 28 | /// Event arguments for callbacks. 29 | /// 30 | /// Jid of request 31 | /// If friend or not. 32 | /// If secondary trust is allowed. 33 | /// State object passed to the request. 34 | public IsFriendEventArgs (string Jid, bool Result, bool SecondaryTrustAllowed, object State) 35 | : base(Jid) 36 | { 37 | this.result = Result; 38 | this.secondaryTrustAllowed = SecondaryTrustAllowed; 39 | this.state = State; 40 | } 41 | 42 | /// 43 | /// Result of the request. 44 | /// 45 | public bool Result{ get { return this.result; } } 46 | 47 | /// 48 | /// If secondary trust is allowed. 49 | /// 50 | public bool SecondaryTrustAllowed{ get { return this.secondaryTrustAllowed; } } 51 | 52 | /// 53 | /// State object passed to the request. 54 | /// 55 | public object State{ get { return this.state; } } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /Module 1/Chapter06/Clayster.Library.IoT/Provisioning/JidEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Clayster.Library.Internet.XMPP; 3 | 4 | namespace Clayster.Library.IoT.Provisioning 5 | { 6 | /// 7 | /// Delegate used for JID event handlers. 8 | /// 9 | public delegate void JidEventHandler (object Sender, JidEventArgs e); 10 | 11 | /// 12 | /// Event arguments for JID events. 13 | /// 14 | /// 15 | /// © Clayster, 2014 16 | /// 17 | /// Author: Peter Waher 18 | /// 19 | [CLSCompliant (true)] 20 | [Serializable] 21 | public class JidEventArgs : EventArgs 22 | { 23 | private string jid; 24 | 25 | /// 26 | /// Event arguments for JID events. 27 | /// 28 | /// Jid of request 29 | public JidEventArgs (string Jid) 30 | :base() 31 | { 32 | this.jid = Jid; 33 | } 34 | 35 | /// 36 | /// JID 37 | /// 38 | public string Jid{ get { return this.jid; } } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Module 1/Chapter06/Clayster.Library.IoT/Provisioning/NodeReferenceEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Clayster.Library.Internet.XMPP; 3 | 4 | namespace Clayster.Library.IoT.Provisioning 5 | { 6 | /// 7 | /// Delegate used for node reference events. 8 | /// 9 | public delegate void NodeReferenceEventHandler (object Sender, NodeReferenceEventArgs e); 10 | 11 | /// 12 | /// Event arguments for node reference events. 13 | /// 14 | /// 15 | /// © Clayster, 2014 16 | /// 17 | /// Author: Peter Waher 18 | /// 19 | [CLSCompliant (true)] 20 | [Serializable] 21 | public class NodeReferenceEventArgs : EventArgs 22 | { 23 | private string nodeId; 24 | private string sourceId; 25 | private string cacheType; 26 | 27 | /// 28 | /// Event arguments for node reference events. 29 | /// 30 | /// Node ID. 31 | /// Source ID. 32 | /// Cache type. 33 | public NodeReferenceEventArgs (string NodeId, string SourceId, string CacheType) 34 | { 35 | this.nodeId = NodeId; 36 | this.sourceId = SourceId; 37 | this.cacheType = CacheType; 38 | } 39 | 40 | /// 41 | /// Optional Node ID of node behind concentrator. 42 | /// 43 | public string NodeId{ get { return this.nodeId; } } 44 | 45 | /// 46 | /// Optional Source ID of node behind concentrator. 47 | /// 48 | public string SourceId{ get { return this.sourceId; } } 49 | 50 | /// 51 | /// Optional Cache Type of node behind concentrator. 52 | /// 53 | public string CacheType{ get { return this.cacheType; } } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Module 1/Chapter06/Clayster.Library.IoT/Provisioning/NumericalTag.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Xml; 3 | using Clayster.Library.Internet; 4 | 5 | namespace Clayster.Library.IoT.Provisioning 6 | { 7 | /// 8 | /// Class for numerical thing registry tags 9 | /// 10 | /// 11 | /// © Clayster, 2014 12 | /// 13 | /// Author: Peter Waher 14 | /// 15 | [CLSCompliant (true)] 16 | [Serializable] 17 | public class NumericalTag : Tag 18 | { 19 | private double value; 20 | 21 | /// 22 | /// Class for numerical thing registry tags 23 | /// 24 | /// Tag name 25 | public NumericalTag (string Name, double Value) 26 | : base (Name) 27 | { 28 | this.value = Value; 29 | } 30 | 31 | /// 32 | /// Tag value 33 | /// 34 | public double Value{ get { return this.value; } } 35 | 36 | /// 37 | /// Exports the tag to XML. 38 | /// 39 | /// XML Output 40 | public override void ToXml (XmlWriter Output) 41 | { 42 | Output.WriteStartElement ("num"); 43 | Output.WriteAttributeString ("name", this.Name); 44 | Output.WriteAttributeString ("value", XmlUtilities.DoubleToString (this.value)); 45 | Output.WriteEndElement (); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /Module 1/Chapter06/Clayster.Library.IoT/Provisioning/StringTag.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Xml; 3 | 4 | namespace Clayster.Library.IoT.Provisioning 5 | { 6 | /// 7 | /// Class for string-valued thing registry tags 8 | /// 9 | /// 10 | /// © Clayster, 2014 11 | /// 12 | /// Author: Peter Waher 13 | /// 14 | [CLSCompliant (true)] 15 | [Serializable] 16 | public class StringTag : Tag 17 | { 18 | private string value; 19 | 20 | /// 21 | /// Class for string-valued thing registry tags 22 | /// 23 | /// Tag name 24 | public StringTag (string Name, string Value) 25 | : base (Name) 26 | { 27 | this.value = Value; 28 | } 29 | 30 | /// 31 | /// Tag value 32 | /// 33 | public string Value{ get { return this.value; } } 34 | 35 | /// 36 | /// Exports the tag to XML. 37 | /// 38 | /// XML Output 39 | public override void ToXml (XmlWriter Output) 40 | { 41 | Output.WriteStartElement ("str"); 42 | Output.WriteAttributeString ("name", this.Name); 43 | Output.WriteAttributeString ("value", this.value); 44 | Output.WriteEndElement (); 45 | } 46 | 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /Module 1/Chapter06/Clayster.Library.IoT/Provisioning/Tag.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Xml; 3 | 4 | namespace Clayster.Library.IoT.Provisioning 5 | { 6 | /// 7 | /// Abstract base class for thing registry tags 8 | /// 9 | /// 10 | /// © Clayster, 2014 11 | /// 12 | /// Author: Peter Waher 13 | /// 14 | [CLSCompliant (true)] 15 | [Serializable] 16 | public abstract class Tag 17 | { 18 | private string name; 19 | 20 | /// 21 | /// Abstract base class for thing registry tags 22 | /// 23 | /// Tag name 24 | public Tag (string Name) 25 | { 26 | this.name = Name; 27 | } 28 | 29 | /// 30 | /// Tag name 31 | /// 32 | public string Name{ get { return this.name; } } 33 | 34 | /// 35 | /// Exports the tag to XML. 36 | /// 37 | /// XML Output 38 | public abstract void ToXml (XmlWriter Output); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Module 1/Chapter06/Clayster.Library.IoT/SensorData/Field.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter06/Clayster.Library.IoT/SensorData/Field.cs -------------------------------------------------------------------------------- /Module 1/Chapter06/Clayster.Library.IoT/SensorData/FieldBoolean.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter06/Clayster.Library.IoT/SensorData/FieldBoolean.cs -------------------------------------------------------------------------------- /Module 1/Chapter06/Clayster.Library.IoT/SensorData/FieldDateTime.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter06/Clayster.Library.IoT/SensorData/FieldDateTime.cs -------------------------------------------------------------------------------- /Module 1/Chapter06/Clayster.Library.IoT/SensorData/FieldEnum.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter06/Clayster.Library.IoT/SensorData/FieldEnum.cs -------------------------------------------------------------------------------- /Module 1/Chapter06/Clayster.Library.IoT/SensorData/FieldGrid.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter06/Clayster.Library.IoT/SensorData/FieldGrid.cs -------------------------------------------------------------------------------- /Module 1/Chapter06/Clayster.Library.IoT/SensorData/FieldNumeric.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter06/Clayster.Library.IoT/SensorData/FieldNumeric.cs -------------------------------------------------------------------------------- /Module 1/Chapter06/Clayster.Library.IoT/SensorData/FieldString.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter06/Clayster.Library.IoT/SensorData/FieldString.cs -------------------------------------------------------------------------------- /Module 1/Chapter06/Clayster.Library.IoT/SensorData/FieldTimeSpan.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter06/Clayster.Library.IoT/SensorData/FieldTimeSpan.cs -------------------------------------------------------------------------------- /Module 1/Chapter06/Clayster.Library.IoT/XmppInterfaces/ControlParameters/IControlParameter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Xml; 3 | using System.Text; 4 | using System.Threading; 5 | using System.Collections.Generic; 6 | using Clayster.Library.EventLog; 7 | using Clayster.Library.Internet; 8 | using Clayster.Library.Internet.XMPP; 9 | using Clayster.Library.IoT.Provisioning; 10 | using Clayster.Library.IoT.SensorData; 11 | 12 | namespace Clayster.Library.IoT.XmppInterfaces.ControlParameters 13 | { 14 | /// 15 | /// Interface for control parameters, managed by . 16 | /// 17 | /// 18 | /// © Clayster, 2014 19 | /// 20 | /// Author: Peter Waher 21 | /// 22 | public interface IControlParameter 23 | { 24 | /// 25 | /// Parameter name. 26 | /// 27 | string Name 28 | { 29 | get; 30 | } 31 | 32 | /// 33 | /// Parameter title. 34 | /// 35 | string Title 36 | { 37 | get; 38 | } 39 | 40 | /// 41 | /// Parameter description. 42 | /// 43 | string Description 44 | { 45 | get; 46 | } 47 | 48 | /// 49 | /// Exports the parameter to XML. 50 | /// 51 | /// XML Output. 52 | void Export (XmlWriter Output); 53 | 54 | /// 55 | /// Parses and sets the value. 56 | /// 57 | /// Value. 58 | /// null if import was successful. Error message, if not successful. 59 | string Import (string Value); 60 | 61 | /// 62 | /// Current value. 63 | /// 64 | object Value 65 | { 66 | get; 67 | } 68 | 69 | /// 70 | /// Current value, as a string. 71 | /// 72 | string ValueString 73 | { 74 | get; 75 | } 76 | 77 | } 78 | } -------------------------------------------------------------------------------- /Module 1/Chapter06/Clayster.Library.IoT/XmppInterfaces/ReadoutError.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Xml; 3 | using System.Text; 4 | using System.Threading; 5 | using System.Collections.Generic; 6 | using Clayster.Library.EventLog; 7 | using Clayster.Library.Internet; 8 | using Clayster.Library.Internet.XMPP; 9 | using Clayster.Library.IoT.Provisioning; 10 | using Clayster.Library.IoT.SensorData; 11 | 12 | namespace Clayster.Library.IoT.XmppInterfaces 13 | { 14 | /// 15 | /// Readout error. 16 | /// 17 | /// 18 | /// © Clayster, 2014 19 | /// 20 | /// Author: Peter Waher 21 | /// 22 | public class ReadoutError : NodeReference 23 | { 24 | private DateTime timestamp; 25 | private string errorMessage; 26 | 27 | /// 28 | /// Readout error. 29 | /// 30 | /// Timestamp. 31 | /// Error message. 32 | /// Node identifier. 33 | /// Cache type. 34 | /// Source identifier. 35 | public ReadoutError (DateTime Timestamp, string ErrorMessage, string NodeId, string CacheType, string SourceId) 36 | : base (NodeId, CacheType, SourceId) 37 | { 38 | this.timestamp = Timestamp; 39 | this.errorMessage = ErrorMessage; 40 | } 41 | 42 | /// 43 | /// Timestamp of error, according to the clock in the remote device. 44 | /// 45 | public DateTime Timestamp 46 | { 47 | get{ return this.timestamp; } 48 | } 49 | 50 | /// 51 | /// Error Message 52 | /// 53 | public string ErrorMessage 54 | { 55 | get{ return this.errorMessage; } 56 | } 57 | 58 | } 59 | } -------------------------------------------------------------------------------- /Module 1/Chapter06/Clayster.Library.RaspberryPi/MyClass.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Clayster.Library.RaspberryPi 4 | { 5 | public class MyClass 6 | { 7 | public MyClass () 8 | { 9 | } 10 | } 11 | } 12 | 13 | -------------------------------------------------------------------------------- /Module 1/Chapter06/Clayster.Library.RaspberryPi/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | 4 | // Information about this assembly is defined by the following attributes. 5 | // Change them to the values specific to your project. 6 | 7 | [assembly: AssemblyTitle ("Clayster.Library.RaspberryPi")] 8 | [assembly: AssemblyDescription ("Hardware abstraction layer for the RaspberryPi.")] 9 | [assembly: AssemblyConfiguration ("")] 10 | [assembly: AssemblyCompany ("Clayster")] 11 | [assembly: AssemblyProduct ("")] 12 | [assembly: AssemblyCopyright ("Peter Waher")] 13 | [assembly: AssemblyTrademark ("Clayster")] 14 | [assembly: AssemblyCulture ("")] 15 | 16 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". 17 | // The form "{Major}.{Minor}.*" will automatically update the build and revision, 18 | // and "{Major}.{Minor}.{Build}.*" will update just the revision. 19 | 20 | [assembly: AssemblyVersion ("1.0.*")] 21 | 22 | // The following attributes are used to specify the signing key for the assembly, 23 | // if desired. See the Mono documentation for more information about signing. 24 | 25 | //[assembly: AssemblyDelaySign(false)] 26 | //[assembly: AssemblyKeyFile("")] 27 | 28 | -------------------------------------------------------------------------------- /Module 1/Chapter06/Clayster/Clayster.Library.Data.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter06/Clayster/Clayster.Library.Data.dll -------------------------------------------------------------------------------- /Module 1/Chapter06/Clayster/Clayster.Library.EventLog.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter06/Clayster/Clayster.Library.EventLog.dll -------------------------------------------------------------------------------- /Module 1/Chapter06/Clayster/Clayster.Library.Internet.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter06/Clayster/Clayster.Library.Internet.dll -------------------------------------------------------------------------------- /Module 1/Chapter06/Clayster/Clayster.Library.Language.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter06/Clayster/Clayster.Library.Language.dll -------------------------------------------------------------------------------- /Module 1/Chapter06/Clayster/Clayster.Library.Math.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter06/Clayster/Clayster.Library.Math.dll -------------------------------------------------------------------------------- /Module 1/Chapter06/Clayster/MySql.Data.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter06/Clayster/MySql.Data.dll -------------------------------------------------------------------------------- /Module 1/Chapter06/Clayster/System.Data.SQLite.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 1/Chapter06/Clayster/System.Data.SQLite.dll -------------------------------------------------------------------------------- /Module 1/Chapter06/Controller/CopyToRaspberryPi.bat: -------------------------------------------------------------------------------- 1 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/System.Data.SQLite.dll pi@192.168.0.12: 2 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/MySql.Data.dll pi@192.168.0.12: 3 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Internet.dll pi@192.168.0.12: 4 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.EventLog.dll pi@192.168.0.12: 5 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Data.dll pi@192.168.0.12: 6 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Math.dll pi@192.168.0.12: 7 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Language.dll pi@192.168.0.12: 8 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.IoT.dll pi@192.168.0.12: 9 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Controller.exe pi@192.168.0.12: 10 | -------------------------------------------------------------------------------- /Module 1/Chapter06/Controller/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | 4 | // Information about this assembly is defined by the following attributes. 5 | // Change them to the values specific to your project. 6 | 7 | [assembly: AssemblyTitle ("Controller")] 8 | [assembly: AssemblyDescription ("Implements a controller, controlling an actuator based on values read from a sensor.")] 9 | [assembly: AssemblyConfiguration ("")] 10 | [assembly: AssemblyCompany ("Clayster")] 11 | [assembly: AssemblyProduct ("")] 12 | [assembly: AssemblyCopyright ("Peter Waher")] 13 | [assembly: AssemblyTrademark ("Clayster")] 14 | [assembly: AssemblyCulture ("")] 15 | 16 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". 17 | // The form "{Major}.{Minor}.*" will automatically update the build and revision, 18 | // and "{Major}.{Minor}.{Build}.*" will update just the revision. 19 | 20 | [assembly: AssemblyVersion ("1.0.*")] 21 | 22 | // The following attributes are used to specify the signing key for the assembly, 23 | // if desired. See the Mono documentation for more information about signing. 24 | 25 | //[assembly: AssemblyDelaySign(false)] 26 | //[assembly: AssemblyKeyFile("")] 27 | 28 | -------------------------------------------------------------------------------- /Module 1/Chapter06/Controller/Subscription.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Clayster.Library.Internet.UPnP; 3 | 4 | namespace Controller 5 | { 6 | public class Subscription 7 | { 8 | private string sid; 9 | private string udn; 10 | private string localIp; 11 | private IUPnPService service; 12 | 13 | public Subscription (string Udn, string Sid, IUPnPService Service, string LocalIp) 14 | { 15 | this.sid = Sid; 16 | this.udn = Udn; 17 | this.service = Service; 18 | this.localIp = LocalIp; 19 | } 20 | 21 | public string UDN 22 | { 23 | get{return this.udn;} 24 | } 25 | 26 | public string SID 27 | { 28 | get{return this.sid;} 29 | } 30 | 31 | public IUPnPService Service 32 | { 33 | get{return this.service;} 34 | } 35 | 36 | public string LocalIp 37 | { 38 | get{return this.localIp;} 39 | } 40 | 41 | } 42 | } 43 | 44 | -------------------------------------------------------------------------------- /Module 1/Chapter06/Sensor/CopyToRaspberryPi.bat: -------------------------------------------------------------------------------- 1 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/System.Data.SQLite.dll pi@192.168.0.10: 2 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/MySql.Data.dll pi@192.168.0.10: 3 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Internet.dll pi@192.168.0.10: 4 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.EventLog.dll pi@192.168.0.10: 5 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Data.dll pi@192.168.0.10: 6 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Math.dll pi@192.168.0.10: 7 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.Language.dll pi@192.168.0.10: 8 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.RaspberryPi.dll pi@192.168.0.10: 9 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Clayster.Library.IoT.dll pi@192.168.0.10: 10 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Sensor.exe pi@192.168.0.10: 11 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Certificate.pfx pi@192.168.0.10: 12 | -------------------------------------------------------------------------------- /Module 1/Chapter06/Sensor/LoginCredentials.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Clayster.Library.Data; 3 | 4 | namespace Sensor 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 ().GetEarliestCreatedDeleteOthers (); 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /Module 1/Chapter06/Sensor/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | 4 | // Information about this assembly is defined by the following attributes. 5 | // Change them to the values specific to your project. 6 | 7 | [assembly: AssemblyTitle ("Sensor")] 8 | [assembly: AssemblyDescription ("Implements a sensor, sensing Temperature, Light and Movement.")] 9 | [assembly: AssemblyConfiguration ("")] 10 | [assembly: AssemblyCompany ("Clayster")] 11 | [assembly: AssemblyProduct ("")] 12 | [assembly: AssemblyCopyright ("Peter Waher")] 13 | [assembly: AssemblyTrademark ("Clayster")] 14 | [assembly: AssemblyCulture ("")] 15 | 16 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". 17 | // The form "{Major}.{Minor}.*" will automatically update the build and revision, 18 | // and "{Major}.{Minor}.{Build}.*" will update just the revision. 19 | 20 | [assembly: AssemblyVersion ("1.0.*")] 21 | 22 | // The following attributes are used to specify the signing key for the assembly, 23 | // if desired. See the Mono documentation for more information about signing. 24 | 25 | //[assembly: AssemblyDelaySign(false)] 26 | //[assembly: AssemblyKeyFile("")] 27 | 28 | -------------------------------------------------------------------------------- /Module 1/Chapter06/Sensor/SessionAuthentication.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Clayster.Library.Internet.HTTP; 3 | 4 | namespace Sensor 5 | { 6 | public class SessionAuthentication : HttpServerAuthenticationMethod 7 | { 8 | public SessionAuthentication () 9 | { 10 | } 11 | 12 | public override string Challenge 13 | { 14 | get 15 | { 16 | return string.Empty; 17 | } 18 | } 19 | 20 | public override object Authorize (HttpHeader Header, HttpServer.Method Method, IHttpServerResource Resource, System.Net.EndPoint RemoteEndPoint, out string UserName, out UnauthorizedReason Reason) 21 | { 22 | string SessionId = Header.GetCookie ("SessionId"); 23 | 24 | if (MainClass.CheckSession (SessionId, out UserName)) 25 | { 26 | Reason = UnauthorizedReason.NoError; 27 | return UserName; 28 | } else 29 | { 30 | Reason = UnauthorizedReason.OldCredentialsTryAgain; 31 | return null; 32 | } 33 | } 34 | 35 | } 36 | } 37 | 38 | -------------------------------------------------------------------------------- /Module 1/Chapter07/.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | *.sln merge=union 7 | *.csproj merge=union 8 | *.vbproj merge=union 9 | *.fsproj merge=union 10 | *.dbproj merge=union 11 | 12 | # Standard to msysgit 13 | *.doc diff=astextplain 14 | *.DOC diff=astextplain 15 | *.docx diff=astextplain 16 | *.DOCX diff=astextplain 17 | *.dot diff=astextplain 18 | *.DOT diff=astextplain 19 | *.pdf diff=astextplain 20 | *.PDF diff=astextplain 21 | *.rtf diff=astextplain 22 | *.RTF diff=astextplain 23 | -------------------------------------------------------------------------------- /Module 1/Chapter07/Controller2/Actuator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Clayster.Library.Math.Interfaces; 3 | using Clayster.Library.Language; 4 | using Clayster.Library.Meters; 5 | using Clayster.Metering.Xmpp; 6 | 7 | namespace Controller2 8 | { 9 | public class Actuator : XmppActuator 10 | { 11 | public Actuator () 12 | { 13 | } 14 | 15 | public override string TagName 16 | { 17 | get 18 | { 19 | return "IoTActuator"; 20 | } 21 | } 22 | 23 | public override string Namespace 24 | { 25 | get 26 | { 27 | return "http://www.clayster.com/learningiot/"; 28 | } 29 | } 30 | 31 | public override string GetDisplayableTypeName (Language UserLanguage) 32 | { 33 | return "Learning IoT - Actuator"; 34 | } 35 | 36 | public override SupportGrade Supports (XmppDeviceInformation DeviceInformation) 37 | { 38 | if (Array.IndexOf (DeviceInformation.InteroperabilityInterfaces, "XMPP.IoT.Actuator.DigitalOutputs") >= 0 && 39 | Array.IndexOf (DeviceInformation.InteroperabilityInterfaces, "XMPP.IoT.Security.Alarm") >= 0 && 40 | Array.IndexOf (DeviceInformation.InteroperabilityInterfaces, "Clayster.LearningIoT.Actuator.DO1-8") >= 0) 41 | { 42 | return SupportGrade.Perfect; 43 | } 44 | else 45 | return SupportGrade.NotAtAll; 46 | } 47 | 48 | public void UpdateLeds(int LedMask) 49 | { 50 | this.RequestConfiguration ((NodeConfigurationMethod)null, "R_Digital Outputs", LedMask, this.Id); 51 | } 52 | 53 | public void UpdateAlarm(bool Alarm) 54 | { 55 | this.RequestConfiguration ((NodeConfigurationMethod)null, "R_State", Alarm, this.Id); 56 | } 57 | 58 | } 59 | } 60 | 61 | -------------------------------------------------------------------------------- /Module 1/Chapter07/Controller2/Controller2.packagemanifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Module 1/Chapter07/Controller2/CopyToRaspberryPi.bat: -------------------------------------------------------------------------------- 1 | rem copy bin\Debug\Controller2.dll C:\Downloads\ClaysterSmall 2 | rem copy bin\Debug\Controller2.pdb C:\Downloads\ClaysterSmall 3 | 4 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/Controller2.dll pi@192.168.0.12: -------------------------------------------------------------------------------- /Module 1/Chapter07/Controller2/LearningIoT.cer: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIEADCCAuigAwIBAgIJAI3HX4y/cqo2MA0GCSqGSIb3DQEBBQUAMIGnMQswCQYD 3 | VQQGEwJDTDETMBEGA1UECBQKVmFscGFyYe1zbzEVMBMGA1UEBxQMVmnxYSBkZWwg 4 | TWFyMREwDwYDVQQKEwhDbGF5c3RlcjEKMAgGA1UECxMBRDEkMCIGA1UEAxMbTGVh 5 | cm5pbmcgSW50ZXJuZXQgb2YgVGhpbmdzMScwJQYJKoZIhvcNAQkBFhhwZXRlci53 6 | YWhlckBjbGF5c3Rlci5jb20wHhcNMTQxMDAxMjEwNDE3WhcNMjQxMDAxMjEwNDE3 7 | WjCBpzELMAkGA1UEBhMCQ0wxEzARBgNVBAgUClZhbHBhcmHtc28xFTATBgNVBAcU 8 | DFZp8WEgZGVsIE1hcjERMA8GA1UEChMIQ2xheXN0ZXIxCjAIBgNVBAsTAUQxJDAi 9 | BgNVBAMTG0xlYXJuaW5nIEludGVybmV0IG9mIFRoaW5nczEnMCUGCSqGSIb3DQEJ 10 | ARYYcGV0ZXIud2FoZXJAY2xheXN0ZXIuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOC 11 | AQ8AMIIBCgKCAQEA5LxOLCMQsXzGsxXFgC1Tdrg32JRouj0BAQ+bSNQLD7n1J86L 12 | XybHmHuK9jttP2m/39unF72kvKC4hQKZgVU6BC2PVKlRR4arEYtCxDaprE3MWmh7 13 | KcGs2+3pYSiKnEFvIrDvcDclAZs6xeuCDgAznR+Zxz12VHWwOujbHyDRtY9DZvhN 14 | tux7LsRzi1hP88IwxRbLzMrkeifAKTG5qsu1DQCOU5eCAZFpNTqY0Eci4IX5vO3x 15 | 850JFit9E2q4HUvTQBwkIntUNJXvwSeZ6Ublk+LG27xtzGydJRDLPXQSBhVQKRvm 16 | qrHMKs9Ul0XmGaUB+KEC8Md3FKLU41XsX3KdpwIDAQABoy0wKzAJBgNVHRMEAjAA 17 | MBEGCWCGSAGG+EIBAQQEAwIE8DALBgNVHQ8EBAMCBSAwDQYJKoZIhvcNAQEFBQAD 18 | ggEBAAWqSvQAJZy+sEqr3M3oQPDkuydqpLPY15xsLJTuT4yFr/iylPU/2O4vJVLt 19 | 2BH7qXz9342Y+A16PbNhhYHQIj2iwoKagwSgzpVtR8BpzvU1t+6ClSRYP/L2AfGf 20 | FoBBhYPKbuiB7rePu+oDDdhtP4mr46O1jM+0E6DuLBFK3pOE/sUymLlZ1iCzVCBt 21 | DKJOlGlmUNwf/ArfIu7fLi7nEbJFsrmAog13jSCM9YfG9LQpj7LAaN+c4teYR+Ci 22 | Dc8TdBsvaJECOojXar4P7A2q13Es4QjzCZRnNpZ5qxuAeNPpgFvrcgkkHeezKvnG 23 | qJW4/mu90T99pm+6T4biQP67MYs= 24 | -----END CERTIFICATE----- 25 | -------------------------------------------------------------------------------- /Module 1/Chapter07/Controller2/MailSettings.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Clayster.Library.Data; 3 | 4 | namespace Controller2 5 | { 6 | public class MailSettings : DBObject 7 | { 8 | private string from = string.Empty; 9 | private string recipient = string.Empty; 10 | 11 | public MailSettings () 12 | : base (Controller.db) 13 | { 14 | } 15 | 16 | [DBShortStringClipped (false)] 17 | [DBDefaultEmptyString] 18 | public string From 19 | { 20 | get { return this.from; } 21 | set 22 | { 23 | if (this.from != value) 24 | { 25 | this.from = value; 26 | this.Modified = true; 27 | } 28 | } 29 | } 30 | 31 | [DBShortStringClipped (false)] 32 | [DBDefaultEmptyString] 33 | public string Recipient 34 | { 35 | get { return this.recipient; } 36 | set 37 | { 38 | if (this.recipient != value) 39 | { 40 | this.recipient = value; 41 | this.Modified = true; 42 | } 43 | } 44 | } 45 | 46 | public static MailSettings LoadSettings () 47 | { 48 | return Controller.db.FindObjects ().GetEarliestCreatedDeleteOthers (); 49 | } 50 | } 51 | } -------------------------------------------------------------------------------- /Module 1/Chapter07/Controller2/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Reflection; 3 | using System.Runtime.CompilerServices; 4 | using Clayster.Library.Installation; 5 | 6 | // Information about this assembly is defined by the following attributes. 7 | // Change them to the values specific to your project. 8 | 9 | [assembly: AssemblyTitle ("Controller2")] 10 | [assembly: AssemblyDescription ("Implements a controller, controlling an actuator based on values read from a sensor.")] 11 | [assembly: AssemblyConfiguration ("")] 12 | [assembly: AssemblyCompany ("Clayster")] 13 | [assembly: AssemblyProduct ("")] 14 | [assembly: AssemblyCopyright ("Peter Waher")] 15 | [assembly: AssemblyTrademark ("Clayster")] 16 | [assembly: AssemblyCulture ("")] 17 | [assembly: CLSCompliant(true)] 18 | [assembly: Certificate("LearningIoT.cer")] 19 | 20 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". 21 | // The form "{Major}.{Minor}.*" will automatically update the build and revision, 22 | // and "{Major}.{Minor}.{Build}.*" will update just the revision. 23 | 24 | [assembly: AssemblyVersion ("1.0.*")] 25 | 26 | // The following attributes are used to specify the signing key for the assembly, 27 | // if desired. See the Mono documentation for more information about signing. 28 | 29 | //[assembly: AssemblyDelaySign(false)] 30 | //[assembly: AssemblyKeyFile("")] 31 | 32 | -------------------------------------------------------------------------------- /Module 1/Chapter07/LearningIoT.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2012 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Controller2", "Controller2\Controller2.csproj", "{CC3CF7F1-AC63-44DA-822E-4DD9314ADE89}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Any CPU = Debug|Any CPU 9 | Release|Any CPU = Release|Any CPU 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {CC3CF7F1-AC63-44DA-822E-4DD9314ADE89}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 13 | {CC3CF7F1-AC63-44DA-822E-4DD9314ADE89}.Debug|Any CPU.Build.0 = Debug|Any CPU 14 | {CC3CF7F1-AC63-44DA-822E-4DD9314ADE89}.Release|Any CPU.ActiveCfg = Release|Any CPU 15 | {CC3CF7F1-AC63-44DA-822E-4DD9314ADE89}.Release|Any CPU.Build.0 = Release|Any CPU 16 | EndGlobalSection 17 | GlobalSection(MonoDevelopProperties) = preSolution 18 | StartupItem = Controller2\Controller2.csproj 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /Module 1/Chapter08/.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | *.sln merge=union 7 | *.csproj merge=union 8 | *.vbproj merge=union 9 | *.fsproj merge=union 10 | *.dbproj merge=union 11 | 12 | # Standard to msysgit 13 | *.doc diff=astextplain 14 | *.DOC diff=astextplain 15 | *.docx diff=astextplain 16 | *.DOCX diff=astextplain 17 | *.dot diff=astextplain 18 | *.DOT diff=astextplain 19 | *.pdf diff=astextplain 20 | *.PDF diff=astextplain 21 | *.rtf diff=astextplain 22 | *.RTF diff=astextplain 23 | -------------------------------------------------------------------------------- /Module 1/Chapter08/CoapGateway/CoapGateway.packagemanifest: -------------------------------------------------------------------------------- 1 |  2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /Module 1/Chapter08/CoapGateway/ContentTypes/Simple/CoapString.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.Xml; 5 | using Clayster.Library.Abstract; 6 | using Clayster.Library.Internet; 7 | using Clayster.Library.Internet.CoAP; 8 | using Clayster.Library.Meters; 9 | using Clayster.Library.Language; 10 | 11 | namespace CoapGateway.ContentTypes.Simple 12 | { 13 | /// 14 | /// Simple string content. 15 | /// 16 | /// 17 | /// © Clayster, 2013-2014 18 | /// 19 | /// Author: Peter Waher 20 | /// 21 | [CLSCompliant(true)] 22 | [Serializable] 23 | public class CoapString : CoapSimpleContent 24 | { 25 | /// 26 | /// Simple string content. 27 | /// 28 | public CoapString() 29 | : base() 30 | { 31 | } 32 | 33 | public override string TagName 34 | { 35 | get { return "CoapString"; } 36 | } 37 | 38 | public override string GetDisplayableTypeName(Language UserLanguage) 39 | { 40 | return String(UserLanguage, 36, "CoAP String"); 41 | } 42 | 43 | public override List ParseContent(object Content, ReadoutType Types, DateTime From, DateTime To) 44 | { 45 | List Result = new List(); 46 | string s = Content as string; 47 | 48 | if (!string.IsNullOrEmpty(s)) 49 | Result.Add(new FieldString(this, this.FieldName, 0, null, DateTime.Now, s, ReadoutType.MomentaryValues, FieldStatus.AutomaticReadout, string.Empty)); 50 | else 51 | this.LogError(String(47, "Unable to parse string value.")); 52 | 53 | return Result; 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /Module 1/Chapter08/CoapGateway/CopyToRaspberryPi.bat: -------------------------------------------------------------------------------- 1 | rem copy bin\Debug\CoapGateway.dll C:\Downloads\ClaysterSmall 2 | rem copy bin\Debug\CoapGateway.pdb C:\Downloads\ClaysterSmall 3 | 4 | rem "c:\Program Files (x86)\PuTTY\pscp.exe" -pw raspberry bin/Debug/CoapGateway.dll pi@192.168.0.12: -------------------------------------------------------------------------------- /Module 1/Chapter08/CoapGateway/LearningIoT.cer: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIEADCCAuigAwIBAgIJAI3HX4y/cqo2MA0GCSqGSIb3DQEBBQUAMIGnMQswCQYD 3 | VQQGEwJDTDETMBEGA1UECBQKVmFscGFyYe1zbzEVMBMGA1UEBxQMVmnxYSBkZWwg 4 | TWFyMREwDwYDVQQKEwhDbGF5c3RlcjEKMAgGA1UECxMBRDEkMCIGA1UEAxMbTGVh 5 | cm5pbmcgSW50ZXJuZXQgb2YgVGhpbmdzMScwJQYJKoZIhvcNAQkBFhhwZXRlci53 6 | YWhlckBjbGF5c3Rlci5jb20wHhcNMTQxMDAxMjEwNDE3WhcNMjQxMDAxMjEwNDE3 7 | WjCBpzELMAkGA1UEBhMCQ0wxEzARBgNVBAgUClZhbHBhcmHtc28xFTATBgNVBAcU 8 | DFZp8WEgZGVsIE1hcjERMA8GA1UEChMIQ2xheXN0ZXIxCjAIBgNVBAsTAUQxJDAi 9 | BgNVBAMTG0xlYXJuaW5nIEludGVybmV0IG9mIFRoaW5nczEnMCUGCSqGSIb3DQEJ 10 | ARYYcGV0ZXIud2FoZXJAY2xheXN0ZXIuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOC 11 | AQ8AMIIBCgKCAQEA5LxOLCMQsXzGsxXFgC1Tdrg32JRouj0BAQ+bSNQLD7n1J86L 12 | XybHmHuK9jttP2m/39unF72kvKC4hQKZgVU6BC2PVKlRR4arEYtCxDaprE3MWmh7 13 | KcGs2+3pYSiKnEFvIrDvcDclAZs6xeuCDgAznR+Zxz12VHWwOujbHyDRtY9DZvhN 14 | tux7LsRzi1hP88IwxRbLzMrkeifAKTG5qsu1DQCOU5eCAZFpNTqY0Eci4IX5vO3x 15 | 850JFit9E2q4HUvTQBwkIntUNJXvwSeZ6Ublk+LG27xtzGydJRDLPXQSBhVQKRvm 16 | qrHMKs9Ul0XmGaUB+KEC8Md3FKLU41XsX3KdpwIDAQABoy0wKzAJBgNVHRMEAjAA 17 | MBEGCWCGSAGG+EIBAQQEAwIE8DALBgNVHQ8EBAMCBSAwDQYJKoZIhvcNAQEFBQAD 18 | ggEBAAWqSvQAJZy+sEqr3M3oQPDkuydqpLPY15xsLJTuT4yFr/iylPU/2O4vJVLt 19 | 2BH7qXz9342Y+A16PbNhhYHQIj2iwoKagwSgzpVtR8BpzvU1t+6ClSRYP/L2AfGf 20 | FoBBhYPKbuiB7rePu+oDDdhtP4mr46O1jM+0E6DuLBFK3pOE/sUymLlZ1iCzVCBt 21 | DKJOlGlmUNwf/ArfIu7fLi7nEbJFsrmAog13jSCM9YfG9LQpj7LAaN+c4teYR+Ci 22 | Dc8TdBsvaJECOojXar4P7A2q13Es4QjzCZRnNpZ5qxuAeNPpgFvrcgkkHeezKvnG 23 | qJW4/mu90T99pm+6T4biQP67MYs= 24 | -----END CERTIFICATE----- 25 | -------------------------------------------------------------------------------- /Module 1/Chapter08/CoapGateway/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Reflection; 3 | using System.Runtime.CompilerServices; 4 | using Clayster.Library.Installation; 5 | 6 | // Information about this assembly is defined by the following attributes. 7 | // Change them to the values specific to your project. 8 | 9 | [assembly: AssemblyTitle ("CoapGateway")] 10 | [assembly: AssemblyDescription ("Implements a CoAP module for the Clayster platform, publishing the metering topology on the CoAP network. It also provides capabilities to read CoAP devices.")] 11 | [assembly: AssemblyConfiguration ("")] 12 | [assembly: AssemblyCompany ("Clayster")] 13 | [assembly: AssemblyProduct ("")] 14 | [assembly: AssemblyCopyright ("Peter Waher")] 15 | [assembly: AssemblyTrademark ("Clayster")] 16 | [assembly: AssemblyCulture ("")] 17 | [assembly: CLSCompliant(true)] 18 | [assembly: Certificate("LearningIoT.cer")] 19 | 20 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". 21 | // The form "{Major}.{Minor}.*" will automatically update the build and revision, 22 | // and "{Major}.{Minor}.{Build}.*" will update just the revision. 23 | 24 | [assembly: AssemblyVersion ("1.0.*")] 25 | 26 | // The following attributes are used to specify the signing key for the assembly, 27 | // if desired. See the Mono documentation for more information about signing. 28 | 29 | //[assembly: AssemblyDelaySign(false)] 30 | //[assembly: AssemblyKeyFile("")] -------------------------------------------------------------------------------- /Module 1/Chapter08/LearningIoT.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2012 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CoapGateway", "CoapGateway\CoapGateway.csproj", "{A32959D7-1546-42E2-BC2E-805727ABF999}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Any CPU = Debug|Any CPU 9 | Release|Any CPU = Release|Any CPU 10 | MONO|Any CPU = MONO|Any CPU 11 | EndGlobalSection 12 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 13 | {A32959D7-1546-42E2-BC2E-805727ABF999}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 14 | {A32959D7-1546-42E2-BC2E-805727ABF999}.Debug|Any CPU.Build.0 = Debug|Any CPU 15 | {A32959D7-1546-42E2-BC2E-805727ABF999}.MONO|Any CPU.ActiveCfg = MONO|Any CPU 16 | {A32959D7-1546-42E2-BC2E-805727ABF999}.MONO|Any CPU.Build.0 = MONO|Any CPU 17 | {A32959D7-1546-42E2-BC2E-805727ABF999}.Release|Any CPU.ActiveCfg = Release|Any CPU 18 | {A32959D7-1546-42E2-BC2E-805727ABF999}.Release|Any CPU.Build.0 = Release|Any CPU 19 | EndGlobalSection 20 | GlobalSection(MonoDevelopProperties) = preSolution 21 | StartupItem = CoapGateway\CoapGateway.csproj 22 | EndGlobalSection 23 | EndGlobal 24 | -------------------------------------------------------------------------------- /Module 2/Chapter01/Chapter1-6/B04844_01_06.ino: -------------------------------------------------------------------------------- 1 | /*Code: B04844_01_06.ino*/ 2 | 3 | #include 4 | #include 5 | 6 | byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; 7 | byte ip[] = { 192, 168, 1, 177 }; 8 | 9 | EthernetServer server(80); 10 | 11 | void setup() 12 | { 13 | Serial.begin(9600); 14 | 15 | Ethernet.begin(mac, ip); 16 | server.begin(); 17 | Serial.print("IP Address: "); 18 | Serial.println(Ethernet.localIP()); 19 | 20 | } 21 | 22 | void loop () {} 23 | 24 | -------------------------------------------------------------------------------- /Module 2/Chapter01/Chapter1-7/B04844_01_07.ino: -------------------------------------------------------------------------------- 1 | /*Code: B04844_01_07.ino*/ 2 | 3 | #include 4 | #include 5 | 6 | byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; 7 | 8 | EthernetServer server(80); 9 | 10 | void setup() 11 | { 12 | Serial.begin(9600); 13 | 14 | Ethernet.begin(mac); 15 | server.begin(); 16 | Serial.print("IP Address: "); 17 | Serial.println(Ethernet.localIP()); 18 | 19 | } 20 | 21 | void loop () {} 22 | 23 | -------------------------------------------------------------------------------- /Module 2/Chapter02/Chapter2-Code/chapter2-1/B04844_02_01.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | char ssid[] = "Dialog 4G Open"; 5 | int status = WL_IDLE_STATUS; 6 | 7 | void setup() 8 | { 9 | Serial.begin(9600); 10 | while (!Serial) 11 | { 12 | ; 13 | } 14 | 15 | if (WiFi.status() == WL_NO_SHIELD) 16 | { 17 | Serial.println("No WiFi shield found"); 18 | while(true); 19 | } 20 | 21 | while ( status != WL_CONNECTED) 22 | { 23 | Serial.print("Attempting to connect to open SSID: "); 24 | Serial.println(ssid); 25 | status = WiFi.begin(ssid); 26 | 27 | delay(10000); 28 | } 29 | 30 | Serial.print("You're connected to the network"); 31 | } 32 | 33 | void loop () 34 | { 35 | 36 | } 37 | 38 | -------------------------------------------------------------------------------- /Module 2/Chapter02/Chapter2-Code/chapter2-2/B04844_02_02.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | char ssid[] = "Dialog 4G Open"; 5 | int status = WL_IDLE_STATUS; 6 | 7 | void setup() 8 | { 9 | Serial.begin(9600); 10 | while (!Serial) 11 | { 12 | ; 13 | } 14 | 15 | if (WiFi.status() == WL_NO_SHIELD) 16 | { 17 | Serial.println("No WiFi shield found"); 18 | while(true); 19 | } 20 | 21 | while ( status != WL_CONNECTED) 22 | { 23 | Serial.print("Attempting to connect to open SSID: "); 24 | Serial.println(ssid); 25 | status = WiFi.begin(ssid); 26 | 27 | delay(10000); 28 | } 29 | 30 | Serial.print("You're connected to the network"); 31 | } 32 | 33 | void loop () 34 | { 35 | 36 | } 37 | 38 | -------------------------------------------------------------------------------- /Module 2/Chapter02/Chapter2-Code/chapter2-3/B04844_02_03.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | char ssid[] = "Dialog 4G"; 5 | char key[] = "D0D0DEADF00DABBADEAFBEADED"; 6 | int keyIndex = 0; 7 | int status = WL_IDLE_STATUS; 8 | 9 | void setup() 10 | { 11 | 12 | Serial.begin(9600); 13 | while (!Serial) 14 | { 15 | ; 16 | } 17 | 18 | if (WiFi.status() == WL_NO_SHIELD) 19 | { 20 | Serial.println("WiFi shield not present"); 21 | 22 | while(true); 23 | } 24 | 25 | while ( status != WL_CONNECTED) 26 | { 27 | Serial.print("Attempting to connect to WEP network, SSID: "); 28 | Serial.println(ssid); 29 | status = WiFi.begin(ssid, keyIndex, key); 30 | 31 | delay(10000); 32 | } 33 | 34 | Serial.print("You're connected to the network"); 35 | } 36 | 37 | void loop() 38 | { 39 | 40 | } 41 | 42 | -------------------------------------------------------------------------------- /Module 2/Chapter02/Chapter2-Code/chapter2-4/B04844_02_04.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | char ssid[] = "Dialog 4G"; 5 | char pass[] = "secretPassword"; 6 | 7 | void setup() 8 | { 9 | WiFi.begin(ssid, pass); 10 | 11 | if (WiFi.status() != WL_CONNECTED) 12 | { 13 | Serial.println("Couldn't get a wifi connection"); 14 | while(true); 15 | } 16 | 17 | else 18 | { 19 | long rssi = WiFi.RSSI(); 20 | Serial.print("RSSI:"); 21 | Serial.println(rssi); 22 | } 23 | } 24 | 25 | void loop () 26 | { 27 | } 28 | 29 | -------------------------------------------------------------------------------- /Module 2/Chapter02/Chapter2-Code/chapter2-5/B04844_02_05.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | char ssid[] = "Dialog 4G"; 5 | char pass[] = "secretPassword"; 6 | 7 | void setup() 8 | { 9 | WiFi.begin(ssid, pass); 10 | } 11 | 12 | void loop () 13 | { 14 | if (WiFi.status() != WL_CONNECTED) { 15 | Serial.println("Couldn't get a wifi connection"); 16 | while(true); 17 | } 18 | 19 | else 20 | { 21 | long rssi = WiFi.RSSI(); 22 | Serial.print("Signal Strenght: "); 23 | Serial.println(rssi); 24 | Serial.print(" dBm"); 25 | } 26 | 27 | delay(1000); 28 | 29 | } 30 | 31 | -------------------------------------------------------------------------------- /Module 2/Chapter02/Chapter2-Code/drv2605.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 2/Chapter02/Chapter2-Code/drv2605.pdf -------------------------------------------------------------------------------- /Module 2/Chapter02/Chapter2-Libraries/Adafruit_DRV2605_Library-master.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 2/Chapter02/Chapter2-Libraries/Adafruit_DRV2605_Library-master.zip -------------------------------------------------------------------------------- /Module 2/Chapter03/Chapter3-1/B04844_03_01.ino: -------------------------------------------------------------------------------- 1 | int pin = 2; 2 | volatile unsigned int pulse; 3 | const int pulses_per_litre = 450; 4 | 5 | void setup() 6 | { 7 | Serial.begin(9600); 8 | 9 | pinMode(pin, INPUT); 10 | attachInterrupt(0, count_pulse, RISING); 11 | } 12 | 13 | void loop() 14 | { 15 | pulse=0; 16 | interrupts(); 17 | delay(1000); 18 | noInterrupts(); 19 | 20 | Serial.print("Pulses per second: "); 21 | Serial.println(pulse); 22 | } 23 | 24 | void count_pulse() 25 | { 26 | pulse++; 27 | } 28 | 29 | -------------------------------------------------------------------------------- /Module 2/Chapter03/Chapter3-2/B04844_03_02.ino: -------------------------------------------------------------------------------- 1 | int pin = 2; 2 | volatile unsigned int pulse; 3 | const int pulses_per_litre = 450; 4 | 5 | void setup() 6 | { 7 | Serial.begin(9600); 8 | 9 | pinMode(pin, INPUT); 10 | attachInterrupt(0, count_pulse, RISING); 11 | } 12 | 13 | void loop() 14 | { 15 | pulse = 0; 16 | 17 | interrupts(); 18 | delay(100); 19 | noInterrupts(); 20 | 21 | Serial.print("Pulses per second: "); 22 | Serial.println(pulse); 23 | 24 | Serial.print("Water flow rate: "); 25 | Serial.print(pulse * 1000/pulses_per_litre); 26 | Serial.println("milliliters per second"); 27 | } 28 | 29 | void count_pulse() 30 | { 31 | pulse++; 32 | } 33 | 34 | -------------------------------------------------------------------------------- /Module 2/Chapter03/Chapter3-3/B04844_03_03.ino: -------------------------------------------------------------------------------- 1 | int pin = 2; 2 | volatile unsigned int pulse; 3 | float volume = 0; 4 | float flow_rate =0; 5 | const int pulses_per_litre=450; 6 | 7 | void setup() 8 | { 9 | Serial.begin(9600); 10 | pinMode(pin, INPUT); 11 | attachInterrupt(0, count_pulse, RISING); 12 | } 13 | 14 | void loop() 15 | { 16 | pulse=0; 17 | 18 | interrupts(); 19 | delay(100); //reduce to 100 will get better result. It seems work better when reader blow air through the water meter. 20 | noInterrupts(); 21 | 22 | Serial.print("Pulses per second: "); 23 | Serial.println(pulse); 24 | 25 | flow_rate = pulse * 1000/pulses_per_litre; //Display ml is easier for readers during test 26 | 27 | Serial.print("Water flow rate: "); 28 | Serial.print(flow_rate); 29 | Serial.println(" milliliters per second"); 30 | 31 | volume = volume + flow_rate * 0.1; //Time Interval is 0.1 second 32 | 33 | Serial.print("Volume: "); 34 | Serial.print(volume); 35 | Serial.println(" milliliters"); 36 | } 37 | 38 | void count_pulse() 39 | { 40 | pulse++; 41 | } 42 | 43 | -------------------------------------------------------------------------------- /Module 2/Chapter03/Chapter3-4/B04844_03_04.ino: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int pin = 2; 4 | volatile unsigned int pulse; 5 | float volume = 0; 6 | float flow_rate = 0; 7 | const int pulses_per_litre = 450; 8 | 9 | // initialize the library with the numbers of the interface pins 10 | LiquidCrystal lcd(8, 7, 6, 5, 4, 3); 11 | 12 | void setup() 13 | { 14 | Serial.begin(9600); 15 | pinMode(pin, INPUT); 16 | attachInterrupt(0, count_pulse, RISING); 17 | 18 | // set up the LCD's number of columns and rows: 19 | lcd.begin(16, 2); 20 | // Print a message to the LCD. 21 | lcd.print("Welcome"); 22 | } 23 | 24 | void loop() 25 | { 26 | pulse = 0; 27 | 28 | interrupts(); 29 | delay(100); 30 | noInterrupts(); 31 | 32 | lcd.setCursor(0, 0); 33 | 34 | lcd.print("Pulses/s: "); 35 | lcd.print(pulse); 36 | 37 | flow_rate = pulse*1000/pulses_per_litre; 38 | 39 | lcd.setCursor(0, 1); 40 | lcd.print(flow_rate,2);//display only 2 decimal places 41 | lcd.print(" ml/s"); 42 | 43 | volume = volume + flow_rate * 0.1; 44 | 45 | lcd.setCursor(7, 1); 46 | lcd.print(volume, 2);//display only 2 decimal places 47 | lcd.println(" ml"); 48 | } 49 | 50 | void count_pulse() 51 | { 52 | pulse++; 53 | } 54 | 55 | -------------------------------------------------------------------------------- /Module 2/Chapter04/Chapter4-Resources/Adafruit-VC0706-Serial-Camera-Library-master/Adafruit-VC0706-Serial-Camera-Library-master/README.txt: -------------------------------------------------------------------------------- 1 | This is a library for the Adafruit TTL JPEG Camera (VC0706 chipset) 2 | 3 | Pick one up today in the adafruit shop! 4 | ------> http://www.adafruit.com/products/397 5 | 6 | These displays use Serial to communicate, 2 pins are required to interface 7 | 8 | Adafruit invests time and resources providing this open source code, 9 | please support Adafruit and open-source hardware by purchasing 10 | products from Adafruit! 11 | 12 | Written by Limor Fried/Ladyada for Adafruit Industries. 13 | BSD license, all text above must be included in any redistribution 14 | 15 | 16 | To download. click the DOWNLOADS button in the top right corner, rename the uncompressed folder Adafruit_VC0706. Check that the Adafruit_VC0706 folder contains Adafruit_VC0706.cpp and Adafruit_VC0706.h 17 | 18 | Place the Adafruit_VC0706 library folder your /libraries/ folder. You may need to create the libraries subfolder if its your first library. Restart the IDE. -------------------------------------------------------------------------------- /Module 2/Chapter04/Chapter4-Resources/Adafruit-VC0706-Serial-Camera-Library-master/Adafruit-VC0706-Serial-Camera-Library-master/library.properties: -------------------------------------------------------------------------------- 1 | name=Adafruit VC0706 Serial Camera Library 2 | version=1.0.0 3 | author=Adafruit 4 | maintainer=Adafruit 5 | sentence=Library for VC0706-based Serial JPEG Cameras 6 | paragraph=Library for VC0706-based Serial JPEG Cameras 7 | category=Device Control 8 | url=https://github.com/adafruit/Adafruit-VC0706-Serial-Camera-Library 9 | architectures=* 10 | -------------------------------------------------------------------------------- /Module 2/Chapter05/Chapter5-Codes/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 33 | 34 | 35 |
36 |

37 |
38 |

SOLAR CELL VOLTAGE CHART

39 |
40 | 41 |
42 | 43 |
44 |
45 |

volts

46 |

. . . .

47 | 48 | 49 | -------------------------------------------------------------------------------- /Module 2/Chapter05/Chapter5-Software/FlexiTimer2/FlexiTimer2/FlexiTimer2.h: -------------------------------------------------------------------------------- 1 | #ifndef FlexiTimer2_h 2 | #define FlexiTimer2_h 3 | 4 | #ifdef __AVR__ 5 | #include 6 | #else 7 | #error FlexiTimer2 library only works on AVR architecture 8 | #endif 9 | 10 | 11 | namespace FlexiTimer2 { 12 | extern unsigned long time_units; 13 | extern void (*func)(); 14 | extern volatile unsigned long count; 15 | extern volatile char overflowing; 16 | extern volatile unsigned int tcnt2; 17 | 18 | void set(unsigned long ms, void (*f)()); 19 | void set(unsigned long units, double resolution, void (*f)()); 20 | void start(); 21 | void stop(); 22 | void _overflow(); 23 | } 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /Module 2/Chapter05/Chapter5-Software/FlexiTimer2/FlexiTimer2/examples/FlashLed/FlashLed.pde: -------------------------------------------------------------------------------- 1 | char dummyvar; // to get Arduinoi IDE to include core headers properly 2 | 3 | /* 4 | FlexiTimer2: 5 | Arduino library to use timer 2 with a configurable resolution. 6 | Based on MsTimer2 by Javier Valencia. It is called FlexiTimer2 because it 7 | is based on MsTimer2, but offers more flexibility, 8 | since it has a configurable timer resolution. 9 | MsTimer2 library: http://www.arduino.cc/playground/Main/MsTimer2 10 | 11 | For more details on FlexiTimer2 see: 12 | http://www.arduino.cc/playground/Main/FlexiTimer2 13 | https://github.com/wimleers/flexitimer2 14 | 15 | */ 16 | 17 | #include 18 | 19 | // Switch on LED on and off each half second 20 | 21 | #if defined(ARDUINO) && ARDUINO >= 100 22 | const int led_pin = LED_BUILTIN; // 1.0 built in LED pin var 23 | #else 24 | #if defined(CORE_LED0_PIN) 25 | const int led_pin = CORE_LED0_PIN; // 3rd party LED pin define 26 | #else 27 | const int led_pin = 13; // default to pin 13 28 | #endif 29 | #endif 30 | 31 | void flash() 32 | { 33 | static boolean output = HIGH; 34 | 35 | digitalWrite(led_pin, output); 36 | output = !output; 37 | } 38 | 39 | void setup() 40 | { 41 | pinMode(led_pin, OUTPUT); 42 | 43 | FlexiTimer2::set(500, 1.0/1000, flash); // call every 500 1ms "ticks" 44 | // FlexiTimer2::set(500, flash); // MsTimer2 style is also supported 45 | FlexiTimer2::start(); 46 | } 47 | 48 | void loop() 49 | { 50 | } 51 | -------------------------------------------------------------------------------- /Module 2/Chapter05/Chapter5-Software/FlexiTimer2/FlexiTimer2/keywords.txt: -------------------------------------------------------------------------------- 1 | FlexiTimer2 KEYWORD1 2 | set KEYWORD2 3 | start KEYWORD2 4 | stop KEYWORD2 5 | -------------------------------------------------------------------------------- /Module 2/Chapter06/Chapter6-Resouces/TinyGPSPlus-master.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/IoT-Building-Arduino-based-Projects/9fc37cc2bbe5cef2b4edc498776a7820a56f9ffc/Module 2/Chapter06/Chapter6-Resouces/TinyGPSPlus-master.zip -------------------------------------------------------------------------------- /Module 2/Chapter07/B04844_07_01.ino: -------------------------------------------------------------------------------- 1 | 2 | void setup() 3 | { 4 | 5 | pinMode(5, OUTPUT); 6 | Serial.begin(9600); // initialize serial communications at 9600 bps 7 | } 8 | 9 | void loop() 10 | { 11 | while (!Serial.available()) {} 12 | // serial read section 13 | while (Serial.available()) 14 | { 15 | if (Serial.available() > 0) 16 | { 17 | char c = Serial.read(); //gets one byte from serial buffer 18 | 19 | if (c == '1') 20 | { 21 | digitalWrite(5,HIGH); 22 | }else if (c == '0') 23 | { 24 | digitalWrite(5,LOW); 25 | } 26 | } 27 | } 28 | 29 | delay(500); 30 | 31 | } 32 | -------------------------------------------------------------------------------- /Module 2/Chapter07/twitter_test.py: -------------------------------------------------------------------------------- 1 | import tweepy 2 | import time 3 | import serial 4 | import struct 5 | 6 | auth = tweepy.OAuthHandler('SZ3jdFtq6Y25TtgAPJaL9w4wm', 'jQ9MBuy7SL6wgRK1JF9VG6GAOMGGGGIAFevITkNEAMglUNebgK') 7 | auth.set_access_token('3300242354-sJB78WNygLJeNSXdmN7LGxkTKWBck6vYIL79jjE', 'ZGfOgnPBhUD10Odb7DhvWlMt3KsxKxwqlcAbc0HEk21RH') 8 | 9 | api = tweepy.API(auth) 10 | ser = serial.Serial('COM3', 9600, timeout=1) 11 | last_tweet="#switchoff" 12 | 13 | while True: # This constructs an infinite loop 14 | public_tweets = api.user_timeline(screen_name='@pradeeka7',count=1) 15 | for tweet in public_tweets: 16 | if '#switchon' in tweet.text: #check if the tweet contains the text #switchon 17 | print (tweet.text) #print the tweet 18 | if last_tweet == "#switchoff": 19 | if not ser.isOpen(): #if serial port is not open 20 | ser.flush(); #open the serial port 21 | ser.write('1') # write 1 on serial port 22 | print('Write 1 on serial port') #print message on console 23 | last_tweet="#switchon" 24 | elif "#switchoff" in tweet.text: #check if the tweet contains the text #switchoff 25 | print (tweet.text) #print the tweet 26 | if last_tweet == "#switchon": 27 | if not ser.isOpen(): #if serial port is not open 28 | ser.open(); #open the serial port 29 | ser.open(); #open the serial port 30 | ser.write("0") # write 0 on serial port 31 | print('Write 0 on serial port') #print message on console 32 | last_tweet="#switchoff" 33 | else: 34 | ser.close() #close the serial port 35 | print('invalid tweet') 36 | time.sleep(30) #wait for 30 seconds -------------------------------------------------------------------------------- /Module 2/Chapter08/Chapter8-Codes/B04844_08_01/B04844_08_01.ino: -------------------------------------------------------------------------------- 1 | /* 2 | * IRremote: IRrecvDemo - demonstrates receiving IR codes with IRrecv 3 | * An IR detector/demodulator must be connected to the input RECV_PIN. 4 | * Version 0.1 July, 2009 5 | * Copyright 2009 Ken Shirriff 6 | * http://arcfn.com 7 | */ 8 | 9 | #include 10 | 11 | int RECV_PIN = 11; 12 | 13 | IRrecv irrecv(RECV_PIN); 14 | 15 | decode_results results; 16 | 17 | void setup() 18 | { 19 | Serial.begin(9600); 20 | irrecv.enableIRIn(); // Start the receiver 21 | } 22 | 23 | void loop() { 24 | if (irrecv.decode(&results)) { 25 | Serial.println(results.value, HEX); 26 | irrecv.resume(); // Receive the next value 27 | } 28 | delay(100); 29 | } 30 | -------------------------------------------------------------------------------- /Module 2/Chapter08/Chapter8-Codes/B04844_08_03/B04844_08_03.ino: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | IRsend irsend; 4 | int pushButton = 7; //push button connected to digital pin 7 5 | int val = 0; // variable for reading the button status 6 | 7 | unsigned int rawData[69] = {47536, 4700,4250, 750,1500, 700,1500, 700,1550, 700,400, 700,400, 700,400, 700,450, 650,450, 650,1600, 600,1600, 650,1600, 600,500, 600,500, 600,550, 600,500, 600,500, 600,1650, 550,1650, 600,1650, 550,550, 550,600, 500,600, 500,600, 550,550, 550,600, 500,600, 500,600, 500,1750, 500,1700, 500,1750, 500,1700, 500,1750, 500,0}; // SAMSUNG E0E0E01F 8 | 9 | void setup() 10 | { 11 | pinMode(pushButton, INPUT); 12 | } 13 | 14 | void loop() { 15 | 16 | val = digitalRead(pushButton); // read input value 17 | if (val == HIGH) { 18 | for (int i = 0; i < 3; i++) { 19 | irsend.sendRaw(rawData,69,32); 20 | delay(40); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Module 2/Chapter08/Chapter8-Software/Arduino-IRremote-master/.gitignore: -------------------------------------------------------------------------------- 1 | *.un~ 2 | -------------------------------------------------------------------------------- /Module 2/Chapter08/Chapter8-Software/Arduino-IRremote-master/.travis.yml: -------------------------------------------------------------------------------- 1 | language: python 2 | python: 3 | - "2.7" 4 | 5 | env: 6 | - PLATFORMIO_CI_SRC=examples/AiwaRCT501SendDemo PLATFORMIO_BUILD_FLAGS="-DSEND_AIWA_RC_T501" 7 | - PLATFORMIO_CI_SRC=examples/IRrecord PLATFORMIO_BUILD_FLAGS="-DSEND_NEC -DSEND_SONY -DSEND_RC5 -DSEND_RC6" 8 | - PLATFORMIO_CI_SRC=examples/IRrecvDemo 9 | - PLATFORMIO_CI_SRC=examples/IRrecvDump 10 | - PLATFORMIO_CI_SRC=examples/IRrecvDumpV2 11 | - PLATFORMIO_CI_SRC=examples/IRrelay 12 | - PLATFORMIO_CI_SRC=examples/IRsendDemo PLATFORMIO_BUILD_FLAGS="-DSEND_SONY" 13 | - PLATFORMIO_CI_SRC=examples/IRtest PLATFORMIO_BUILD_FLAGS="-DSEND_NEC -DSEND_SONY -DSEND_RC5 -DSEND_RC6" 14 | - PLATFORMIO_CI_SRC=examples/IRtest2 PLATFORMIO_BUILD_FLAGS="-DSEND_NEC -DSEND_SONY -DSEND_RC5 -DSEND_RC6" 15 | - PLATFORMIO_CI_SRC=examples/JVCPanasonicSendDemo PLATFORMIO_BUILD_FLAGS="-DSEND_JVC -DSEND_PANASONIC" 16 | 17 | install: 18 | - python -c "$(curl -fsSL https://raw.githubusercontent.com/platformio/platformio/master/scripts/get-platformio.py)" 19 | 20 | script: 21 | - platformio ci --lib="." --board=uno --board=leonardo --board=pro16MHzatmega168 22 | -------------------------------------------------------------------------------- /Module 2/Chapter08/Chapter8-Software/Arduino-IRremote-master/Contributors.md: -------------------------------------------------------------------------------- 1 | ## Contributors 2 | These are the active contributors of this project that you may contact if there is anything you need help with or if you have suggestions. 3 | 4 | - [z3t0](https://github.com/z3t0) : Active Contributor and currently also the main contributor. 5 | * Email: zetoslab@gmail.com 6 | * Skype: polarised16 7 | - [shirriff](https://github.com/shirriff) : An amazing person who worked to create this awesome library and provide unending support 8 | - [Informatic](https://github.com/Informatic) : Active contributor 9 | - [fmeschia](https://github.com/fmeschia) : Active contributor 10 | - [PaulStoffregen](https://github.com/paulstroffregen) : Active contributor 11 | - [crash7](https://github.com/crash7) : Active contributor 12 | - [Neco777](https://github.com/neco777) : Active contributor 13 | - [Lauszus](https://github.com/lauszus) : Active contributor 14 | - [csBlueChip](https://github.com/csbluechip) : Active contributor, who contributed major and vital changes to the code base. 15 | 16 | Note: This list is being updated constantly so please let [z3t0](https://github.com/z3t0) know if you have been missed. 17 | 18 | 19 | -------------------------------------------------------------------------------- /Module 2/Chapter08/Chapter8-Software/Arduino-IRremote-master/README.md: -------------------------------------------------------------------------------- 1 | # IRremote Arduino Library 2 | 3 | [![Build Status](https://travis-ci.org/z3t0/Arduino-IRremote.svg?branch=master)](https://travis-ci.org/z3t0/Arduino-IRremote) 4 | 5 | [![Join the chat at https://gitter.im/z3t0/Arduino-IRremote](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/z3t0/Arduino-IRremote?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) 6 | 7 | This library enables you to send and receive using infra-red signals on an Arduino. 8 | 9 | Check [here](http://z3t0.github.io/Arduino-IRremote/) for tutorials and more information. 10 | 11 | ## Version - 2.01 12 | 13 | ## Installation 14 | 1. Navigate to the [Releases](https://github.com/z3t0/Arduino-IRremote/releases) page. 15 | 2. Download the latest release. 16 | 3. Extract the zip file 17 | 4. Move the "IRremote" folder that has been extracted to your libraries directory. 18 | 19 | ## Usage 20 | - TODO (Check examples for now) 21 | 22 | ## Contributing 23 | If you want to contribute to this project: 24 | - Report bugs and errors 25 | - Ask for enhancements 26 | - Create issues and pull requests 27 | - Tell other people about this library 28 | - Contribute new protocols 29 | 30 | ## Contributors 31 | Check [here](Contributors.md) 32 | 33 | ## Copyright 34 | Copyright 2009-2012 Ken Shirriff 35 | -------------------------------------------------------------------------------- /Module 2/Chapter08/Chapter8-Software/Arduino-IRremote-master/changelog.md: -------------------------------------------------------------------------------- 1 | ## 2.0.1 - 2015/07/26 - [Release](https://github.com/shirriff/Arduino-IRremote/releases/tag/BETA) 2 | ### Changes 3 | - Updated README 4 | - Updated Contributors 5 | - Fixed #110 Mess 6 | - Created Gitter Room 7 | - Added Gitter Badge 8 | - Standardised Code Base 9 | - Clean Debug Output 10 | - Optimized Send Loops 11 | - Modularized Design 12 | - Optimized and Updated Examples 13 | - Improved Documentation 14 | - Fixed and Improved many coding errors 15 | - Fixed Aiwa RC-T501 Decoding 16 | - Fixed Interrupt on ATmega8 17 | - Switched to Stable Release of @PlatformIO 18 | 19 | ### Additions 20 | - Added Aiwa RC-T501 Protocol 21 | - Added Denon Protocol 22 | - Added Pronto Support 23 | - Added Library Properties 24 | - Added Template For New Protocols 25 | - Added this changelog 26 | - Added Teensy LC Support 27 | - Added ATtiny84 Support 28 | - Added ATtiny85 Support 29 | - Added isIdle method 30 | 31 | ### Deletions 32 | - Removed (Fixed) #110 33 | - Broke Teensy 3 / 3.1 Support 34 | 35 | ### Not Working 36 | - Teensy 3 / 3.1 Support is in Development 37 | -------------------------------------------------------------------------------- /Module 2/Chapter08/Chapter8-Software/Arduino-IRremote-master/examples/AiwaRCT501SendDemo/AiwaRCT501SendDemo.ino: -------------------------------------------------------------------------------- 1 | /* 2 | * IRremote: IRsendDemo - demonstrates sending IR codes with IRsend 3 | * An IR LED must be connected to Arduino PWM pin 3. 4 | * Version 0.1 July, 2009 5 | * Copyright 2009 Ken Shirriff 6 | * http://arcfn.com 7 | */ 8 | 9 | #include "IRremote.h" 10 | 11 | #define POWER 0x7F80 12 | #define AIWA_RC_T501 13 | 14 | IRsend irsend; 15 | 16 | void setup() { 17 | Serial.begin(9600); 18 | Serial.println("Arduino Ready"); 19 | } 20 | 21 | void loop() { 22 | if (Serial.read() != -1) { 23 | irsend.sendAiwaRCT501(POWER); 24 | delay(60); // Optional 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Module 2/Chapter08/Chapter8-Software/Arduino-IRremote-master/examples/IRrecvDemo/IRrecvDemo.ino: -------------------------------------------------------------------------------- 1 | /* 2 | * IRremote: IRrecvDemo - demonstrates receiving IR codes with IRrecv 3 | * An IR detector/demodulator must be connected to the input RECV_PIN. 4 | * Version 0.1 July, 2009 5 | * Copyright 2009 Ken Shirriff 6 | * http://arcfn.com 7 | */ 8 | 9 | #include 10 | 11 | int RECV_PIN = 11; 12 | 13 | IRrecv irrecv(RECV_PIN); 14 | 15 | decode_results results; 16 | 17 | void setup() 18 | { 19 | Serial.begin(9600); 20 | irrecv.enableIRIn(); // Start the receiver 21 | } 22 | 23 | void loop() { 24 | if (irrecv.decode(&results)) { 25 | Serial.println(results.value, HEX); 26 | irrecv.resume(); // Receive the next value 27 | } 28 | delay(100); 29 | } 30 | -------------------------------------------------------------------------------- /Module 2/Chapter08/Chapter8-Software/Arduino-IRremote-master/examples/IRsendDemo/IRsendDemo.ino: -------------------------------------------------------------------------------- 1 | /* 2 | * IRremote: IRsendDemo - demonstrates sending IR codes with IRsend 3 | * An IR LED must be connected to Arduino PWM pin 3. 4 | * Version 0.1 July, 2009 5 | * Copyright 2009 Ken Shirriff 6 | * http://arcfn.com 7 | */ 8 | 9 | 10 | #include 11 | 12 | IRsend irsend; 13 | 14 | void setup() 15 | { 16 | } 17 | 18 | void loop() { 19 | for (int i = 0; i < 3; i++) { 20 | irsend.sendSony(0xa90, 12); 21 | delay(40); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Module 2/Chapter08/Chapter8-Software/Arduino-IRremote-master/examples/JVCPanasonicSendDemo/JVCPanasonicSendDemo.ino: -------------------------------------------------------------------------------- 1 | /* 2 | * IRremote: IRsendDemo - demonstrates sending IR codes with IRsend 3 | * An IR LED must be connected to Arduino PWM pin 3. 4 | * Version 0.1 July, 2009 5 | * Copyright 2009 Ken Shirriff 6 | * http://arcfn.com 7 | * JVC and Panasonic protocol added by Kristian Lauszus (Thanks to zenwheel and other people at the original blog post) 8 | */ 9 | #include 10 | 11 | #define PanasonicAddress 0x4004 // Panasonic address (Pre data) 12 | #define PanasonicPower 0x100BCBD // Panasonic Power button 13 | 14 | #define JVCPower 0xC5E8 15 | 16 | IRsend irsend; 17 | 18 | void setup() 19 | { 20 | } 21 | 22 | void loop() { 23 | irsend.sendPanasonic(PanasonicAddress,PanasonicPower); // This should turn your TV on and off 24 | 25 | irsend.sendJVC(JVCPower, 16,0); // hex value, 16 bits, no repeat 26 | delayMicroseconds(50); // see http://www.sbprojects.com/knowledge/ir/jvc.php for information 27 | irsend.sendJVC(JVCPower, 16,1); // hex value, 16 bits, repeat 28 | delayMicroseconds(50); 29 | } 30 | -------------------------------------------------------------------------------- /Module 2/Chapter08/Chapter8-Software/Arduino-IRremote-master/ir_Dish.cpp: -------------------------------------------------------------------------------- 1 | #include "IRremote.h" 2 | #include "IRremoteInt.h" 3 | 4 | //============================================================================== 5 | // DDDD IIIII SSSS H H 6 | // D D I S H H 7 | // D D I SSS HHHHH 8 | // D D I S H H 9 | // DDDD IIIII SSSS H H 10 | //============================================================================== 11 | 12 | // Sharp and DISH support by Todd Treece ( http://unionbridge.org/design/ircommand ) 13 | // 14 | // The sned function needs to be repeated 4 times 15 | // 16 | // Only send the last for characters of the hex. 17 | // I.E. Use 0x1C10 instead of 0x0000000000001C10 as listed in the LIRC file. 18 | // 19 | // Here is the LIRC file I found that seems to match the remote codes from the 20 | // oscilloscope: 21 | // DISH NETWORK (echostar 301): 22 | // http://lirc.sourceforge.net/remotes/echostar/301_501_3100_5100_58xx_59xx 23 | 24 | #define DISH_BITS 16 25 | #define DISH_HDR_MARK 400 26 | #define DISH_HDR_SPACE 6100 27 | #define DISH_BIT_MARK 400 28 | #define DISH_ONE_SPACE 1700 29 | #define DISH_ZERO_SPACE 2800 30 | #define DISH_RPT_SPACE 6200 31 | 32 | //+============================================================================= 33 | #if SEND_DISH 34 | void IRsend::sendDISH (unsigned long data, int nbits) 35 | { 36 | // Set IR carrier frequency 37 | enableIROut(56); 38 | 39 | mark(DISH_HDR_MARK); 40 | space(DISH_HDR_SPACE); 41 | 42 | for (unsigned long mask = 1UL << (nbits - 1); mask; mask >>= 1) { 43 | if (data & mask) { 44 | mark(DISH_BIT_MARK); 45 | space(DISH_ONE_SPACE); 46 | } else { 47 | mark(DISH_BIT_MARK); 48 | space(DISH_ZERO_SPACE); 49 | } 50 | } 51 | } 52 | #endif 53 | 54 | -------------------------------------------------------------------------------- /Module 2/Chapter08/Chapter8-Software/Arduino-IRremote-master/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map For IRremote 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | decode_results KEYWORD1 10 | IRrecv KEYWORD1 11 | IRsend KEYWORD1 12 | 13 | ####################################### 14 | # Methods and Functions (KEYWORD2) 15 | ####################################### 16 | 17 | blink13 KEYWORD2 18 | decode KEYWORD2 19 | enableIRIn KEYWORD2 20 | resume KEYWORD2 21 | enableIROut KEYWORD2 22 | sendNEC KEYWORD2 23 | sendSony KEYWORD2 24 | sendSanyo KEYWORD2 25 | sendMitsubishi KEYWORD2 26 | sendRaw KEYWORD2 27 | sendRC5 KEYWORD2 28 | sendRC6 KEYWORD2 29 | sendDISH KEYWORD2 30 | sendSharp KEYWORD2 31 | sendSharpRaw KEYWORD2 32 | sendPanasonic KEYWORD2 33 | sendJVC KEYWORD2 34 | 35 | # 36 | ####################################### 37 | # Constants (LITERAL1) 38 | ####################################### 39 | 40 | NEC LITERAL1 41 | SONY LITERAL1 42 | SANYO LITERAL1 43 | MITSUBISHI LITERAL1 44 | RC5 LITERAL1 45 | RC6 LITERAL1 46 | DISH LITERAL1 47 | SHARP LITERAL1 48 | PANASONIC LITERAL1 49 | JVC LITERAL1 50 | LG LITERAL1 51 | AIWA_RC_T501 LITERAL1 52 | UNKNOWN LITERAL1 53 | REPEAT LITERAL1 54 | -------------------------------------------------------------------------------- /Module 2/Chapter08/Chapter8-Software/Arduino-IRremote-master/library.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "IRremote", 3 | "keywords": "infrared, ir, remote", 4 | "description": "Send and receive infrared signals with multiple protocols", 5 | "repository": 6 | { 7 | "type": "git", 8 | "url": "https://github.com/shirriff/Arduino-IRremote.git" 9 | }, 10 | "frameworks": "arduino", 11 | "platforms": "atmelavr" 12 | } 13 | -------------------------------------------------------------------------------- /Module 2/Chapter08/Chapter8-Software/Arduino-IRremote-master/library.properties: -------------------------------------------------------------------------------- 1 | name=IRremote 2 | version=1.0 3 | author=shirriff 4 | maintainer=shirriff 5 | sentence=Send and receive infrared signals with multiple protocols 6 | paragraph=Send and receive infrared signals with multiple protocols 7 | category=Signal Input/Output 8 | url=https://github.com/shirriff/Arduino-IRremote.git 9 | architectures=* 10 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # IoT Building Arduino based Projects 2 | IoT Building Arduino based Projects by Packt 3 | 4 | ##What You Will Learn: 5 | * Know the capabilities and limitations of the HTTP, UPnP, CoAP, MQTT, and XMPP protocols 6 | * Use important communication patterns, such as the request/respond, publish/subscribe, event subscription, asynchronous messaging, and multicasting patterns 7 | * Build a portable Wi-Fi signal strength sensor to give haptic feedback about signal strength to the user 8 | * Measure water flow speed and volume with liquid flow sensors and record real-time readings 9 | * Secure your home with motion-activated Arduino security cameras and upload images to the cloud 10 | * Implement real-time data logging of a solar panel voltage with Arduino cloud connectors 11 | * Track locations with GPS and upload location data to the cloud 12 | * Control a garage door light with your Twitter feed 13 | * Control infrared enabled devices with IR remote and Arduino 14 | * Use Systems Security Engineering and Privacy-by-design principles to design a secure IoT ecosystem 15 | * Get to know how to leverage the burdgening cloud-based systems that will support the IoT into the future. 16 | 17 | ### Note 18 | Modules 1 and 2 have code arranged by chapter (for the chapters that have code). [Click here](https://docs.google.com/forms/d/e/1FAIpQLSe5qwunkGf6PUvzPirPDtuy1Du5Rlzew23UBp2S-P3wB-GcwQ/viewform) if you have any feedback or suggestions. 19 | --------------------------------------------------------------------------------