AWS IoT Core

Verbind Delphi/C++Builder-applicaties met AWS IoT Core via MQTT. Mutual TLS met X.509-certificaten of SigV4-getekende WebSocket, plus integratie met shadow en rule engine.

TsgcIoTAmazon_MQTT_Client

AWS IoT Core MQTT 3.1.1- / MQTT 5-client — X.509 mutual TLS of SigV4-over-WebSocket-authenticatie, plus subscriptions, retained messages, will en de AWS-specifieke client-id-beperkingen.

Componentklasse

TsgcIoTAmazon_MQTT_Client

Protocol

AWS IoT MQTT

Platforms

Windows, macOS, Linux, iOS, Android

Editie

Standard / Professional / Enterprise

Stel credentials in, verbind en publiceer

Stel de AWS endpoint-host in, wijs de component naar je X.509-cert/key (of geef AWS-access keys op voor SigV4) en verbind, abonneer en publiceer dan zoals bij elke MQTT-client.

uses
  sgcIoT;

var
  AWSIoT: TsgcIoTAmazon_MQTT_Client;
begin
  AWSIoT := TsgcIoTAmazon_MQTT_Client.Create(nil);
  AWSIoT.IoT.Host := 'a1b2c3d4e5f.iot.eu-west-1.amazonaws.com';

  // X.509 mutual TLS
  AWSIoT.IoT.Authentication := iotAuth_Certificate;
  AWSIoT.IoT.Certificate.CertFile := 'device.cert.pem';
  AWSIoT.IoT.Certificate.KeyFile  := 'device.private.key';
  AWSIoT.IoT.Certificate.RootCert := 'AmazonRootCA1.pem';

  AWSIoT.OnMQTTConnect := procedure(Connection: TsgcWSConnection;
    const Session: Boolean; const ReasonCode: Integer;
    const ReasonName: string;
    const ConnectProperties: TsgcWSMQTTCONNACKProperties)
  begin
    AWSIoT.Subscribe('devices/#');
  end;

  AWSIoT.Active := True;
  AWSIoT.Publish('devices/sensor1/telemetry', '{"temp":22.5}');
end;
// uses: sgcIoT
TsgcIoTAmazon_MQTT_Client *AWSIoT = new TsgcIoTAmazon_MQTT_Client(this);
AWSIoT->IoT->Host = "a1b2c3d4e5f.iot.eu-west-1.amazonaws.com";
AWSIoT->IoT->Authentication = iotAuth_Certificate;
AWSIoT->IoT->Certificate->CertFile = "device.cert.pem";
AWSIoT->IoT->Certificate->KeyFile  = "device.private.key";

AWSIoT->Active = true;

Wat zit erin

Een voorgeconfigureerde MQTT-client voor AWS IoT Core die de AWS-specifieke authenticatieopties en topic-conventies afhandelt.

X.509 mutual TLS

Stel IoT.Authentication := iotAuth_Certificate in en laad het apparaatcertificaat, de privésleutel en AmazonRootCA1.pem — de component gebruikt indien nodig ALPN x-amzn-mqtt-ca op poort 443.

SigV4 over WebSocket

Voor browserachtige authenticatie stel je IoT.Authentication := iotAuth_AccessKey in en configureer je access-key / secret-key / region — de component berekent de SigV4-presigned URL via querystring.

MQTT 3.1.1 + MQTT 5

Wissel MQTTVersion; AWS IoT Core ondersteunt beide. MQTT 5-eigenschappen (session expiry, topic alias, user properties) stromen via de standaard MQTT-events.

AWS topic-conventies

AWS reserveert topics onder $aws/things/<thingName>/... voor shadow, jobs en provisioning. Abonneer je erop zoals op elk ander topic om shadow-updates en jobtoewijzingen te ontvangen.

Reconnect-safe

Koppel WatchDog aan de onderliggende client — bij verbroken verbinding authenticeert de component opnieuw (een nieuwe SigV4-querystring waar van toepassing) en abonneert opnieuw.

Throughput-limieten

AWS IoT handhaaft limieten per verbinding (publish-QoS, doorvoer, berichtgrootte). Gebruik aan publish-zijde een TsgcWSRateLimiter om binnen het quotum te blijven.

Specificaties & referenties

Gezaghebbende bronnen voor het protocol dat deze component implementeert.

Documentatie & demo's

Deep-link naar de componentreferentie, pak het kant-en-klare demoproject en download de proefversie.

Online help — TsgcIoTAmazon_MQTT_Client Volledige referentie van eigenschappen, methoden en events voor deze component.
Demoproject — Demos\10.IoT_Clients Kant-en-klaar voorbeeldproject. Wordt meegeleverd in de sgcWebSockets-package — download hieronder de proefversie.
Technisch document (PDF) Functies, snelstart, codevoorbeelden voor Delphi & C++ Builder en primaire bronverwijzingen — alleen voor deze component.
Gebruikershandleiding (PDF) Uitgebreide handleiding die elke component in de bibliotheek behandelt.

Klaar om Delphi te verbinden met AWS IoT?

Download de gratis proefversie en streaming IoT-telemetrie van Delphi-apparaten naar AWS IoT Core.