示例#1
0
        protected virtual void DidCharacteristicNotify(GattCharacteristic characteristic, GattValueChangedEventArgs args)
        {
            byte[] data = args.CharacteristicValue.ToArray();

            if (characteristic.Uuid == BluetoothRobotConstants.RECEIVE_DATA_CHARACTERISTIC_UUID)
            {
                if (IsBTFirmwareUpdateMode())
                {
                    DidReceiveFirmwareData(data);
                }
                else
                {
                    DidNotifyByReceiveDataCharacteristic(BaseService.ConvertBytesFromHexBytes(data));
                }
            }
            else if (characteristic.Uuid == BluetoothRobotConstants.RSSI_REPORT_SERVICE_UUID)
            {
                Debug.WriteLine("RSSI: " + BaseService.ConvertIntFromBytes(data));
            }
            else if (characteristic.Uuid == BluetoothRobotConstants.MODULE_PARAMETER_CUSTOM_BOARDCAST_DATA_CHARACTERISTIC_UUID)
            {
                CustomBoardcastData = BaseService.ConvertDictionaryFromBytes(data);
            }
        }