Exemplo n.º 1
0
 private void buttonNoti_Click(object sender, EventArgs e)
 {
     Byte[] data = new Byte[2] {
         0x00, 0x01
     };
     masterEmulator.SendData(pipeElecNotification, data);
 }
Exemplo n.º 2
0
        /// <summary>
        /// Send data to peer device.
        /// </summary>
        /// <param name="value"></param>
        public void SendData(string value)
        {
            byte[] encodedBytes = Encoding.UTF8.GetBytes(value);

            if (encodedBytes.Length > maxPacketLength)
            {
                Array.Resize <byte>(ref encodedBytes, maxPacketLength);
                AddToLog("Max packet size is 20 characters, text is truncated.");
            }

            masterEmulator.SendData(pipeSetup.UartRxPipe, encodedBytes);

            string decodedString = Encoding.UTF8.GetString(encodedBytes);

            AddToLog(string.Format("TX: {0}", decodedString));
        }