예제 #1
0
        private async Task <bool> BLE_Send(byte[] data)
        {
            Int32 Res = Client.WriteCharacteristicValue(WriteCharacteristic, data);

            if (Res != wclErrors.WCL_E_SUCCESS)
            {
                CSLibrary.Debug.WriteLine("Error: 0x" + Res.ToString("X8"));
                return(false);
            }

            return(true);
        }
예제 #2
0
        private void WriteCommand(byte[] package)
        {
            var str = "";

            for (var i = 0; i < package.Length; i++)
            {
                str = str + package[i].ToString("X2");
            }

            var resWrite = _client.WriteCharacteristicValue(_txCharacteristic, package);

            if (resWrite != wclErrors.WCL_E_SUCCESS)
            {
                TraceEvent(_client.Address, "TX", "Status", "Failed");
            }
            else
            {
                TraceEvent(_client.Address, "TX", "Data", str);
                TraceEvent(_client.Address, "TX", "Status", "Success");
            }
        }
예제 #3
0
        public void WritePacket(byte[] pkt)
        {
            int Res = Client.WriteCharacteristicValue(WriteCh, pkt, wclGattProtectionLevel.plNone);

            sentState = Res == wclErrors.WCL_E_SUCCESS ? 1 : 0;
        }