diff --git a/components/device-mgt-iot-virtualfirealarm/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/agent/communication/xmpp/FireAlarmXMPPCommunicator.java b/components/device-mgt-iot-virtualfirealarm/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/agent/communication/xmpp/FireAlarmXMPPCommunicator.java index 2864b759eb..b05fe32b77 100644 --- a/components/device-mgt-iot-virtualfirealarm/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/agent/communication/xmpp/FireAlarmXMPPCommunicator.java +++ b/components/device-mgt-iot-virtualfirealarm/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/agent/communication/xmpp/FireAlarmXMPPCommunicator.java @@ -88,8 +88,7 @@ public class FireAlarmXMPPCommunicator extends XMPPTransportHandler { } catch (TransportHandlerException e) { if (log.isDebugEnabled()) { log.warn(AgentConstants.LOG_APPENDER + - "Connection/Login to XMPP server at: " + server + - " failed"); + "Connection/Login to XMPP server at: " + server + " failed"); } } } @@ -219,22 +218,24 @@ public class FireAlarmXMPPCommunicator extends XMPPTransportHandler { public void disconnect() { Runnable stopConnection = new Runnable() { public void run() { - while (isConnected()) { + + if ( dataPushServiceHandler != null) { dataPushServiceHandler.cancel(true); + } + + while (isConnected()) { connectorServiceHandler.cancel(true); closeConnection(); if (log.isDebugEnabled()) { log.warn(AgentConstants.LOG_APPENDER + - "Unable to 'STOP' connection to XMPP server at: " + - server); + "Unable to 'STOP' connection to XMPP server at: " + server); } try { Thread.sleep(timeoutInterval); } catch (InterruptedException e1) { - log.error(AgentConstants.LOG_APPENDER + - "XMPP-Terminator: Thread Sleep Interrupt Exception"); + log.error(AgentConstants.LOG_APPENDER + "XMPP-Terminator: Thread Sleep Interrupt Exception"); } } diff --git a/features/device-mgt-iot-arduino-feature/org.wso2.carbon.device.mgt.iot.arduino.feature/src/main/resources/agent/ArduinoBoardSketch.h b/features/device-mgt-iot-arduino-feature/org.wso2.carbon.device.mgt.iot.arduino.feature/src/main/resources/agent/ArduinoBoardSketch.h index c8ac26e914..3a1fe1ab9d 100644 --- a/features/device-mgt-iot-arduino-feature/org.wso2.carbon.device.mgt.iot.arduino.feature/src/main/resources/agent/ArduinoBoardSketch.h +++ b/features/device-mgt-iot-arduino-feature/org.wso2.carbon.device.mgt.iot.arduino.feature/src/main/resources/agent/ArduinoBoardSketch.h @@ -30,14 +30,14 @@ #define WLAN_SSID "SSID" // cannot be longer than 32 characters! #define WLAN_PASS "password" -#define WLAN_SECURITY WLAN_SEC_WPA +#define WLAN_SECURITY WLAN_SEC_WPA2 // Security can be WLAN_SEC_UNSEC, WLAN_SEC_WEP, WLAN_SEC_WPA or WLAN_SEC_WPA2 #define IDLE_TIMEOUT_MS 3000 #define DEVICE_OWNER "${DEVICE_OWNER}" #define DEVICE_ID "${DEVICE_ID}" #define DEVICE_TOKEN "${DEVICE_TOKEN}" -#define REFRESH_DEVICE_TOKEN "${REFRESH_DEVICE_TOKEN}" +#define REFRESH_DEVICE_TOKEN "${DEVICE_REFRESH_TOKEN}" #define SERVICE_PORT 9763