Beispiel #1
0
        private void ProcesBuffer()
        {
            PioneerMessage msg = PioneerMessageFactory.Deserialize(_rawBuff);

            if (msg != null && MessageReceived != null)
            {
                MessageReceived(this, new MessageReceivedEventArgs(msg));
            }
        }
Beispiel #2
0
        public void SendMessage(Type messageType, params object[] args)
        {
            if (messageType.BaseType.BaseType != typeof(PioneerMessage))
            {
                throw new InvalidCastException("messageType must be of type PioneerMessage");
            }
            // get type for message
            var type = PioneerMessageFactory.GetTypeForMessage(messageType);

            SendMessage(type, args);
        }
Beispiel #3
0
 public void SendMessage(MessageType type, params object[] args)
 {
     byte[] b = null;
     try {
         PioneerMessage mess = PioneerMessageFactory.Create(type, args);
         b = Encoding.Default.GetBytes(mess.Serialize());
     }
     catch (ArgumentException) { }
     if (b != null)
     {
         CurrentDataSource.Write(b);
     }
 }