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

PnP Component Sample convert sample style #1092

Merged
merged 19 commits into from
Aug 25, 2020
Merged

PnP Component Sample convert sample style #1092

merged 19 commits into from
Aug 25, 2020

Conversation

momuno
Copy link
Contributor

@momuno momuno commented Aug 20, 2020

Updates to includes, defines, logging, const, etc.
Refactor of MQTT message initialization into component file.

Still needs to update readme documentation and pnp component sample c file to match.

@momuno momuno added Client This issue points to a problem in the data-plane of the library. IoT labels Aug 20, 2020
@momuno momuno requested a review from danewalton August 20, 2020 22:49
@momuno momuno self-assigned this Aug 20, 2020
@momuno
Copy link
Contributor Author

momuno commented Aug 21, 2020

Will make a separate PR to apply all of today's updates for all samples: const, ref_, out_

sdk/samples/iot/paho_iot_hub_pnp_component_sample.c Outdated Show resolved Hide resolved
sdk/samples/iot/paho_iot_hub_pnp_component_sample.c Outdated Show resolved Hide resolved
sdk/samples/iot/paho_iot_hub_pnp_component_sample.c Outdated Show resolved Hide resolved
sdk/samples/iot/paho_iot_hub_pnp_component_sample.c Outdated Show resolved Hide resolved
sdk/samples/iot/paho_iot_hub_pnp_component_sample.c Outdated Show resolved Hide resolved
sdk/samples/iot/sample_pnp.c Outdated Show resolved Hide resolved
sdk/samples/iot/sample_pnp_thermostat_component.c Outdated Show resolved Hide resolved
sdk/samples/iot/sample_pnp_thermostat_component.c Outdated Show resolved Hide resolved
sdk/samples/iot/sample_pnp_thermostat_component.c Outdated Show resolved Hide resolved
sdk/samples/iot/paho_iot_hub_pnp_component_sample.c Outdated Show resolved Hide resolved
#pragma warning(disable : 4201)
#endif
#include <paho-mqtt/MQTTClient.h>
#ifdef _MSC_VER
#pragma warning(pop)
#pragma warning(default : 4201)
Copy link
Member

Choose a reason for hiding this comment

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

I think @ahsonkhan was the one that suggested using push/pop for the pragma's?

Copy link
Member

@ahsonkhan ahsonkhan Aug 24, 2020

Choose a reason for hiding this comment

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

What's the rationale/benefit of not using push/pop?

Push/pop let's you keep the warning state unmodified outside of this usage, which is nice. If you don't do that, we change the warning state to something other than what the outer-scope might have set it as (which may not be default).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah, ok. Am I understanding correctly that we with the push/pop, we shouldn't need to set the warning back to default, corrrect? I will update this in all the samples.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

#ifdef _MSC_VER
#pragma warning(push)
// warning C4201: nonstandard extension used: nameless struct/union
#pragma warning(disable : 4201)
#endif
#include <paho-mqtt/MQTTClient.h>
#ifdef _MSC_VER
#pragma warning(pop)
#endif

Copy link
Member

@ahsonkhan ahsonkhan Aug 25, 2020

Choose a reason for hiding this comment

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

ah, ok. Am I understanding correctly that we with the push/pop, we shouldn't need to set the warning back to default, corrrect?

yes

The pop should happen near the end of the file or after the code block that is causing the warning you want to disable.

sdk/samples/iot/paho_iot_hub_pnp_component_sample.c Outdated Show resolved Hide resolved
connect_mqtt_client_to_iot_hub();
LOG_SUCCESS("Client connected to IoT Hub.");

subscribe_mqtt_client_to_iot_hub_topics();
Copy link
Member

Choose a reason for hiding this comment

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

nit: should this be

Suggested change
subscribe_mqtt_client_to_iot_hub_topics();
subscribe_mqtt_client_to_iot_pnp_topics();

curious on your opinion

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hmmm. i'm not sure. ultimately, it is connecting to the hub. @ericwol-msft and @jspaith what do you think?

Copy link
Member

Choose a reason for hiding this comment

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

not a big deal feel free to ignore for this PR

sdk/samples/iot/paho_iot_hub_pnp_component_sample.c Outdated Show resolved Hide resolved
sdk/samples/iot/paho_iot_hub_pnp_component_sample.c Outdated Show resolved Hide resolved
sdk/samples/iot/paho_iot_hub_pnp_component_sample.c Outdated Show resolved Hide resolved
sdk/samples/iot/paho_iot_hub_pnp_component_sample.c Outdated Show resolved Hide resolved
sdk/samples/iot/paho_iot_hub_pnp_component_sample.c Outdated Show resolved Hide resolved
sdk/samples/iot/sample_pnp_device_info_component.h Outdated Show resolved Hide resolved
Copy link
Member

@danewalton danewalton left a comment

Choose a reason for hiding this comment

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

Great work here Molly thanks for all the work. Output when running looks great and the code organization is easy to follow.

@momuno momuno merged commit 332102c into Azure:master Aug 25, 2020
@momuno momuno deleted the momuno/pnp-component-update branch August 25, 2020 20:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Client This issue points to a problem in the data-plane of the library. IoT
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants