Writing Device Information

The method setDeviceConfiguration() of the sdk will set configurations of a device. The first parameter (medicalDevice) of this function represents a medical device data object which includes all configuration data that should be set. With the second parameter (configurations) all configurations are marked that should be actually written. Possible values for this parameter are: SDK.DATETIME, SDK.SERIAL_NUMBER, SDK.FIRMWARE, SDK.IEEE_MAC_ADDRESS, SDK.USER_SETTING, SDK.DEVICE_STATUS. To write multiple configurations this constants can be combined with the bitwise or operator |.

// set the date time to Christmas 2000 and activate the first two
// users for the device...
DateTimeTO dateTime = new DateTimeTO(2000,12,24,12,0,0);
UserSettingTO userSetting = new UserSettingTO(
    1,
    true,true,false,false,
    false,false,false,false);
myMedicalDevice.setDateTime(dateTime);
myMedicalDevice.setUserSetting(userSetting);
sdk.setDeviceConfiguration(myMedicalDevice,
    SDK.DATETIME | SDK.USER_SETTING);

Just like for reading configurations, the event onDeviceConfigurationUpdate() of the SDKDevicesListener is fired for each configuration that was written and that has changed. The first parameter of this method (medicalDevice) contains all the currently known information of the device. The Parameter configuration represents the actually updated configuration.

public class MySDKDevicesListener implements SDKDevicesListener {
    public void onSearchResult(MedicalDeviceTO medicalDevice) {}
    public void onDeviceOnlineStateChanges(MedicalDeviceTO
        medicalDevice) {}
    public void onDeviceBindStateChanges(MedicalDeviceTO
        medicalDevice) {}
    public void onDeviceConfigurationUpdate(MedicalDeviceTO
            medicalDevice, int configuration) {
        switch(configuration) {
        case SDK.DATETIME:
            System.out.println("device time updated: "+
                medicalDevice.getDateTime());
            break;
        case SDK.SERIAL_NUMBER:
            // ...
            break;
        // ...
        }
    }
    public void onDeviceStatusChanges(MedicalDeviceTO
        medicalDevice) {}
}

In the case of communication problems the event onCommunicationError() of the SDKErrorListener is fired.

 
SourceForge.net Logo