protected virtual void OnDateTimeDataReceived(DateTimeData e) { if (DateTimeDataReceived != null) { DateTimeDataReceived(this, e); } }
/// <summary> /// Constructs a write date/time packet. /// </summary> /// <param name="dateTimeData"> /// <see cref="DateTimeData"/> instance containing data to be written. /// </param> /// <returns> /// Constructed and encoded write date/time packet /// </returns> public static byte[] ConstructWriteDateTimePacket(DateTimeData dateTimeData) { byte[] decodedPacket = new byte[] { (byte)PacketHeaders.WriteDateTime, (byte)(((((dateTimeData.Year - 2000) % 100) / 10) << 4) | ((dateTimeData.Year - 2000) % 10)), (byte)(((((dateTimeData.Month) % 100) / 10) << 4) | (dateTimeData.Month % 10)), (byte)(((((dateTimeData.Day) % 100) / 10) << 4) | (dateTimeData.Day % 10)), (byte)(((((dateTimeData.Hours) % 100) / 10) << 4) | (dateTimeData.Hours % 10)), (byte)(((((dateTimeData.Minutes) % 100) / 10) << 4) | (dateTimeData.Minutes % 10)), (byte)(((((dateTimeData.Seconds) % 100) / 10) << 4) | (dateTimeData.Seconds % 10)), 0 }; decodedPacket = InsertChecksum(decodedPacket); return(PacketEncoding.EncodePacket(decodedPacket)); }
protected virtual void OnDateTimeDataReceived(DateTimeData e) { if (DateTimeDataReceived != null) DateTimeDataReceived(this, e); }
/// <summary> /// Sends write date/time packet. /// </summary> /// <param name="dateTimeData"> /// Date/time data to be written. /// </param> public void SendWriteDateTimePacket(DateTimeData dateTimeData) { SendByteArray(PacketConstruction.ConstructWriteDateTimePacket(dateTimeData)); PacketsWrittenCounter.WriteDateTimePackets++; }
/// <summary> /// Write <see cref="DateTimeData"/> to CSV file. Will create new file if required. /// </summary> /// <param name="dateTimeData"> /// x-IMU data/time data. /// </param> public void WriteDateTimeData(DateTimeData dateTimeData) { WriteCSVlineAtFileIndex(dateTimeData.ConvertToCSVstring(), FileIndexes.DateTime); PacketsWrittenCounter.WriteDateTimePackets++; }
/// <summary> /// Constructs a write date/time packet. /// </summary> /// <param name="dateTimeData"> /// <see cref="DateTimeData"/> instance containing data to be written. /// </param> /// <returns> /// Constructed and encoded write date/time packet /// </returns> public static byte[] ConstructWriteDateTimePacket(DateTimeData dateTimeData) { byte[] decodedPacket = new byte[] { (byte)PacketHeaders.WriteDateTime, (byte)(((((dateTimeData.Year - 2000) % 100) / 10) << 4) | ((dateTimeData.Year - 2000) % 10)), (byte)(((((dateTimeData.Month) % 100) / 10) << 4) | (dateTimeData.Month % 10)), (byte)(((((dateTimeData.Day) % 100) / 10) << 4) | (dateTimeData.Day % 10)), (byte)(((((dateTimeData.Hours) % 100) / 10) << 4) | (dateTimeData.Hours % 10)), (byte)(((((dateTimeData.Minutes) % 100) / 10) << 4) | (dateTimeData.Minutes % 10)), (byte)(((((dateTimeData.Seconds) % 100) / 10) << 4) | (dateTimeData.Seconds % 10)), 0}; decodedPacket = InsertChecksum(decodedPacket); return PacketEncoding.EncodePacket(decodedPacket); }