Skip to content

Commit 7c9d2c3

Browse files
Merge pull request #233252 from PatAltimore/patricka-merge-dev-tutorials
Update C# methods
2 parents b58edca + 6cb616c commit 7c9d2c3

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

articles/iot-edge/tutorial-develop-for-linux.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -357,9 +357,9 @@ Each module can have multiple *input* and *output* queues declared in their code
357357

358358
The sample C# code that comes with the project template uses the [ModuleClient Class](/dotnet/api/microsoft.azure.devices.client.moduleclient) from the IoT Hub SDK for .NET.
359359

360-
1. In the Visual Studio Code explorer, open **modules** > **CSharpModule** > **ModuleBackgroundService.cs**.
360+
1. In the Visual Studio Code explorer, open **modules** > **filtermodule** > **ModuleBackgroundService.cs**.
361361

362-
1. At the top of the **CSharpModule** namespace, add three **using** statements for types that are used later:
362+
1. Before the **filtermodule** namespace, add three **using** statements for types that are used later:
363363

364364
```csharp
365365
using System.Collections.Generic; // For KeyValuePair<>
@@ -394,9 +394,9 @@ The sample C# code that comes with the project template uses the [ModuleClient C
394394
}
395395
```
396396

397-
1. Find the **Init** function. This function creates and configures a **ModuleClient** object, which allows the module to connect to the local Azure IoT Edge runtime to send and receive messages. After creating the **ModuleClient**, the code reads the **temperatureThreshold** value from the module twin's desired properties. The code registers a callback to receive messages from an IoT Edge hub via an endpoint called **input1**.
397+
1. Find the **ExecuteAsync** function. This function creates and configures a **ModuleClient** object, which allows the module to connect to the local Azure IoT Edge runtime to send and receive messages. After creating the **ModuleClient**, the code reads the **temperatureThreshold** value from the module twin's desired properties. The code registers a callback to receive messages from an IoT Edge hub via an endpoint called **input1**.
398398
399-
Replace the **SetInputMessageHandlerAsync** method with a new one that updates the name of the endpoint and the method that's called when input arrives. Also, add a **SetDesiredPropertyUpdateCallbackAsync** method for updates to the desired properties. To make this change, replace the last line of the **Init** method with the following code:
399+
Replace the call to the **ProcessMessageAsync** method with a new one that updates the name of the endpoint and the method that's called when input arrives. Also, add a **SetDesiredPropertyUpdateCallbackAsync** method for updates to the desired properties. To make this change, replace the last line of the **ExecuteAsync** method with the following code:
400400

401401
```csharp
402402
// Register a callback for messages that are received by the module.
@@ -413,7 +413,7 @@ The sample C# code that comes with the project template uses the [ModuleClient C
413413
await ioTHubModuleClient.SetInputMessageHandlerAsync("inputFromSensor", FilterMessages, ioTHubModuleClient);
414414
```
415415

416-
1. Add the **onDesiredPropertiesUpdate** method to the **Program** class. 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 that's running inside a module directly from the cloud.
416+
1. Add the **onDesiredPropertiesUpdate** method to the **ModuleBackgroundService** class. 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 that's running inside a module directly from the cloud.
417417
418418
```csharp
419419
static Task OnDesiredPropertiesUpdate(TwinCollection desiredProperties, object userContext)
@@ -444,7 +444,7 @@ The sample C# code that comes with the project template uses the [ModuleClient C
444444
}
445445
```
446446
447-
1. Replace the **PipeMessage** method with the **FilterMessages** method. This method is called whenever the module receives a message from the IoT Edge hub. It filters out messages that report temperatures below the temperature threshold set via the module twin. It also adds the **MessageType** property to the message with the value set to **Alert**.
447+
1. Add the **FilterMessages** method. This method is called whenever the module receives a message from the IoT Edge hub. It filters out messages that report temperatures below the temperature threshold set via the module twin. It also adds the **MessageType** property to the message with the value set to **Alert**.
448448
449449
```csharp
450450
static async Task<MessageResponse> FilterMessages(Message message, object userContext)

0 commit comments

Comments
 (0)