AzureIoTHubGetStatus
- Last UpdatedOct 29, 2026
- 2 minute read
AzureIoTHubGetStatus checks the status of an Azure IoT Hub connection or a sent message. See Notes for more information.
|
Function |
Group |
Execution |
String Exp. |
Windows |
Windows Embedded |
IoT View |
Thin Clients |
Mobile Access |
|---|---|---|---|---|---|---|---|---|
|
AzureIoTHubGetStatus |
Internet of Things |
Synchronous |
Yes |
Supported |
Not supported |
Not supported |
Supported |
Supported |
Syntax
AzureIoTHubGetStatus(strAlias, optNumMessageId)
strAlias
The name of the Azure IoT Hub connection that you want to use. The connection can be created either during project development (in the Project ExplorerTasks tab Internet of Things folder) or during project run time (by calling the AzureIoTHubOpen function).
optNumMessageId
Optional parameter. If this parameter is used, the function will return the status of the message whose ID is specified by this parameter. If this parameter is not used, the function will return the status of the connection defined by strAlias.
Return value
If successful, this function returns the status of the connection or the message (a positive integer).
Connection Status
|
Value |
Description |
|---|---|
|
1 |
strAlias created. |
|
2 |
Connecting |
|
3 |
Connected |
|
4 |
Disconnecting |
|
5 |
Disconnected |
|
6 |
Retrying (connection failed) |
|
7 |
Connection failed. |
Message Status
|
Value |
Description |
|---|---|
|
10 |
Unknown |
|
11 |
Queued |
|
12 |
Sent |
|
13 |
Failed |
If unsuccessful, this function returns 0 (zero), indicating that an invalid alias is used in the function (possibly not defined or closed), or one of the following negative integer values:
|
Value |
Description |
|---|---|
|
-300 |
Invalid alias detected by server |
|
-301 |
Invalid connection parameter |
|
-302 |
Invalid message parameter |
|
-303 |
Invalid type parameter |
|
-304 |
Invalid property parameter |
|
-305 |
Invalid message ID parameter |
|
-306 |
Connection has not been defined |
|
-307 |
Conflicting alias |
|
-308 |
Open connection error |
|
-309 |
Invalid command |
|
-310 |
Communication error |
|
-311 |
Invalid parameter index |
Notes
Messages are kept in the Gateway ("alive" in the IoT Hub queue) for up to 10 minutes before they are deleted from the queue. (The settings for messages are currently configured in the IoT Hub settings.) The Gateway has a limit of 100 messages per connection; older messages (in terms of creation time) will be deleted to make room for newer messages.
Examples
As used in a Math worksheet:
|
Tag Name |
Expression |
|---|---|
|
nConnStatus |
AzureIoTHubGetStatus("C1") |
|
nMsgStatus |
AzureIoTHubGetStatus("C1", 3) |