Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added sample for Edge Module direct method #3087

Merged
merged 5 commits into from
Jan 26, 2023

Conversation

tmahmood-microsoft
Copy link
Contributor

@tmahmood-microsoft tmahmood-microsoft commented Jan 23, 2023

Added EdgeModuleMethodSample.
This sample allows you to receive direct methods on Edge module from Azure portal and also from Edge module itself.

Also, updated repo for EdgeModuleMessageSample

@schoims
Copy link
Contributor

schoims commented Jan 23, 2023

You may also want to add the sample link here https://github.com/Azure/azure-iot-sdk-csharp/tree/previews/v2/iothub/device/samples#device-samples

@tmahmood-microsoft tmahmood-microsoft changed the title Updating repo for Edge Module sample Added EdgeModuleMethodSample Jan 24, 2023
@tmahmood-microsoft tmahmood-microsoft changed the title Added EdgeModuleMethodSample Added sample for Edge Module direct method Jan 24, 2023
public class EdgeModuleMethodSample
{
private readonly IotHubModuleClient _moduleClient;
private string _deviceId;
Copy link
Contributor

@schoims schoims Jan 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we not making deviceId and moduleId configurable?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trying to avoid asking more than necessary parameters from the user.


case "WriteToConsole":
case "ModuleToModule":
return await WriteToConsoleAsync(directMethodRequest);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is ModuleToModule necessary if it just writes to console?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to distinguish between the two, since 'WriteToConsole' method prints out the method name.

@tmahmood-microsoft
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@tmahmood-microsoft tmahmood-microsoft merged commit 27d150e into previews/v2 Jan 26, 2023
@tmahmood-microsoft tmahmood-microsoft deleted the tmahmood/update-sample-repo branch January 26, 2023 18:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants