summaryrefslogtreecommitdiff
path: root/addons/azure_iot/docs/azure_rtos_iot_adu_agent.md
blob: 6ad464431c70912ecafb16bfd9c056dc11fa8009 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
# Azure IoT ADU Agent

**nx_azure_iot_adu_agent_start**
***
<div style="text-align: right"> Start Azure IoT ADU agent. </div>

**Prototype**
```c
UINT nx_azure_iot_adu_agent_start(NX_AZURE_IOT_ADU_AGENT *adu_agent_ptr,
                                  NX_AZURE_IOT_HUB_CLIENT *iothub_client_ptr,
                                  const UCHAR *manufacturer, UINT manufacturer_length,
                                  const UCHAR *model, UINT model_length,
                                  const UCHAR *installed_criteria, UINT installed_criteria_length,
                                  VOID (*adu_agent_update_notify)(NX_AZURE_IOT_ADU_AGENT *adu_agent_ptr,
                                                                  UCHAR *provider, UINT provider_length,
                                                                  UCHAR *name, UINT name_length,
                                                                  UCHAR *version, UINT version_length),
                                  VOID (*adu_agent_driver)(NX_AZURE_IOT_ADU_AGENT_DRIVER *));
```
**Description**

<p>This routine starts the ADU agent. Properties (manufacturer and model) of a device this update is compatible with. Installed criteria is used to determine if the update is installed or not, typically it is a version string (1.0.0). The installed criteria may be set into adu agent, then agent will check the update internally, otherwise, adu agent will set NX_AZURE_IOT_ADU_AGENT_DRIVER_UPDATE_CHECK command to let driver (adu_agent_driver) do the check.</p>

**Parameters**

| Name | Description |
| - |:-|
| adu_agent_ptr [in] | A pointer to a `NX_AZURE_IOT_ADU_AGENT`. |
| iothub_client_ptr [in] | A pointer to a `NX_AZURE_IOT_HUB_CLIENT`.|
| manufacturer [in] | A pointer to the manufacturer. Must be NULL terminated string. |
| manufacturer_length [in] | Length of the manufacturer.  |
| model [in]  | A pointer to the model. Must be NULL terminated string. |
| model_length [in] | Length of the model. |
| installed_criteria [in]  | A pointer to the installed criteria string, such as: version string. Must be NULL terminated string. |
| installed_criteria_length [in] | Length of the installed_criteria. |
| adu_agent_update_notify [in] | Pointer to a callback function invoked once update is received. |
| adu_agent_driver [in] | User supplied driver for flash operation. |

**Return Values**
* NX_AZURE_IOT_SUCCESS Successfully started the Azure IoT ADU agent.
* NX_AZURE_IOT_INVALID_PARAMETER Fail to start the Azure IoT ADU agent due to invalid parameter.
* NX_AZURE_IOT_NO_AVAILABLE_CIPHER Fail to start the Azure IoT ADU agent due to no available cipher.
* NX_AZURE_IOT_INSUFFICIENT_BUFFER_SPACE Fail to start the Azure IoT ADU agent due to insufficient buffer space.

**Allowed From**

Threads

**Example**

**See Also**

<div style="page-break-after: always;"></div>

**nx_azure_iot_adu_agent_proxy_update_add**
***
<div style="text-align: right"> Add proxy update on device update agent. </div>

**Prototype**
```c
UINT nx_azure_iot_adu_agent_proxy_update_add(NX_AZURE_IOT_ADU_AGENT *adu_agent_ptr,
                                             const UCHAR *manufacturer, UINT manufacturer_length,
                                             const UCHAR *model, UINT model_length,
                                             const UCHAR *installed_criteria, UINT installed_criteria_length,
                                             VOID (*adu_agent_driver)(NX_AZURE_IOT_ADU_AGENT_DRIVER *));
```
**Description**

