Skip to content

Commit

Permalink
Move pnp sample code into own folder (Azure#1163)
Browse files Browse the repository at this point in the history
  • Loading branch information
danewalton-msft authored Aug 28, 2020
1 parent 356e4dd commit c85fb41
Show file tree
Hide file tree
Showing 10 changed files with 36 additions and 31 deletions.
13 changes: 9 additions & 4 deletions sdk/samples/iot/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,11 @@ target_link_libraries(paho_iot_hub_pnp_sample

# PnP Component Sample
add_executable (paho_iot_hub_pnp_component_sample
${CMAKE_CURRENT_LIST_DIR}/sample_pnp_mqtt_component.c
${CMAKE_CURRENT_LIST_DIR}/sample_pnp_device_info_component.c
${CMAKE_CURRENT_LIST_DIR}/sample_pnp_thermostat_component.c
${CMAKE_CURRENT_LIST_DIR}/pnp/pnp_mqtt_message.c
${CMAKE_CURRENT_LIST_DIR}/pnp/pnp_device_info_component.c
${CMAKE_CURRENT_LIST_DIR}/pnp/pnp_protocol.c
${CMAKE_CURRENT_LIST_DIR}/pnp/pnp_thermostat_component.c
${CMAKE_CURRENT_LIST_DIR}/paho_iot_hub_pnp_component_sample.c
${CMAKE_CURRENT_LIST_DIR}/sample_pnp.c
)

# SDK deps
Expand All @@ -99,6 +99,11 @@ target_link_libraries(paho_iot_hub_pnp_component_sample
az::iot::sample::common
)

target_include_directories(paho_iot_hub_pnp_component_sample
PRIVATE
${CMAKE_CURRENT_LIST_DIR}
)

# Telemetry (Certificates) Sample
add_executable (paho_iot_hub_telemetry_sample
${CMAKE_CURRENT_LIST_DIR}/paho_iot_hub_telemetry_sample.c
Expand Down
8 changes: 4 additions & 4 deletions sdk/samples/iot/paho_iot_hub_pnp_component_sample.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
#include <azure/core/az_span.h>
#include <azure/iot/az_iot_hub_client.h>

#include "sample_pnp.h"
#include "sample_pnp_device_info_component.h"
#include "sample_pnp_mqtt_component.h"
#include "sample_pnp_thermostat_component.h"
#include "pnp/pnp_protocol.h"
#include "pnp/pnp_device_info_component.h"
#include "pnp/pnp_mqtt_message.h"
#include "pnp/pnp_thermostat_component.h"

#define SAMPLE_TYPE PAHO_IOT_HUB
#define SAMPLE_NAME PAHO_IOT_HUB_PNP_COMPONENT_SAMPLE
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// SPDX-License-Identifier: MIT

#include "sample_pnp_device_info_component.h"
#include "sample_pnp_mqtt_component.h"
#include "pnp_device_info_component.h"
#include "pnp_mqtt_message.h"

#include <azure/core/az_json.h>
#include <azure/core/az_result.h>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// SPDX-License-Identifier: MIT

#ifndef SAMPLE_PNP_DEVICE_INFO_COMPONENT_H
#define SAMPLE_PNP_DEVICE_INFO_COMPONENT_H
#ifndef PNP_DEVICE_INFO_COMPONENT_H
#define PNP_DEVICE_INFO_COMPONENT_H

#include "sample_pnp_mqtt_component.h"
#include "pnp_mqtt_message.h"

#include <azure/core/az_result.h>
#include <azure/iot/az_iot_hub_client.h>
Expand All @@ -21,4 +21,4 @@ az_result pnp_device_info_get_report_data(
const az_iot_hub_client* client,
pnp_mqtt_message* mqtt_message);

#endif // SAMPLE_PNP_DEVICE_INFO_COMPONENT_H
#endif // PNP_DEVICE_INFO_COMPONENT_H
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// SPDX-License-Identifier: MIT

#include "sample_pnp_mqtt_component.h"
#include "pnp_mqtt_message.h"

#include <stddef.h>
#include <stdint.h>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// SPDX-License-Identifier: MIT

#ifndef SAMPLE_PNP_MQTT_COMPONENT_H
#define SAMPLE_PNP_MQTT_COMPONENT_H
#ifndef PNP_MQTT_MESSAGE_H
#define PNP_MQTT_MESSAGE_H

#include <stddef.h>

Expand All @@ -24,4 +24,4 @@ void pnp_mqtt_message_init(pnp_mqtt_message* mqtt_message);
// number.
az_span get_request_id(void);

#endif // SAMPLE_PNP_MQTT_COMPONENT_H
#endif // PNP_MQTT_MESSAGE_H
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// SPDX-License-Identifier: MIT

#include "iot_sample_common.h"
#include <iot_sample_common.h>

#include "sample_pnp.h"
#include "pnp_protocol.h"

#include <stdbool.h>
#include <stddef.h>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// SPDX-License-Identifier: MIT

#ifndef SAMPLE_PNP_H
#define SAMPLE_PNP_H
#ifndef PNP_PROTOCOL_H
#define PNP_PROTOCOL_H

#include <stdbool.h>
#include <stddef.h>
Expand Down Expand Up @@ -128,4 +128,4 @@ az_result pnp_process_device_twin_message(
pnp_property_callback property_callback,
void* context_ptr);

#endif // SAMPLE_PNP_H
#endif // PNP_PROTOCOL_H
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
#pragma warning(disable : 4996)
#endif

#include "iot_sample_common.h"
#include "sample_pnp.h"
#include "sample_pnp_mqtt_component.h"
#include <iot_sample_common.h>
#include "pnp_protocol.h"
#include "pnp_mqtt_message.h"

#include "sample_pnp_thermostat_component.h"
#include "pnp_thermostat_component.h"

#include <stdbool.h>
#include <stddef.h>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// SPDX-License-Identifier: MIT

#ifndef SAMPLE_PNP_THERMOSTAT_COMPONENT_H
#define SAMPLE_PNP_THERMOSTAT_COMPONENT_H
#ifndef PNP_THERMOSTAT_COMPONENT_H
#define PNP_THERMOSTAT_COMPONENT_H

#include "sample_pnp_mqtt_component.h"
#include "pnp_mqtt_message.h"

#include <stdbool.h>
#include <stdint.h>
Expand Down Expand Up @@ -59,4 +59,4 @@ az_result pnp_thermostat_process_command(
pnp_mqtt_message* mqtt_message,
az_iot_status* status);

#endif // SAMPLE_PNP_THERMOSTAT_COMPONENT_H
#endif // PNP_THERMOSTAT_COMPONENT_H

0 comments on commit c85fb41

Please sign in to comment.