Erfahrung in der Erstellung einer Cloud-Lösung zur Überwachung eines digitalen Kiosks in Azure IoT Central

Über die Aufgabe



Einer unserer Kunden hat viele Selbstbedienungskioske in verschiedenen Geschäften im ganzen Land. Ein Infokiosk ist ein Computer in Form eines Racks mit einem Monitor, dessen Aufgabe es ist, einer Person Informationen über etwas zu geben. Zeigen Sie die Route irgendwo in der Mall an, helfen Sie bei der Auswahl von Produkten aus dem Produktkatalog usw. Ein Infokiosk ist nicht unbedingt ein eigenständiger Computer, er kann in eine Kaffeemaschine oder sogar in ein Desinfektionsmittel eingebaut werden. Lebensmittelbestellungsterminals in Fast-Food-Restaurants sind ebenfalls Info-Kioske.



Der übliche Wunsch des Besitzers von Informationskiosken besteht darin, zu verstehen, was genau im Moment passiert, ob der Kiosk funktioniert oder nicht, in welchem ​​Zustand er sich befindet. Befindet sich beispielsweise Wasser in der Kaffeemaschine? Wenn ja, wie hoch ist der Lagerbestand?



In unserem Fall besteht die Aufgabe des Infokiosks darin, der Person, die auftaucht, bei der Auswahl eines Produkts aus dem Katalog zu helfen und an der Kasse einen Barcode für die spätere Zahlung für dieses Produkt auszudrucken.

Das Problem liegt in der Tatsache, dass solche Lösungen häufig aus verschiedenen Gründen kein Benachrichtigungssystem zum Unterbrechen der Arbeit haben. Zum Beispiel geht einem Kiosk manchmal das Kontrollband aus, eine Verbindung wird unterbrochen, es tritt ein Fehler auf, und während das Ladenpersonal dies bemerkt, werden potenzielle Kunden (bestenfalls) vorbeikommen oder den fahrlässigen Unternehmer in den Netzwerken sogar lächerlich machen.





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



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



(« ?») «» :



  • , ?
  • , ? (, «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