<p>This routine adds the proxy update on device update agent. Properties (manufacturer and model) of a device this update is compatible with, installed criteria is used to check if the update is installed or not, the installed criteria may be version string. If the installed criteria is set into adu agent, the agent will check the update, otherwise, adu agent will call NX_AZURE_IOT_ADU_AGENT_DRIVER_UPDATE_CHECK to driver, then the adu_agent_driver must implement NX_AZURE_IOT_ADU_AGENT_DRIVER_UPDATE_CHECK command to check if the update is installed or not according to the installed criteria. </p>

**Parameters**

| Name | Description |
| - |:-|
| adu_agent_ptr [in] | A pointer to a `NX_AZURE_IOT_ADU_AGENT`. |
| manufacturer [in] | A pointer to the manufacturer. Must be NULL terminated string. |
| manufacturer_length [in] | Length of the manufacturer.  |
| model [in]  | A pointer to the model. Must be NULL terminated string. |
| model_length [in] | Length of the model. |
| installed_criteria [in]  | A pointer to the installed criteria string, such as: version string. Must be NULL terminated string. |
| installed_criteria_length [in] | Length of the installed_criteria. |
| adu_agent_driver [in] | User supplied driver for flash operation. |

**Return Values**
* NX_AZURE_IOT_SUCCESS Successfully started the Azure IoT ADU agent.
* NX_AZURE_IOT_INVALID_PARAMETER Fail to start the Azure IoT ADU agent due to invalid parameter.
* NX_AZURE_IOT_NO_MORE_ENTRIES Fail to start the Azure IoT ADU agent due to no more entries.

**Allowed From**

Threads

**Example**

**See Also**

<div style="page-break-after: always;"></div>

**nx_azure_iot_adu_agent_stop**
***
<div style="text-align: right"> Stop Azure IoT ADU agent. </div>

**Prototype**
```c
UINT nx_azure_iot_adu_agent_stop(NX_AZURE_IOT_ADU_AGENT *adu_agent_ptr);
```
**Description**

<p>This routine stops the ADU agent.</p>

**Parameters**
|               |               |
| - |:-|
| adu_agent_ptr [in]    | A pointer to a `NX_AZURE_IOT_ADU_AGENT` |


**Return Values**
* NX_AZURE_IOT_SUCCESS Successfully stopped the Azure IoT ADU agent.
* NX_AZURE_IOT_INVALID_PARAMETER Fail to stop the Azure IoT ADU agent due to invalid parameter.

**Allowed From**

Threads

**Example**

**See Also**

<div style="page-break-after: always;"></div>

**nx_azure_iot_adu_agent_update_download_and_install**
***
<div style="text-align: right"> Start to download and install the new update. </div>

**Prototype**
```c
UINT nx_azure_iot_adu_agent_update_download_and_install(NX_AZURE_IOT_ADU_AGENT *adu_agent_ptr);
```
**Description**

<p>The routine starts to download and install the new update.</p>

**Parameters**
|               |               |
| - |:-|
| adu_agent_ptr [in]    | A pointer to a `NX_AZURE_IOT_ADU_AGENT` |


**Return Values**
* NX_AZURE_IOT_SUCCESS Successfully started to download and install the new update.
* NX_AZURE_IOT_INVALID_PARAMETER Fail to download and install the new update due to invalid parameter.

**Allowed From**

Threads

**Example**

**See Also**

<div style="page-break-after: always;"></div>

**nx_azure_iot_adu_agent_update_apply**
***
<div style="text-align: right"> Start to apply the new update. </div>

**Prototype**
```c
UINT nx_azure_iot_adu_agent_update_apply(NX_AZURE_IOT_ADU_AGENT *adu_agent_ptr);
```
**Description**

<p>The routine starts to apply the new update. The device may reboot after applying the update successfully.</p>

**Parameters**
|               |               |
| - |:-|
| adu_agent_ptr [in]    | A pointer to a `NX_AZURE_IOT_ADU_AGENT` |


**Return Values**
* NX_AZURE_IOT_SUCCESS Successfully started to apply the new update.
* NX_AZURE_IOT_INVALID_PARAMETER Fail to apply the new update due to invalid parameter.

**Allowed From**

Threads

**Example**

**See Also**

<div style="page-break-after: always;"></div>