Skip to content

Commit 2f42389

Browse files
committed
Reordered functions
1 parent 20b6e53 commit 2f42389

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

articles/iot-edge/tutorial-c-module-windows.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ The default module code receives messages on an input queue and passes them alon
132132
)
133133
```
134134
135-
3. Add **my_parson** to the list of libraries in the **target_link_libraries** section of the CMakeLists.txt file.
135+
3. Add `my_parson` to the list of libraries in the **target_link_libraries** section of the CMakeLists.txt file.
136136
137137
4. Save the **CMakeLists.txt** file.
138138
@@ -172,6 +172,14 @@ The default module code receives messages on an input queue and passes them alon
172172
4. Find the `InputQueue1Callback` function, and replace the whole function with the following code. This function implements the actual messaging filter. When a message is received, it checks whether the reported temperature exceeds the threshold. If yes, then it forwards the message through its output queue. If not, then it ignores the message.
173173

174174
```c
175+
static unsigned char *bytearray_to_str(const unsigned char *buffer, size_t len)
176+
{
177+
unsigned char *ret = (unsigned char *)malloc(len + 1);
178+
memcpy(ret, buffer, len);
179+
ret[len] = '\0';
180+
return ret;
181+
}
182+
175183
static IOTHUBMESSAGE_DISPOSITION_RESULT InputQueue1Callback(IOTHUB_MESSAGE_HANDLE message, void* userContextCallback)
176184
{
177185
IOTHUBMESSAGE_DISPOSITION_RESULT result;
@@ -236,14 +244,6 @@ The default module code receives messages on an input queue and passes them alon
236244
messagesReceivedByInput1Queue++;
237245
return result;
238246
}
239-
240-
static unsigned char *bytearray_to_str(const unsigned char *buffer, size_t len)
241-
{
242-
unsigned char *ret = (unsigned char *)malloc(len + 1);
243-
memcpy(ret, buffer, len);
244-
ret[len] = '\0';
245-
return ret;
246-
}
247247
```
248248

249249
5. Add a `moduleTwinCallback` function. This method receives updates on the desired properties from the module twin, and updates the **temperatureThreshold** variable to match. All modules have their own module twin, which lets you configure the code running inside a module directly from the cloud.

articles/iot-edge/tutorial-c-module.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ The default module code receives messages on an input queue and passes them alon
112112
)
113113
```
114114
115-
3. Add **my_parson** to the list of libraries in the **target_link_libraries** function of CMakeLists.txt.
115+
3. Add `my_parson` to the list of libraries in the **target_link_libraries** function of CMakeLists.txt.
116116
117117
4. Save the **CMakeLists.txt** file.
118118
@@ -152,6 +152,14 @@ The default module code receives messages on an input queue and passes them alon
152152
1. Replace the entire `InputQueue1Callback` function with the following code. This function implements the actual messaging filter. When a message is received, it checks whether the reported temperature exceeds the threshold. If yes, then it forwards the message through its output queue. If not, then it ignores the message.
153153

154154
```c
155+
static unsigned char *bytearray_to_str(const unsigned char *buffer, size_t len)
156+
{
157+
unsigned char *ret = (unsigned char *)malloc(len + 1);
158+
memcpy(ret, buffer, len);
159+
ret[len] = '\0';
160+
return ret;
161+
}
162+
155163
static IOTHUBMESSAGE_DISPOSITION_RESULT InputQueue1Callback(IOTHUB_MESSAGE_HANDLE message, void* userContextCallback)
156164
{
157165
IOTHUBMESSAGE_DISPOSITION_RESULT result;
@@ -213,14 +221,6 @@ The default module code receives messages on an input queue and passes them alon
213221
messagesReceivedByInput1Queue++;
214222
return result;
215223
}
216-
217-
static unsigned char *bytearray_to_str(const unsigned char *buffer, size_t len)
218-
{
219-
unsigned char *ret = (unsigned char *)malloc(len + 1);
220-
memcpy(ret, buffer, len);
221-
ret[len] = '\0';
222-
return ret;
223-
}
224224
```
225225

226226
1. Add a `moduleTwinCallback` function. This method receives updates on the desired properties from the module twin, and updates the **temperatureThreshold** variable to match. All modules have their own module twin, which lets you configure the code running inside a module directly from the cloud.

0 commit comments

Comments
 (0)