Exemple #1
0
        private void OnTelemetryPublishAlarm(object sender, ElapsedEventArgs arg)
        {
            using (var udpClient = new UdpClient(AddressFamily.InterNetwork))
            {
                ProsthesisCore.Telemetry.ProsthesisTelemetry telem = mTelem;
                ProsthesisDataPacket packet = ProsthesisCore.Messages.ProsthesisDataPacket.BoxMessage <ProsthesisCore.Telemetry.ProsthesisTelemetry>(telem);

                ProsthesisCore.Telemetry.ProsthesisTelemetry newTelem = ProsthesisCore.Messages.ProsthesisDataPacket.UnboxMessage(packet) as ProsthesisCore.Telemetry.ProsthesisTelemetry;


                if (packet != null)
                {
                    IPAddress  address    = IPAddress.Parse(ProsthesisCore.ProsthesisConstants.kMulticastGroupAddress);
                    IPEndPoint ipEndPoint = new IPEndPoint(address, ProsthesisCore.ProsthesisConstants.kTelemetryPort);
                    udpClient.JoinMulticastGroup(address, 50);
                    udpClient.Send(packet.Bytes, packet.Bytes.Length, ipEndPoint);
                    udpClient.Close();
                }
                else
                {
                    // mLogger.LogMessage(ProsthesisCore.Utility.Logger.LoggerChannels.Telemetry, "Failed to box telemetry message");
                }
            }
        }
 public ProsthesisTelemetry(ProsthesisTelemetry other)
 {
     MT   = new ProsthesisMotorTelemetry(other.MT);
     ST   = new ProsthesisSensorTelemetry(other.ST);
     BMST = new ProsthesisBMSTelemetry(other.BMST);
 }