public override void on_requested_deadline_missed( DDS.DataReader reader, ref DDS.RequestedDeadlineMissedStatus status) { deadline_contentfilterDataReader deadline_contentfilter_reader = (deadline_contentfilterDataReader)reader; // Get the date and time for the current moment, adjusted // to the local time zone. DateTime currentTime = DateTime.Now; TimeSpan span = currentTime.Subtract(initTime); deadline_contentfilter dummy = new deadline_contentfilter(); try { deadline_contentfilter_reader.get_key_value( dummy, ref status.last_instance_handle); } catch (DDS.Exception e) { Console.WriteLine("get_key_value error {0}\n", e); return; } // Display the value and Kind property of the current moment Console.WriteLine("Missed deadline @ t={0}.{1}s on instance code = {2}\n", span.Seconds, span.Milliseconds, dummy.code); }
public override void on_data_available(DDS.DataReader reader) { deadline_contentfilterDataReader deadline_contentfilter_reader = (deadline_contentfilterDataReader)reader; try { deadline_contentfilter_reader.take( data_seq, info_seq, DDS.ResourceLimitsQosPolicy.LENGTH_UNLIMITED, DDS.SampleStateKind.ANY_SAMPLE_STATE, DDS.ViewStateKind.ANY_VIEW_STATE, DDS.InstanceStateKind.ANY_INSTANCE_STATE); } catch (DDS.Retcode_NoData) { return; } catch (DDS.Exception e) { Console.WriteLine("take error {0}", e); return; } // Declare and get DateTime values DateTime currentTime = System.DateTime.Now; TimeSpan span = currentTime.Subtract(initTime); System.Int32 data_length = data_seq.length; for (int i = 0; i < data_length; ++i) { if (info_seq.get_at(i).valid_data) { //deadlineTypeSupport.print_data(data_seq.get_at(i)); Console.WriteLine("@ t={0}.{1}s, Instance{2}: <{3},{4}>\n", span.Seconds, span.Milliseconds, data_seq.get_at(i).code, data_seq.get_at(i).x, data_seq.get_at(i).y); } } try { deadline_contentfilter_reader.return_loan(data_seq, info_seq); } catch (DDS.Exception e) { Console.WriteLine("return loan error {0}", e); } }