diff --git a/PnpBridge/src/PnpBridge/Adapters/CoreDeviceHealth/CoreDeviceHealth.c b/PnpBridge/src/PnpBridge/Adapters/CoreDeviceHealth/CoreDeviceHealth.c
index a520685..7f20e04 100644
--- a/PnpBridge/src/PnpBridge/Adapters/CoreDeviceHealth/CoreDeviceHealth.c
+++ b/PnpBridge/src/PnpBridge/Adapters/CoreDeviceHealth/CoreDeviceHealth.c
@@ -14,7 +14,6 @@
PNP_INTERFACE_CLIENT_HANDLE pnpinterfaceHandle = NULL;
WCHAR* hardwareid = NULL;
-
void WindowsPnpSendEventCallback(PNP_SEND_TELEMETRY_STATUS pnpSendEventStatus, void* userContextCallback)
{
LogInfo("WindowsPnpSendEventCallback called, result=%d, userContextCallback=%p", pnpSendEventStatus, userContextCallback);
diff --git a/PnpBridge/src/PnpBridge/Adapters/CoreDeviceHealth/CoreDeviceManagement.h b/PnpBridge/src/PnpBridge/Adapters/CoreDeviceHealth/CoreDeviceHealth.h
similarity index 100%
rename from PnpBridge/src/PnpBridge/Adapters/CoreDeviceHealth/CoreDeviceManagement.h
rename to PnpBridge/src/PnpBridge/Adapters/CoreDeviceHealth/CoreDeviceHealth.h
diff --git a/PnpBridge/src/PnpBridge/AzureIotApis.cpp b/PnpBridge/src/PnpBridge/AzureIotApis.cpp
deleted file mode 100644
index 990e24a..0000000
--- a/PnpBridge/src/PnpBridge/AzureIotApis.cpp
+++ /dev/null
@@ -1 +0,0 @@
-// Create a jump table for AzureIotApi's
\ No newline at end of file
diff --git a/PnpBridge/src/PnpBridge/PnpAdapterManger.c b/PnpBridge/src/PnpBridge/PnpAdapterManger.c
index 07a6fc0..cfe5643 100644
--- a/PnpBridge/src/PnpBridge/PnpAdapterManger.c
+++ b/PnpBridge/src/PnpBridge/PnpAdapterManger.c
@@ -7,7 +7,7 @@
#include "PnpAdapterInterface.h"
#include "PnpAdapterManager.h"
-#include "CoreDeviceManagement.h"
+#include "CoreDeviceHealth.h"
// TODO: Decide where the extern are present for CoreDeviceHealth
PPNP_INTERFACE_MODULE INTERFACE_MANIFEST[] = {
diff --git a/PnpBridge/src/PnpBridge/PnpBridge.c b/PnpBridge/src/PnpBridge/PnpBridge.c
index 35ae64c..f9a4097 100644
--- a/PnpBridge/src/PnpBridge/PnpBridge.c
+++ b/PnpBridge/src/PnpBridge/PnpBridge.c
@@ -2,26 +2,17 @@
//
#include "common.h"
-
#include "PnpBridgeCommon.h"
-
#include "ConfigurationParser.h"
-
#include "DiscoveryManager.h"
-
#include "PnpAdapterInterface.h"
#include "PnpAdapterManager.h"
#include "PnpBridge.h"
-// Things to implement
-//
-// 1. Allow a module to intercept traffic anf execute commands
-// 2. Clean up all warnings
-// 3. Restart mechanism
-
//////////////////////////// GLOBALS ///////////////////////////////////
PPNP_BRIDGE g_PnpBridge = NULL;
+bool g_Shutdown = false;
////////////////////////////////////////////////////////////////////////
//const char* connectionString = "HostName=iot-pnp-hub1.azure-devices.net;DeviceId=win-gateway;SharedAccessKey=GfbYy7e2PikTf2qHyabvEDBaJB5S4T+H+b9TbLsXfns=";
@@ -82,7 +73,7 @@ PNPBRIDGE_RESULT PnpBridge_Initialize() {
g_PnpBridge->dispatchLock = Lock_Init();
- g_PnpBridge->shuttingDown = false;
+ g_Shutdown = false;
// Connect to Iot Hub and create a PnP device client handle
if ((g_PnpBridge->deviceHandle = InitializeIotHubDeviceHandle()) == NULL)
@@ -103,17 +94,24 @@ void PnpBridge_Release() {
LogInfo("Cleaning DeviceAggregator resources");
- // Stop Device Disovery Modules
+ Lock(g_PnpBridge->dispatchLock);
+
+ // Stop Disovery Modules
if (g_PnpBridge->discoveryMgr) {
DiscoveryAdapterManager_Stop(g_PnpBridge->discoveryMgr);
g_PnpBridge->discoveryMgr = NULL;
}
+ // Stop Pnp Modules
if (g_PnpBridge->interfaceMgr) {
PnpAdapterManager_Release(g_PnpBridge->interfaceMgr);
g_PnpBridge->interfaceMgr = NULL;
}
+ Unlock(g_PnpBridge->dispatchLock);
+
+ Lock_Deinit(g_PnpBridge->dispatchLock);
+
if (g_PnpBridge) {
free(g_PnpBridge);
}
@@ -133,7 +131,7 @@ static PNPBRIDGE_RESULT PnpBridge_Worker_Thread(void* threadArgument)
while (true)
{
ThreadAPI_Sleep(1 * 1000);
- if (g_PnpBridge->shuttingDown) {
+ if (g_Shutdown) {
return PNPBRIDGE_OK;
}
}
@@ -212,7 +210,7 @@ PNPBRIDGE_RESULT PnpBridge_DeviceChangeCallback(PPNPBRIDGE_DEVICE_CHANGE_PAYLOAD
Lock(g_PnpBridge->dispatchLock);
- if (g_PnpBridge->shuttingDown) {
+ if (g_Shutdown) {
LogInfo("PnpBridge is shutting down. Dropping the change notification");
result = PNPBRIDGE_OK;
goto end;
@@ -325,7 +323,7 @@ PNPBRIDGE_RESULT PnpBridge_Main() {
void PnpBridge_Stop() {
Lock(g_PnpBridge->dispatchLock);
- g_PnpBridge->shuttingDown = true;
+ g_Shutdown = true;
Unlock(g_PnpBridge->dispatchLock);
}
diff --git a/PnpBridge/src/PnpBridge/PnpBridge.h b/PnpBridge/src/PnpBridge/PnpBridge.h
index 75eeadb..9047de7 100644
--- a/PnpBridge/src/PnpBridge/PnpBridge.h
+++ b/PnpBridge/src/PnpBridge/PnpBridge.h
@@ -20,6 +20,4 @@ typedef struct _PNP_BRIDGE {
LOCK_HANDLE dispatchLock;
- bool shuttingDown;
-
} PNP_BRIDGE, *PPNP_BRIDGE;
\ No newline at end of file
diff --git a/PnpBridge/src/PnpBridge/PnpBridge.vcxproj b/PnpBridge/src/PnpBridge/PnpBridge.vcxproj
index 33013f5..26a8b5c 100644
--- a/PnpBridge/src/PnpBridge/PnpBridge.vcxproj
+++ b/PnpBridge/src/PnpBridge/PnpBridge.vcxproj
@@ -159,14 +159,13 @@
-
+
-
@@ -181,7 +180,6 @@
-
diff --git a/PnpBridge/src/PnpBridge/PnpBridge.vcxproj.filters b/PnpBridge/src/PnpBridge/PnpBridge.vcxproj.filters
index 58507c8..ea0b3aa 100644
--- a/PnpBridge/src/PnpBridge/PnpBridge.vcxproj.filters
+++ b/PnpBridge/src/PnpBridge/PnpBridge.vcxproj.filters
@@ -13,27 +13,18 @@
{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
-
- {25d83aa5-41e0-46a6-8795-0a4a201a426a}
+
+ {3524bf36-1d0b-46dc-ada9-78d0803fe1ec}
-
+
+ {611fd0c7-a77f-4116-bf8a-c41bded6d8a3}
+
+
+ {28fe5595-e94e-4bac-ac50-03299b219cd8}
+
+
{92a538f9-7056-4277-a567-906bc28ce6a8}
-
- {0329e27d-0e6f-466f-95d1-3749ca7dcba7}
-
-
- {df63643c-8046-4f8c-9993-c8697c94c0c8}
-
-
- {7f915d09-7994-4c58-947e-5d0d6133ebf5}
-
-
- {e845b3ea-044d-4c18-b3ac-79eadb3aa765}
-
-
- {030cf99a-0879-4d3d-bdfc-580b70e86191}
-
@@ -42,73 +33,67 @@
Header Files
-
- common
-
- inc
+ Source Files\inc
- inc
+ Source Files\inc
- inc
+ Source Files\inc
- inc
+ Source Files\inc
- inc
+ Source Files\inc
-
- Source Files
-
-
- inc
-
-
- Header Files
+ Source Files\inc
- Header Files
+ Source Files\Adapters\CoreDeviceHealth
+
+
+ Source Files\inc
+
+
+ Source Files\inc
+
+
+ Source Files\Adapters\CoreDeviceHealth
Source Files
-
- discovery
-
-
- pnpinterface\Modules
-
-
- pnpinterface
-
-
- configuration
-
Source Files
Source Files
-
+
+ Source Files\Adapters\CoreDeviceHealth
+
+
Source Files
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files\Adapters\Serial
+
- Source Files
-
-
- Source Files
+ Source Files\Adapters\CoreDeviceHealth
-
- configuration
-
+
\ No newline at end of file