()
| 117 | } |
| 118 | |
| 119 | public void read() { |
| 120 | Subscriber subscriber = |
| 121 | participant.create_subscriber(SUBSCRIBER_QOS_DEFAULT.get(), null, DEFAULT_STATUS_MASK.value); |
| 122 | |
| 123 | assert (subscriber != null); |
| 124 | |
| 125 | TheTransportRegistry.bind_config(transportConfig, subscriber); |
| 126 | |
| 127 | subscriber.create_datareader(topic, DATAREADER_QOS_DEFAULT.get(), |
| 128 | new _DataReaderListenerLocalBase () { |
| 129 | |
| 130 | public void on_liveliness_changed(DataReader dr, LivelinessChangedStatus status) {} |
| 131 | |
| 132 | public void on_requested_deadline_missed(DataReader dr, RequestedDeadlineMissedStatus status) {} |
| 133 | |
| 134 | public void on_requested_incompatible_qos(DataReader dr, RequestedIncompatibleQosStatus status) {} |
| 135 | |
| 136 | public void on_sample_lost(DataReader reader, SampleLostStatus status) {} |
| 137 | |
| 138 | public void on_sample_rejected(DataReader dr, SampleRejectedStatus status) {} |
| 139 | |
| 140 | public void on_subscription_matched(DataReader dr, SubscriptionMatchedStatus status) {} |
| 141 | |
| 142 | public void on_data_available(DataReader dr) { |
| 143 | MessageDataReader reader = MessageDataReaderHelper.narrow(dr); |
| 144 | |
| 145 | MessageHolder mh = new MessageHolder(new Message()); |
| 146 | |
| 147 | SampleInfo si = new SampleInfo(); |
| 148 | si.source_timestamp = new DDS.Time_t(); |
| 149 | |
| 150 | SampleInfoHolder sih = new SampleInfoHolder(si); |
| 151 | reader.take_next_sample(mh, sih); |
| 152 | |
| 153 | read = true; |
| 154 | |
| 155 | if (si.valid_data) { |
| 156 | System.out.printf("[%s] read: \"%s\"\n", participant, mh.value.text); |
| 157 | } |
| 158 | } |
| 159 | }, DEFAULT_STATUS_MASK.value |
| 160 | ); |
| 161 | } |
| 162 | |
| 163 | public boolean isRead() { |
| 164 | return read; |
no test coverage detected