Bind and Unbind Devices

To bind or unbind a single device the SDK provides the methods bindDevice(MedicalDeviceTO medicalDevice) and unbindDevice(MedicalDeviceTO medicalDevice). The parameter medicalDevice indicates the device that should be bound or unbound. Only the attribute deviceId of this data structure is used (and only read) within these functions.

// this example code will bind myMedicalDevice1 and unbind
// myMedicalDevice2

If the device is successfully bound or unbound the binding state of this device changes to DeviceBindingState.BOUND or DeviceBindingState.UNBOUND and the event onDeviceBindingStateChanges of the listener SDKDevicesListener will be fired.

public class MySDKDevicesListener implements SDKDevicesListener {
    public void onDeviceBindingStateChanges(MedicalDeviceTO
            medicalDevice) {
        switch(medicalDevice.getDeviceBindingState()) {
        case UNBOUND:
            // indicates that this device is unbound yet...
        case BINDING:
            // the binding operation is in progress
        case BOUND:
            // now, the device is bound
        case UNBINDING:
            // the unbinding operation is in progress
        // ...test all other possible states here

Multiple devices can be bound or unbound with the method bindDevices( List medicalDevices) or unbindDevices(List medicalDevices) of the SDK.

// create two device lists
List devicesToBind = new ArrayList(2);
List devicesToUnbind = new ArrayList(2);
// bind and undbind these devices

To bind all unbound devices the method bindAllUnboundDevices() can be used. Vice versa the method unbindAllBoundDevices() unbinds all bound devices.

// bind all unbound devices
// unbind all bound devices
sdk.unbindAllBoundDevices(); Logo