azure-iot-device package
Classes
| Client |
IoT Hub device client used to connect a device with an Azure IoT hub. Users of the SDK should call one of the factory methods, fromConnectionString or fromSharedAccessSignature to create an IoT Hub device client. |
| DeviceMethodRequest |
Represents the data passed in from the service to the device when a device method is called from the cloud. An instance of this class is passed to the callback registered via onDeviceMethod(string, (request: DeviceMethodRequest, response: DeviceMethodResponse) => void). |
| DeviceMethodResponse |
a DeviceMethodResponse object is provided to the user with each DeviceMethodRequest allowing the user to construct and send a well-formatted response back to the service for each device method call. An instance of this class is passed as the second parameter to the callback registered via onDeviceMethod(string, (request: DeviceMethodRequest, response: DeviceMethodResponse) => void). |
| IotEdgeAuthenticationProvider |
Provides an |
| ModuleClient |
IoT Hub device client used to connect a device with an Azure IoT hub. Users of the SDK should call one of the factory methods, fromConnectionString or fromSharedAccessSignature to create an IoT Hub device client. |
| SharedAccessKeyAuthenticationProvider |
Provides an |
| SharedAccessSignatureAuthenticationProvider |
Provides an |
| Twin |
A Device Twin is document describing the state of a device that is stored by an Azure IoT hub and is available even if the device is offline. It is built around 3 sections:
For more information see Understanding Device Twins. @fires Twin#properties.desired[.path] |
| X509AuthenticationProvider |
Provides an |
Interfaces
| DeviceMethodExchange | |
| MethodParams | |
| MethodResult | |
| AmqpTransportOptions |
Options which are specific to the AMQP transport.
This is passed into setOptions(DeviceClientOptions, Callback<TransportConfigured>) as a property named See {Client.setOptions} See {DeviceClientOptions} |
| BlobUploadCommonResponseStub |
Structure to mimic the BlobUploadCommonResponse from @azure/storage-blob |
| DeviceClientOptions |
Options for the Client object. Passed into the setOptions(DeviceClientOptions, Callback<TransportConfigured>) function. See {Client.setOptions} Example
|
| HttpReceiverOptions |
Options structure used to configure how often the HTTP receiver polls for messages.
Each of these options is mutually exclusive, except for the See {Client.setOptions} See {DeviceClientOptions} |
| HttpTransportOptions |
Options structure for passing optional configuration parameters into the Http Transport.
This is passed into setOptions(DeviceClientOptions, Callback<TransportConfigured>) as a property named See {Client.setOptions} See {DeviceClientOptions} |
| MqttTransportOptions |
Options which are specific to the MQTT transport
This is passed into setOptions(DeviceClientOptions, Callback<TransportConfigured>) as a property named |
| RestErrorStub |
Structure to mimic the RestError class from @azure/core-http This is used in blob_upload_results.ts to define the type of the error input to fromAzureStorageCallbackArgs. |
| TokenRenewalValues |
Structure used to pass down token renewal values for authentication that utilizes pre-shared keys. |
| BlobUpload | |
| DeviceTransport | |
| Abortable | |
| Abortable | |
| Abortable | |
| Abortable | |
| TwinProperties |
Contains the desired and reported properties for the Twin. |
Type Aliases
| MethodCallback | |
| TransportCtor |
Functions
| create |
Creates a valid connection string for a device using symmetric key authentication. |
| create |
Creates a valid connection string for a device using x509 certificate authentication. |
| parse(string) | Parses a string in the format of a Shared Access Signature token and returns a fromSharedAccessSignature(string, any). |
| create |
|
| create(string, string, string, string | number) | Creates a shared access signature token to authenticate a device connection with an Azure IoT hub. |
| get |
|
| get |
|
| get |
|
| get |
Function Details
createWithSharedAccessKey(string, string, string)
Creates a valid connection string for a device using symmetric key authentication.
function createWithSharedAccessKey(hostName: string, deviceId: string, symmetricKey: string): string
Parameters
- hostName
-
string
Hostname of the Azure IoT hub.
- deviceId
-
string
Unique device identifier.
- symmetricKey
-
string
Symmetric key used to generate the fromSharedAccessSignature(string, any) that authenticate the connection.
Returns
string
createWithX509Certificate(string, string)
Creates a valid connection string for a device using x509 certificate authentication.
function createWithX509Certificate(hostName: string, deviceId: string): string
Parameters
- hostName
-
string
Hostname of the Azure IoT hub.
- deviceId
-
string
Unique device identifier.
Returns
string
parse(string)
Parses a string in the format of a Shared Access Signature token and returns a fromSharedAccessSignature(string, any).
function parse(source: string): SharedAccessSignature
Parameters
- source
-
string
A shared access signature string.
Returns
SharedAccessSignature
An object containing the different shared access signature properties extracted from the string given as a parameter
createDeviceMethodExchange(DeviceMethodRequest, DeviceMethodResponse)
function createDeviceMethodExchange(request: DeviceMethodRequest, response: DeviceMethodResponse): DeviceMethodExchange
Parameters
- request
- DeviceMethodRequest
- response
- DeviceMethodResponse
Returns
create(string, string, string, string | number)
Creates a shared access signature token to authenticate a device connection with an Azure IoT hub.
function create(host: string, deviceId: string, key: string, expiry: string | number): SharedAccessSignature
Parameters
- host
-
string
Hostname of the Azure IoT hub.
- deviceId
-
string
Unique device identifier as it exists in the device registry.
- key
-
string
Symmetric key to use to create shared access signature tokens.
- expiry
-
string | number
Expiry time for the token that will be created.
Returns
SharedAccessSignature
A shared access signature to be used to connect with an Azure IoT hub.
getUserAgentString(NoErrorCallback<string>)
function getUserAgentString(done: NoErrorCallback<string>)
Parameters
- done
-
NoErrorCallback<string>
getUserAgentString()
function getUserAgentString(): Promise<string>
Returns
Promise<string>
getUserAgentString(string, NoErrorCallback<string>)
function getUserAgentString(productInfo: string, done: NoErrorCallback<string>)
Parameters
- productInfo
-
string
- done
-
NoErrorCallback<string>
getUserAgentString(string)
function getUserAgentString(productInfo: string): Promise<string>
Parameters
- productInfo
-
string
Returns
Promise<string>