mita icon indicating copy to clipboard operation
mita copied to clipboard

BLE characteristic are initialized with weird number and can't modify them until we connect

Open xAlban opened this issue 6 years ago • 4 comments

When I initialize some BLE characteristic, the values of each are some weird numbers :

Mita code :

setup bluetooth : BLE { deviceName = "XDK_BLE"; advertisingInterval = 2000; var yellow = bool_characteristic(0x0001); var orange = bool_characteristic(0x0002); var red = bool_characteristic(0x0003); }

I print yellow, orange and red after initialization and I get this : capture d ecran 2018-05-24 a 10 44 44

Even if I try to change those values with write() they don't change unless I connect with my phone on the XDK.

xAlban avatar May 24 '18 08:05 xAlban

@priyashiyadav:

  • implement modality connected : bool
  • add exception NOT_CONNECTED or similar
  • throw exception on read/write on not connected BLE

wegendt-bosch avatar May 25 '18 09:05 wegendt-bosch

would it make sense to add a default argument to the signal? E.g.

setup bluetooth : BLE {
    deviceName = "XDK_BLE";
    advertisingInterval = 2000;
    var yellow = bool_characteristic(0x0001, default=true);
    var orange = bool_characteristic(0x0002, default=false);
    var red = bool_characteristic(0x0003, default=true);
}

csweichel avatar May 25 '18 14:05 csweichel

@32leaves how will default argument help ?

priyashiyadav avatar May 28 '18 06:05 priyashiyadav

These values would be used to initialize the BLE storage variables. Maybe „init“ would be a better name?

wegendt-bosch avatar May 28 '18 07:05 wegendt-bosch