├── src ├── LoriotAzureFunctions │ ├── host.json │ ├── DeviceProvisioning │ │ ├── ScheduledImportDevice.cs │ │ ├── ImportDevice.cs │ │ ├── ExportDevice.cs │ │ ├── IotHubClient.cs │ │ └── LoriotClient.cs │ ├── LoriotAzureFunctions.csproj │ ├── Decoders │ │ ├── SensorDecoderButton.cs │ │ ├── SensorDecoderWeather.cs │ │ └── SensorDecoderGps.cs │ ├── DeviceInactiveFunction │ │ └── GetInactiveDevices.cs │ ├── SetupFunction │ │ └── SetupFunction.cs │ ├── .gitignore │ └── Route │ │ └── RouteFunction.cs ├── LoriotAzureStreamAnalytics │ ├── JobConfig.json │ ├── Script.asaql │ ├── Inputs │ │ └── Input.json │ ├── Outputs │ │ ├── OutputSqlDB.json │ │ └── Output.json │ └── LoriotAzureStreamAnalytics.asaproj └── AzureSolutionTemplate.sln ├── .deployment ├── power-bi ├── Images │ ├── APIURL.png │ ├── APIAuth.png │ ├── AddTile.PNG │ ├── Publish.PNG │ ├── TileDemo.PNG │ ├── CancelLoad.PNG │ ├── CosmosKey.png │ ├── EditSource.png │ ├── FinalResult.png │ ├── LoadFailed.PNG │ ├── OpenSource.PNG │ ├── RenewAuth.png │ ├── CosmosDetails.PNG │ ├── QueryEditor1.png │ ├── RepeatProcess.PNG │ ├── ReportsPortal.PNG │ ├── ResourceGroup.PNG │ ├── CancelCosmosAuth.PNG │ ├── ConfigureTile1.PNG │ ├── ConfigureTile2.PNG │ ├── ConfigureTile3.PNG │ ├── GetFunctionURL.PNG │ ├── ManageResources.PNG │ ├── OpenQueryEditor.PNG │ ├── StreamAnalytics1.png │ ├── StreamAnalytics2.PNG │ ├── GetFunctionDetails.PNG │ └── PowerBIStreamingDataset.PNG ├── IoTDashboard.pbit └── README.md ├── test ├── Images │ └── AddDevice.png ├── sendsensordata.ps1 ├── getTestData.js └── README.md ├── images ├── DeviceTwinAddTags.png └── LoriotArchitecture.png ├── LoraIoTHubTestTool ├── LoraIoTHubTestTool │ ├── Connected Services │ │ └── LoraTesthub │ │ │ └── ConnectedService.json │ ├── RandomExtension.cs │ ├── StringToHex.cs │ ├── LoraIoTHubTestTool.csproj │ ├── AzureIoTHub.cs │ └── Program.cs ├── LoraIoTHubTestTool.sln └── README.md ├── sample-decoder ├── function.json └── index.js ├── azuredeploy.parameters.json ├── function.json ├── .gitattributes ├── .gitignore ├── README.md └── azuredeploy.json /src/LoriotAzureFunctions/host.json: -------------------------------------------------------------------------------- 1 | { 2 | } -------------------------------------------------------------------------------- /.deployment: -------------------------------------------------------------------------------- 1 | [config] 2 | project = src/LoriotAzureFunctions/LoriotAzureFunctions.csproj -------------------------------------------------------------------------------- /power-bi/Images/APIURL.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tikyau/AzureSolutionTemplate/master/power-bi/Images/APIURL.png -------------------------------------------------------------------------------- /power-bi/IoTDashboard.pbit: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tikyau/AzureSolutionTemplate/master/power-bi/IoTDashboard.pbit -------------------------------------------------------------------------------- /test/Images/AddDevice.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tikyau/AzureSolutionTemplate/master/test/Images/AddDevice.png -------------------------------------------------------------------------------- /images/DeviceTwinAddTags.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tikyau/AzureSolutionTemplate/master/images/DeviceTwinAddTags.png -------------------------------------------------------------------------------- /power-bi/Images/APIAuth.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tikyau/AzureSolutionTemplate/master/power-bi/Images/APIAuth.png -------------------------------------------------------------------------------- /power-bi/Images/AddTile.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tikyau/AzureSolutionTemplate/master/power-bi/Images/AddTile.PNG -------------------------------------------------------------------------------- /power-bi/Images/Publish.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tikyau/AzureSolutionTemplate/master/power-bi/Images/Publish.PNG -------------------------------------------------------------------------------- /power-bi/Images/TileDemo.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tikyau/AzureSolutionTemplate/master/power-bi/Images/TileDemo.PNG -------------------------------------------------------------------------------- /images/LoriotArchitecture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tikyau/AzureSolutionTemplate/master/images/LoriotArchitecture.png -------------------------------------------------------------------------------- /power-bi/Images/CancelLoad.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tikyau/AzureSolutionTemplate/master/power-bi/Images/CancelLoad.PNG -------------------------------------------------------------------------------- /power-bi/Images/CosmosKey.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tikyau/AzureSolutionTemplate/master/power-bi/Images/CosmosKey.png -------------------------------------------------------------------------------- /power-bi/Images/EditSource.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tikyau/AzureSolutionTemplate/master/power-bi/Images/EditSource.png -------------------------------------------------------------------------------- /power-bi/Images/FinalResult.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tikyau/AzureSolutionTemplate/master/power-bi/Images/FinalResult.png -------------------------------------------------------------------------------- /power-bi/Images/LoadFailed.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tikyau/AzureSolutionTemplate/master/power-bi/Images/LoadFailed.PNG -------------------------------------------------------------------------------- /power-bi/Images/OpenSource.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tikyau/AzureSolutionTemplate/master/power-bi/Images/OpenSource.PNG -------------------------------------------------------------------------------- /power-bi/Images/RenewAuth.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tikyau/AzureSolutionTemplate/master/power-bi/Images/RenewAuth.png -------------------------------------------------------------------------------- /power-bi/Images/CosmosDetails.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tikyau/AzureSolutionTemplate/master/power-bi/Images/CosmosDetails.PNG -------------------------------------------------------------------------------- /power-bi/Images/QueryEditor1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tikyau/AzureSolutionTemplate/master/power-bi/Images/QueryEditor1.png -------------------------------------------------------------------------------- /power-bi/Images/RepeatProcess.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tikyau/AzureSolutionTemplate/master/power-bi/Images/RepeatProcess.PNG -------------------------------------------------------------------------------- /power-bi/Images/ReportsPortal.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tikyau/AzureSolutionTemplate/master/power-bi/Images/ReportsPortal.PNG -------------------------------------------------------------------------------- /power-bi/Images/ResourceGroup.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tikyau/AzureSolutionTemplate/master/power-bi/Images/ResourceGroup.PNG -------------------------------------------------------------------------------- /power-bi/Images/CancelCosmosAuth.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tikyau/AzureSolutionTemplate/master/power-bi/Images/CancelCosmosAuth.PNG -------------------------------------------------------------------------------- /power-bi/Images/ConfigureTile1.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tikyau/AzureSolutionTemplate/master/power-bi/Images/ConfigureTile1.PNG -------------------------------------------------------------------------------- /power-bi/Images/ConfigureTile2.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tikyau/AzureSolutionTemplate/master/power-bi/Images/ConfigureTile2.PNG -------------------------------------------------------------------------------- /power-bi/Images/ConfigureTile3.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tikyau/AzureSolutionTemplate/master/power-bi/Images/ConfigureTile3.PNG -------------------------------------------------------------------------------- /power-bi/Images/GetFunctionURL.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tikyau/AzureSolutionTemplate/master/power-bi/Images/GetFunctionURL.PNG -------------------------------------------------------------------------------- /power-bi/Images/ManageResources.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tikyau/AzureSolutionTemplate/master/power-bi/Images/ManageResources.PNG -------------------------------------------------------------------------------- /power-bi/Images/OpenQueryEditor.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tikyau/AzureSolutionTemplate/master/power-bi/Images/OpenQueryEditor.PNG -------------------------------------------------------------------------------- /power-bi/Images/StreamAnalytics1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tikyau/AzureSolutionTemplate/master/power-bi/Images/StreamAnalytics1.png -------------------------------------------------------------------------------- /power-bi/Images/StreamAnalytics2.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tikyau/AzureSolutionTemplate/master/power-bi/Images/StreamAnalytics2.PNG -------------------------------------------------------------------------------- /power-bi/Images/GetFunctionDetails.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tikyau/AzureSolutionTemplate/master/power-bi/Images/GetFunctionDetails.PNG -------------------------------------------------------------------------------- /power-bi/Images/PowerBIStreamingDataset.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tikyau/AzureSolutionTemplate/master/power-bi/Images/PowerBIStreamingDataset.PNG -------------------------------------------------------------------------------- /LoraIoTHubTestTool/LoraIoTHubTestTool/Connected Services/LoraTesthub/ConnectedService.json: -------------------------------------------------------------------------------- 1 | { 2 | "ProviderId": "Microsoft.AzureIoTHubService", 3 | "Version": "1.8.0", 4 | "GettingStartedDocument": { 5 | "Uri": "http://aka.ms/azure-iot-hub-vs-cs-2017-cs" 6 | } 7 | } -------------------------------------------------------------------------------- /sample-decoder/function.json: -------------------------------------------------------------------------------- 1 | { 2 | "bindings": [ 3 | { 4 | "name": "req", 5 | "type": "httpTrigger", 6 | "direction": "in", 7 | "authLevel": "function" 8 | }, 9 | { 10 | "name": "res", 11 | "type": "http", 12 | "direction": "out" 13 | } 14 | ] 15 | } -------------------------------------------------------------------------------- /src/LoriotAzureStreamAnalytics/JobConfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "DataLocale": "en-US", 3 | "OutputErrorPolicy": "Drop", 4 | "EventsLateArrivalMaxDelayInSeconds": 5, 5 | "EventsOutOfOrderMaxDelayInSeconds": 0, 6 | "EventsOutOfOrderPolicy": "Adjust", 7 | "StreamingUnits": 1, 8 | "ScriptType": "JobConfig" 9 | } 10 | -------------------------------------------------------------------------------- /sample-decoder/index.js: -------------------------------------------------------------------------------- 1 | module.exports = function(context, req) { 2 | if (!req.body.data) { 3 | context.res = { 4 | 'error': 'No data found' 5 | }; 6 | context.done(); 7 | return; 8 | } 9 | 10 | var data = Buffer.from(req.body.data, 'hex').toString(); 11 | context.log(data); 12 | var split = data.split(':'); 13 | context.res = { 14 | 'temperature': parseFloat(split[0]), 15 | 'humidity': parseFloat(split[1]) 16 | }; 17 | context.done(); 18 | }; 19 | -------------------------------------------------------------------------------- /LoraIoTHubTestTool/LoraIoTHubTestTool/RandomExtension.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace LoraIoTHubTestTool 6 | { 7 | public static class RandomExtensions 8 | { 9 | public static double NextDouble( 10 | this Random random, 11 | double minValue, 12 | double maxValue) 13 | { 14 | return random.NextDouble() * (maxValue - minValue) + minValue; 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /LoraIoTHubTestTool/LoraIoTHubTestTool/StringToHex.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace LoraIoTHubTestTool 6 | { 7 | class StringToHex 8 | { 9 | 10 | public static string ConvertToHex(string stringToConvert) 11 | { 12 | StringBuilder sb = new StringBuilder(); 13 | foreach (char t in stringToConvert) 14 | sb.Append(Convert.ToInt32(t).ToString("x")); 15 | return sb.ToString(); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /azuredeploy.parameters.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | "uniqueSolutionPrefix": { 6 | "value":"uniqueprefix" 7 | }, 8 | "pbiDatasetName": { 9 | "value":"livedataset" 10 | }, 11 | "powerBIDeploy": { 12 | "value":"true" 13 | }, 14 | "timeSeriesInsightDeploy":{ 15 | "value": "true" 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /test/sendsensordata.ps1: -------------------------------------------------------------------------------- 1 | Param($Hostname, $SharedAccessKeyName, $SharedAccessKey, $DeviceId, $SendCount) 2 | 3 | For ($i=0; $i -lt $SendCount; $i++) { 4 | $data= node getTestData.js 5 | 6 | #Hack: on send the " is replaced with ' works, don't ask me why 7 | $data = $data.replace('"', "'") 8 | 9 | $connection = "HostName=" + $Hostname + ";SharedAccessKeyName=" + $SharedAccessKeyName + ";SharedAccessKey="+ $SharedAccessKey 10 | $connection 11 | iothub-explorer --login $connection simulate-device $DeviceId --send $data --send-count 1 12 | } -------------------------------------------------------------------------------- /test/getTestData.js: -------------------------------------------------------------------------------- 1 | var temperature = Math.random() * (25 - 20) + 20; 2 | var data = temperature.toFixed(2) + ':36.21'; 3 | var timestamp = Date.now(); 4 | 5 | var testData = { 6 | 'cmd': 'rx', 7 | 'seqno': 1854, 8 | 'EUI': 'BE7A00000000190F', 9 | 'ts': timestamp, 10 | 'fcnt': 27, 11 | 'port': 1, 12 | 'freq': 867100000, 13 | 'rssi': -25, 14 | 'snr': 10, 15 | 'toa': 61, 16 | 'dr': 'SF7', 17 | 'ack': false, 18 | 'bat': 255, 19 | 'data': Buffer.from(data).toString('hex') 20 | }; 21 | 22 | console.log(JSON.stringify(testData)); 23 | -------------------------------------------------------------------------------- /src/LoriotAzureStreamAnalytics/Script.asaql: -------------------------------------------------------------------------------- 1 | SELECT raw.EUI as eui, * 2 | INTO 3 | [CosmosDB] 4 | FROM 5 | [EventHub] 6 | 7 | SELECT MessageGUID, raw.EUI as eui, decoded.temperature as temperature, decoded.humidity as humidity, raw.ts as ts 8 | INTO 9 | [SQLDB] 10 | FROM 11 | [EventHub] 12 | WHERE metadata.sensorDecoder = 'SensorDecoderWeather' 13 | 14 | SELECT MessageGUID, raw.EUI as eui, decoded.temperature as temperature, decoded.humidity as humidity, raw.ts as ts, EventEnqueuedUtcTime as time 15 | INTO 16 | [PowerBI] 17 | FROM 18 | [EventHub] 19 | WHERE metadata.sensorDecoder = 'SensorDecoderWeather' -------------------------------------------------------------------------------- /src/LoriotAzureStreamAnalytics/Inputs/Input.json: -------------------------------------------------------------------------------- 1 | { 2 | "Name": "loramessageeventhub", 3 | "Type": "Data Stream", 4 | "DataSourceType": "Event Hub", 5 | "Sample": null, 6 | "EventHubProperties": { 7 | "ConsumerGroupName": "LoraStreamAnalyticsConsumer", 8 | "EventHubName": "loramessageeventhub", 9 | "ServiceBusNamespace": "LoraEventHub", 10 | "SharedAccessPolicyKey": null, 11 | "SharedAccessPolicyName": "RootManageSharedAccessKey" 12 | }, 13 | "BlobStorageProperties": null, 14 | "IoTHubProperties": null, 15 | "BlobReferenceProperties": null, 16 | "Serialization": { 17 | "Encoding": "UTF8", 18 | "Type": "Json", 19 | "FieldDelimiter": null, 20 | "Format": null 21 | }, 22 | "DataSourceCredentialDomain": "4acdf695-ff40-46ec-b234-119701c13493.StreamAnalyticsCredential", 23 | "ScriptType": "Input" 24 | } -------------------------------------------------------------------------------- /src/LoriotAzureStreamAnalytics/Outputs/OutputSqlDB.json: -------------------------------------------------------------------------------- 1 | { 2 | "Name": "lorasqldb", 3 | "DataSourceType": "SQL Database", 4 | "EventHubProperties": null, 5 | "BlobStorageProperties": null, 6 | "SQLDatabaseProperties": { 7 | "Database": "[YOURDATABASENAME]", 8 | "Password": null, 9 | "Server": "[YOURDATABASESERVER]", 10 | "Table": "[YOURTABLE]", 11 | "User": "[YOURDBUSER]" 12 | }, 13 | "TableStorageProperties": null, 14 | "ServiceBusQueueProperties": null, 15 | "ServiceBusTopicProperties": null, 16 | "DocumentDbProperties": null, 17 | "Serialization": { 18 | "Encoding": "UTF8", 19 | "Type": "Json", 20 | "FieldDelimiter": null, 21 | "Format": "LineSeparated" 22 | }, 23 | "DataSourceCredentialDomain": "1b035d21-2bf9-48f7-83f6-447d52b76d8f.StreamAnalyticsCredential", 24 | "ScriptType": "Output" 25 | } -------------------------------------------------------------------------------- /src/LoriotAzureStreamAnalytics/Outputs/Output.json: -------------------------------------------------------------------------------- 1 | { 2 | "Name": "loracosmosdb", 3 | "DataSourceType": "DocumentDB", 4 | "EventHubProperties": null, 5 | "BlobStorageProperties": null, 6 | "SQLDatabaseProperties": null, 7 | "TableStorageProperties": null, 8 | "ServiceBusQueueProperties": null, 9 | "ServiceBusTopicProperties": null, 10 | "DocumentDbProperties": { 11 | "AccountId": "[YOURCOSMOSDBACCOUNT]", 12 | "AccountKey": null, 13 | "CollectionNamePattern": "[YOURCOSMOSCOLLECTIONNAME]", 14 | "Database": "[YOURCOSMOSDBNAME]", 15 | "DocumentId": null, 16 | "PartitionKey": null 17 | }, 18 | "Serialization": { 19 | "Encoding": "UTF8", 20 | "Type": "Json", 21 | "FieldDelimiter": null, 22 | "Format": "LineSeparated" 23 | }, 24 | "DataSourceCredentialDomain": "8b8769cb-c2ae-4ab6-989f-dcd170f3eac0.StreamAnalyticsCredential", 25 | "ScriptType": "Output" 26 | } -------------------------------------------------------------------------------- /src/LoriotAzureFunctions/DeviceProvisioning/ScheduledImportDevice.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.Azure.WebJobs; 3 | using Microsoft.Azure.WebJobs.Host; 4 | using System.Net.Http; 5 | using System.Threading.Tasks; 6 | 7 | namespace LoriotAzureFunctions.DeviceProvisioning 8 | { 9 | public static class ScheduledImportDevice 10 | { 11 | [FunctionName("ScheduledImportDevice")] 12 | public static async Task Run([TimerTrigger("%DEVICE_LIFECYCLE_IMPORT_TIMER%")]TimerInfo timer, TraceWriter log) 13 | { 14 | log.Info($"Import started at {DateTime.Now}"); 15 | long importedItemCount = 0; 16 | try 17 | { 18 | importedItemCount = await IotHubClient.ImportDevice(log); 19 | } 20 | catch (HttpRequestException httpRequestEx) 21 | { 22 | 23 | } 24 | 25 | log.Info($"Imported {importedItemCount} new devices to Azure Iot Hub at {DateTime.Now}"); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /function.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | "solutionPrefix": { 6 | "type": "string", 7 | "metadata": { 8 | "description": "Prefix used in resource names. Should be unique enough since this ends up being used also in domain names." 9 | } 10 | } 11 | }, 12 | "variables": {}, 13 | "resources": [ 14 | { 15 | "name": "deployFunction", 16 | "type": "Microsoft.Resources/deployments", 17 | "apiVersion": "2014-04-01-preview", 18 | "properties": { 19 | "mode": "Incremental", 20 | "templateLink": { 21 | "uri": "[listsecrets(resourceId('Microsoft.Web/sites/functions', concat(parameters('solutionPrefix'), 'function'), 'Setup'),'2015-08-01').trigger_url]", 22 | "contentVersion": "1.0.0.0" 23 | } 24 | } 25 | } 26 | ] 27 | } -------------------------------------------------------------------------------- /src/LoriotAzureFunctions/LoriotAzureFunctions.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | net461 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | PreserveNewest 19 | 20 | 21 | PreserveNewest 22 | Never 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /LoraIoTHubTestTool/LoraIoTHubTestTool.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.26730.15 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LoraIoTHubTestTool", "LoraIoTHubTestTool\LoraIoTHubTestTool.csproj", "{39435DD3-A4F0-4B52-A3C5-FB829E4A5878}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {39435DD3-A4F0-4B52-A3C5-FB829E4A5878}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {39435DD3-A4F0-4B52-A3C5-FB829E4A5878}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {39435DD3-A4F0-4B52-A3C5-FB829E4A5878}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {39435DD3-A4F0-4B52-A3C5-FB829E4A5878}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {50D047FD-FB02-4A11-B4F6-E970E267B6C7} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /src/LoriotAzureFunctions/DeviceProvisioning/ImportDevice.cs: -------------------------------------------------------------------------------- 1 | using System.Net; 2 | using Newtonsoft.Json; 3 | using System.Net.Http; 4 | using System.Threading.Tasks; 5 | using Microsoft.Azure.WebJobs; 6 | using Microsoft.Azure.WebJobs.Extensions.Http; 7 | using Microsoft.Azure.WebJobs.Host; 8 | using Microsoft.Azure.Devices; 9 | using System.Collections.Generic; 10 | 11 | namespace LoriotAzureFunctions.DeviceProvisioning 12 | { 13 | public static class ImportDevice 14 | { 15 | [FunctionName("ImportDevice")] 16 | public static async Task Run([HttpTrigger]HttpRequestMessage req, TraceWriter log) 17 | { 18 | log.Info("Import started from http trigger"); 19 | long importedItemCount = 0; 20 | try 21 | { 22 | importedItemCount = await IotHubClient.ImportDevice(log); 23 | } 24 | catch(HttpRequestException httpRequestEx) 25 | { 26 | return req.CreateResponse(HttpStatusCode.InternalServerError, new 27 | { 28 | error = "Internal Server Error" 29 | }); 30 | } 31 | 32 | return req.CreateResponse(HttpStatusCode.OK, new 33 | { 34 | message = $"Imported {importedItemCount} new devices to Azure Iot Hub" 35 | }); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /LoraIoTHubTestTool/LoraIoTHubTestTool/LoraIoTHubTestTool.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | netcoreapp2.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /src/AzureSolutionTemplate.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.26730.16 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{E6C563F2-BDC2-4A24-ACBF-01715157DCBB}") = "LoriotAzureStreamAnalytics", "LoriotAzureStreamAnalytics\LoriotAzureStreamAnalytics.asaproj", "{24129473-F264-464D-913F-44F93E902784}" 7 | EndProject 8 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LoriotAzureFunctions", "LoriotAzureFunctions\LoriotAzureFunctions.csproj", "{420322C3-D4BE-447E-B64A-BFD409EEE68F}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Any CPU = Debug|Any CPU 13 | Release|Any CPU = Release|Any CPU 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {24129473-F264-464D-913F-44F93E902784}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 17 | {24129473-F264-464D-913F-44F93E902784}.Debug|Any CPU.Build.0 = Debug|Any CPU 18 | {24129473-F264-464D-913F-44F93E902784}.Release|Any CPU.ActiveCfg = Release|Any CPU 19 | {24129473-F264-464D-913F-44F93E902784}.Release|Any CPU.Build.0 = Release|Any CPU 20 | {420322C3-D4BE-447E-B64A-BFD409EEE68F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 21 | {420322C3-D4BE-447E-B64A-BFD409EEE68F}.Debug|Any CPU.Build.0 = Debug|Any CPU 22 | {420322C3-D4BE-447E-B64A-BFD409EEE68F}.Release|Any CPU.ActiveCfg = Release|Any CPU 23 | {420322C3-D4BE-447E-B64A-BFD409EEE68F}.Release|Any CPU.Build.0 = Release|Any CPU 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {8625DB90-CAD4-4AAF-A94F-909345226351} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /src/LoriotAzureStreamAnalytics/LoriotAzureStreamAnalytics.asaproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | Debug 4 | 2.0 5 | 24129473-f264-464d-913f-44f93e902784 6 | File 7 | LoriotAzureStreamAnalytics 8 | Script.asaql 9 | v4.6.1 10 | $(AppData)\Microsoft\DataLake\MsBuild\1.0\StreamAnalytics.targets 11 | LoriotAzureStreamAnalytics 12 | LoriotAzureStreamAnalytics 13 | 14 | 15 | true 16 | bin\Debug\ 17 | 18 | 19 | false 20 | bin\Release\ 21 | 22 | 23 |