Esempio 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();
  }
Esempio 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);
 };