Example #1
0
        public async Task <bool> WriteBTDeviceName(string name)
        {
            string deviceName = name;

            //trim the device name
            if (name.Length > MAX_BT_DEVICE_NAME_LENGTH)
            {
                //TODO show log msg

                deviceName = name.Substring(0, MAX_BT_DEVICE_NAME_LENGTH);
            }

            List <byte> data = new List <byte>();

            data.Add(0x00);
            data.AddRange(BaseService.ConvertBytesFromString(deviceName));

            return(await base.WriteCharacteristicValueAsync(BluetoothRobotConstants.MODULE_PARAMETER_DEVICE_NAME_CHARACTERISTIC_UUID, data.ToArray()));
        }