private void OnReportedPropertyChanged(TwinCollection reportedPropertyMap) { synchronized (DEVICE_TWIN_LOCK) { if (reportedPropertyMap != null) { for (Iterator reportedPropertyIt = reportedPropertyMap.entrySet().iterator(); reportedPropertyIt.hasNext();) { Map.Entry<String, String> reportedProperty = (Map.Entry<String, String>) reportedPropertyIt.next(); Property property = this.getProperty(reportedPropertyMap, reportedProperty.getKey(), true); /* **Codes_SRS_DEVICETWIN_25_023: [**OnReportedPropertyChanged callback shall look for the user registered call back on the property that changed and if no callback is registered or is null then OnDesiredPropertyChange shall call the user on generic callback providing with the desired property change key and value pair**]** */ if(deviceTwinGenericTwinPropertyChangeCallback != null) { deviceTwinGenericTwinPropertyChangeCallback.TwinPropertyCallBack(property, deviceTwinGenericPropertyChangeCallbackContext); } reportedPropertyIt.remove(); } } } }
private void OnDesiredPropertyChanged(TwinCollection desiredPropertyMap) { synchronized (DEVICE_TWIN_LOCK) { if (desiredPropertyMap != null) { for (Iterator desiredPropertyIt = desiredPropertyMap.entrySet().iterator(); desiredPropertyIt.hasNext();) { Map.Entry<String, String> desiredProperty = (Map.Entry<String, String>) desiredPropertyIt.next(); Property property = this.getProperty(desiredPropertyMap, desiredProperty.getKey(), false); /* **Codes_SRS_DEVICETWIN_25_022: [**OnDesiredPropertyChange callback shall look for the user registered call back on the property that changed provided in desiredPropertyMap and call the user providing the desired property change key and value pair**]** */ if (!reportPropertyCallback(property)) { /* **Codes_SRS_DEVICETWIN_25_023: [**OnDesiredPropertyChange callback shall look for the user registered call back on the property that changed and if no callback is registered or is null then OnDesiredPropertyChange shall call the user on generic callback providing with the desired property change key and value pair**]** */ reportDeviceTwinGenericPropertyCallback(property); } desiredPropertyIt.remove(); } } } }