Experience in creating a cloud solution for monitoring a digital kiosk on Azure IoT Central

About the task



One of our clients has a lot of self-service kiosks in different stores across the country. An infokiosk is a computer in the form of a rack with a monitor, the task of which is to give a person information about something. Show the route somewhere in the mall, help you choose something from the product catalog, and so on. An infokiosk is not necessarily a stand-alone computer, it can be built into a coffee machine or even a sanitizer. Food order terminals in fast food restaurants are also info kiosks.



The usual desire of the owner of information kiosks is to understand what exactly is happening at the moment, whether the kiosk is working or not, in what state it is. For example, is there water in the coffee machine? If so, what is its stock?



In our case, the task of the info kiosk is just to help a person who comes up to choose a product from the catalog and print a barcode for subsequent payment for this product at the checkout.

The problem lies in the fact that such solutions often do not have a notification system for stopping work for various reasons. For example, a kiosk sometimes runs out of a check tape, a connection falls off, some kind of failure occurs, and while the store staff notices this, potential customers will pass by (at best), or even ridicule the negligent entrepreneur in the networks.





, , , ( ). , , . , , , . !



«». , , , - . , , , , , , , , .



(« ?») «» :



  • , ?
  • , ? (, «SLA »)
  • ?


, , , , . , , , .



, , . – «». . «» - , .



— ( , ), — , email HelpDesk. «», – ( ) .



, «» , .



, , , . , , .



« »?



« » 20 . , , : , , .



20 – , , . . Microsoft, Microsoft, , . Microsoft, :



  • Microsoft IoT . PaaS, SaaS;
  • Microsoft Azure, ( !) . , ;
  • , , ;
  • . , , ;
  • ;
  • – ( ), , .


? , , , , .. , . « » – -. - , - . , , «», .



« » .



  1. , , . , . , , , , . , , . , , ? , , USB , .
  2. , (CapEx, ) , , (.. , OpEx).
  3. , , . Microsoft, , best practices, .. Design Sessions ( .. ), , . , , ?


, « » , , . , , : , « ». , , ( , «» ). , , , , , .



, -, .





Windows 10 IoT Enterprise LTSC (Long-term Servicing Channel). 10 , , , , , . . (https://www.quarta-embedded.ru/we/10/, https://habr.com/ru/company/quarta/blog/279521/), 3 «» .



, , .. , , «» ( : « ») .



Windows 10 IoT Enterprise LTSC Microsoft, , . , , Windows, , , Visual Studio.



, «» -, Microsoft IoT Central. , , , .



, , OEM-, , , , , : OEM- , . , . - -.



, .





:





, IoT Central , , , .



SaaS- IoT Central?



  • , ;
  • , ;
  • : , , ;
  • ( 30 );
  • : , . ;
  • ;
  • ;
  • , ;
  • , , ;
  • .


, IoT Central , : SDK . , , . . , .



Azure ( 5 ) IoT Central www.azureiotcentral.com, «» , «», .. .





«» « 1». « 2». «», – 4 . IoT Central JSON, .. , «» . 4 , .



« » «Custom application», «Custom Application (legacy)». Legacy- , , , .



IoT Central .azureiotcentral.com.

:





. IoT Central , .. . , , , , . . , , , « ».



: , , , – . , , , , - «»: .

:





IoT Central « ». . – - , / , . IoT Central , , «» «».



:



  • Device capability model (DCM): – , IoT Central, ;
  • Cloud properties: , , , (, - );
  • Customizations: «» , DCM, , ;
  • Views: , , .


DCM , , , :



  • , .. , ;
  • , , . , ;
  • , ( ).


. – IoT Central JSON .



, . .



IoT Central. JSON.



DCM :



  • Device Information: , , ..
  • Printer: , , ( ), ;
  • Paper: – , , ;
  • Performance: , «» : , ;
  • Commands: . , , .


(Views), , . , :





. , - , ( «»), , . «».



, « » «» :





, .



«» , «».



, .





, . .



«» . (. SampleApp.cs).



, . «», «» , « » « URL- (SAS)» « » SampleApp.cs:



static string scopeId = "...";
static string deviceId = "...";
static string key = "...";


Visual Studio . . , / .



:



  • SAS (Shared Access Signature), , , . . , «» ;
  • , «» , («Provisioning») , . , . , .


, . String.Format() Double JSON IoT Central. , , «,» «.», IoT Central . . , , telemetryStateEvent*.cs



String.Format(...)




String.Format(CultureInfo.InvariantCulture, ...)




using System.Globalization;


, , , .



, , . SaaS: .



, . , , , 9 .



«»



, , . , «», .



. 30 . : , .. , 5 , ( ) , .. . 30 000 / 4 = 7500 , , 250, 10 , 6 . 5 . :



  • ( ), .. 60 , 40, 20, ;
  • , 10 .


, .. . , , , .



, - , : , , «» . , , , , - .



, , ( !) , : . ( , – ) . .



, :



  • . WMI PerformanceCounter.

    :


public static string OSFriendlyName
{
    get
    {
        string result = string.Empty;
        ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT Caption FROM Win32_OperatingSystem");
        foreach (ManagementObject os in searcher.Get())
        {
            result = os["Caption"].ToString();
            break;
        }
        return result;
    }
}


:



PerformanceCounter cpuCounter = new PerformanceCounter("Processor", "% Processor Time", "_Total");


:



cpuCounter.NextValue();


, .

WMI .



  • . , , USB . , :


PrintServer ps = new PrintServer();
pq = ps.GetPrintQueue(name);


,



pq.HasPaperProblem


  • , .
  • , IoT Central. -, , , , .




-, , - , , SAS, . , , , - .



IoT Central – Device Provisioning Service (DPS), :



  1. (Device ID), , . IoT Central , .
  2. (Scope ID). DPS IoT Hub, IoT Central, URL . , , SDK .
  3. . Base64.


DPS (connection.cs) :



using (var security = new SecurityProviderSymmetricKey(deviceId, deviceKey, deviceKey))
using (var transport = new ProvisioningTransportHandlerAmqp(TransportFallbackType.TcpOnly))
{
    var provClient = ProvisioningDeviceClient.Create("global.azure-devices-provisioning.net", scopeId, security, transport);
    DeviceRegistrationResult result = await provClient.RegisterAsync().ConfigureAwait(false);
    ...


( ) X.509, , , .



, SAS, , , . , SAS HMAC SHA256 , «» SAS. C# :



var hmac = new HMACSHA256(Convert.FromBase64String(sas_key));
var sig = hmac.ComputeHash(Encoding.ASCII.GetBytes(device_id));


sig , .



. , , . , , – DPAPI. , / . .., - – .



DPAPI .



, , «» IoT Central. :



  1. IoT Central «» — « » « » :




: IoT Central , , . IoT Central, , .2.



  1. connection.cs


var provClient = ProvisioningDeviceClient.Create("global.azure-devices-provisioning.net", scopeId, security, transport);
DeviceRegistrationResult result = await provClient.RegisterAsync().ConfigureAwait(false);


, JSON :



var data = new ProvisioningRegistrationAdditionalData();
data.JsonData = "{ \"iotcModelId\": \"URI\" }";
DeviceRegistrationResult result = await provClient.RegisterAsync(data).ConfigureAwait(false);


URI – . , IoT Central JSON .



"@id": "URI"


URI.



: Plug-and-Play . – SDK . .



, , . DPS? MAC- , , ? ( SAS) ? , .



, , , , « » , , SAS, « » .



Azure Functions: , . Azure Active Directory, Azure Key Vault. , , -, , . , :





. ( SDK ), (Device ID), , (Device Key) (Scope ID).



- 24/7



- , , . : .



- Windows, . , :



  1. , - .
  2. , .
  3. .


, .



-, . :



  1. - IoT Central , . .
  2. - , , « » ( ) .
  3. , . « » , , -.
  4. , .
  5. IoT Central.


, , .





– , – , .



, , . , ( – ), (, ).



, , IoT Central , . , , .





, , IoT Central . . .. , , IoT Central, , , .



, , . , , - . - , . - . .





, , - IPC.



, : -. , IoT Central , .





«» :



  • - IoT Central, , ;
  • Windows, IoT Central;
  • , -, . . Azure;
  • , - . , , IoT Central.


IoT Central Azure Functions, .



– . . :



  1. .
  2. . – , .
  3. , .
  4. , , , .


, .



.



, «» , :







IoT Central , .



«» . :





«» . , , . , .



, « », .





«» :





:





, . , , . .



IoT Central, , , , - . , - , , . – . , PaaS, , , , .



? ,



, . . , , - . , , - , , .



, IoT Central. . :



  1. , .. .
  2. . , , (, ), (, ..), , .
  3. . – . - , - (Azure Functions, Microsoft Flow, Azure Logic Apps, ) Azure Monitor.


, «Template», 80%, 45 ().





, , :





, .



. , « » 5 , « ». , 15 :





IoT Central .



.



« » «Template», « ». 31 2 . , , , , « ».







. , 1 17.00 , , . 1 E-mail , « > 80%».



, , e-mail, , « » — « ».



?



. , . , 10 , .



. «» :





, , : , . .





IoT Central 30 . , . «» «»:





BLOB-:





Azure, , . , .



, , , .



BLOB- Azure, (.. «», Azure Functions : https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-storage-blob) . Azure , , -, « » , « » — ( ), IoT Central .





– , , IoT Central , .., , Power BI.





SaaS, .



, , , . .



. , , :



  • X.509 ;
  • - IoT Central;
  • DCM ;
  • IoT Edge -. IoT Edge – , «», .. . IoT Edge ;
  • , , , SaaS.


, . , : IoT Central 50 . .



Pricing Calculator, , .



, . .



: , . sergant (at) quarta.ru.




All Articles