예제 #1
0
        private static void Main(string[] args)
        {
            byte[] data = new byte[] { 0x99, 0x0A, 0x01, 0xAA, 0x01, 0xAA, 0xAA, 0x01, 0xAA, 0x05, 0x55,
                                       0x8A, 0x55, 0xB9, 0x55, 0x75, 0x01, 0x02, 0x6F, 0xFF, 0x99, 0x99,
                                       0x0A, 0x01, 0xAA, 0x01, 0xAA, 0xAA, 0x01, 0xAA, 0x05, 0x55, 0x8A,
                                       0x55, 0xB9, 0x55, 0x75, 0x01, 0x02, 0x6F, 0xFF, 0x99 };

            BlockingCollection <byte[]> col1 = new BlockingCollection <byte[]>();
            BlockingCollection <byte[]> col2 = new BlockingCollection <byte[]>();

            LinkUpMemoryConnector slaveToMaster = new LinkUpMemoryConnector(col1, col2);
            LinkUpMemoryConnector masterToSlave = new LinkUpMemoryConnector(col2, col1);

            slaveToMaster.ReveivedPacket += SlaveToMaster_ReveivedPacket;
            masterToSlave.ReveivedPacket += MasterToSlave_ReveivedPacket;

            slaveToMaster.SendPacket(new LinkUpPacket()
            {
                Data = data
            });
            masterToSlave.SendPacket(new LinkUpPacket()
            {
                Data = data
            });

            Console.Read();
        }
예제 #2
0
        private static void StaticTest1()
        {
            byte[] data = new byte[] { 0x99, 0xa, 0x1, 0xAA, 0x1, 0xAA, 0xAA, 0x1, 0xAA, 0x5, 0x55, 0x8A, 0x55, 0xB9, 0x55, 0x75, 0x1, 0x2, 0x6F, 0xFF, 0x99, 0x99, 0xa, 0x1, 0xAA, 0x1, 0xAA, 0xAA, 0x1, 0xAA, 0x5, 0x55, 0x8A, 0x55, 0xB9, 0x55, 0x75, 0x1, 0x2, 0x6F, 0xFF, 0x99 };

            BlockingCollection <byte[]> col1 = new BlockingCollection <byte[]>();
            BlockingCollection <byte[]> col2 = new BlockingCollection <byte[]>();

            LinkUpMemoryConnector c1 = new LinkUpMemoryConnector(col1, col2);
            LinkUpMemoryConnector c2 = new LinkUpMemoryConnector(col2, col1);

            c1.ReveivedPacket += MasterToSlave_ReveivedPacket;
            c2.ReveivedPacket += SlaveToMaster_ReveivedPacket;

            c1.SendPacket(new LinkUpPacket()
            {
                Data = data
            });

            Console.Read();
        }