Exemplo n.º 1
0
  public AbstractConnectedDevice(
      final Subscriber subscriber, final Publisher publisher, final EventLoop eventLoop) {
    super(subscriber, publisher, eventLoop);
    DeviceConnectivityTypeSupport.register_type(
        domainParticipant, DeviceConnectivityTypeSupport.get_type_name());
    deviceConnectivityTopic =
        TopicUtil.findOrCreateTopic(
            domainParticipant, DeviceConnectivityTopic.VALUE, DeviceConnectivityTypeSupport.class);
    deviceConnectivityWriter =
        (DeviceConnectivityDataWriter)
            publisher.create_datawriter_with_profile(
                deviceConnectivityTopic,
                QosProfiles.ice_library,
                QosProfiles.state,
                null,
                StatusKind.STATUS_MASK_NONE);

    if (null == deviceConnectivityWriter) {
      throw new RuntimeException("unable to create writer");
    }

    deviceConnectivity = new DeviceConnectivity();
    deviceConnectivity.type = getConnectionType();
    deviceConnectivity.state = getState();
  }
Exemplo n.º 2
0
 @Override
 public void emit(
     ice.ConnectionState newState, ice.ConnectionState oldState, String transitionNote) {
   stateChanging(newState, oldState, transitionNote);
   log.debug(oldState + "==>" + newState + " (" + transitionNote + ")");
   deviceConnectivity.state = newState;
   deviceConnectivity.info = transitionNote;
   InstanceHandle_t handle = deviceConnectivityHandle;
   if (handle != null) {
     writeDeviceConnectivity();
   }
   stateChanged(newState, oldState, transitionNote);
 };
Exemplo n.º 3
0
 protected void writeDeviceConnectivity() {
   deviceConnectivity.unique_device_identifier = deviceIdentity.unique_device_identifier;
   if (null == deviceConnectivity.unique_device_identifier
       || "".equals(deviceConnectivity.unique_device_identifier)) {
     throw new IllegalStateException("No UDI");
   }
   if (null == deviceConnectivityHandle) {
     deviceConnectivityHandle = deviceConnectivityWriter.register_instance(deviceConnectivity);
   }
   deviceConnectivityWriter.write(deviceConnectivity, deviceConnectivityHandle);
 }
Exemplo n.º 4
0
 protected void setConnectionInfo(String connectionInfo) {
   if (null == connectionInfo) {
     // TODO work on nullity semantics
     log.warn("Attempt to set connectionInfo null");
     connectionInfo = "";
   }
   if (!connectionInfo.equals(deviceConnectivity.info)) {
     deviceConnectivity.info = connectionInfo;
     writeDeviceConnectivity();
   }
 }