@@ -72,27 +72,27 @@ Adafruit_NeoPixel neopixels = Adafruit_NeoPixel(NEOPIXEL_NUM, PIN_NEOPIXEL, NEO_
7272
7373#define UUID_GEN (val ) (" 81c30e5c-" val " -4f7d-a886-de3e90749161" )
7474
75- BLEService service (UUID_GEN(" 0000" ));
76-
77- BLECharacteristic dataProviderTxChar (UUID_GEN(" 1001" ), BLERead | BLENotify, 9 * FLOAT_BYTE_SIZE);
78- BLECharacteristic dataProviderLabelsTxChar (UUID_GEN( " 1002 " ), BLERead , 128);
79- BLECharacteristic versionTxChar (UUID_GEN( " 1003 " ), BLERead , 1, true);
80- // BLECharacteristic inferenceTxChar (UUID_GEN("1004"), BLERead | BLENotify, 3);
81- //
82- // BLEUnsignedCharCharacteristic numClassesRxChar (UUID_GEN("2001"), BLEWrite);
83- // BLEIntCharacteristic numSamplesRxChar (UUID_GEN("2002"), BLEWrite);
84- // BLEIntCharacteristic captureDelayRxChar (UUID_GEN("2003"), BLEWrite);
85- // BLEFloatCharacteristic thresholdRxChar (UUID_GEN("2004"), BLEWrite);
86- // BLEBoolCharacteristic disableMagnetometerRx (UUID_GEN("2005"), BLEWrite);
87- //
88- // BLEUnsignedCharCharacteristic stateRxChar (UUID_GEN("3001"), BLEWrite);
89- // BLEUnsignedCharCharacteristic stateTxChar (UUID_GEN("3002"), BLERead | BLENotify);
90- // BLEUnsignedCharCharacteristic fileTransferTypeRxChar (UUID_GEN("3003"), BLEWrite);
91- // BLEBoolCharacteristic hasModelTxChar (UUID_GEN("3004"), BLERead | BLENotify);
92- //
93- // // Meta is for future-proofing, we can use it to store and read any 64 bytes
94- // BLECharacteristic metaRxChar (UUID_GEN("4001"), BLEWrite , 64);
95- // BLECharacteristic metaTxChar (UUID_GEN("4002"), BLERead , 64);
75+ BLEService service (UUID_GEN(" 0000" ));
76+
77+ BLECharacteristic dataProviderTxChar (UUID_GEN(" 1001" ) , BLERead | BLENotify , 9 * FLOAT_BYTE_SIZE);
78+ BLECharacteristic dataProviderLabelsTxChar (UUID_GEN( " 1002 " ) , BLERead , 128);
79+ BLECharacteristic versionTxChar (UUID_GEN( " 1003 " ) , BLERead , 1 , true);
80+ BLECharacteristic inferenceTxChar (UUID_GEN(" 1004" ) , BLERead | BLENotify , 3 , true );
81+
82+ BLECharacteristic numClassesRxChar (UUID_GEN(" 2001" ) , BLEWrite , 1 , true );
83+ BLECharacteristic numSamplesRxChar (UUID_GEN(" 2002" ) , BLEWrite , 4 , true );
84+ BLECharacteristic captureDelayRxChar (UUID_GEN(" 2003" ) , BLEWrite , 4 , true );
85+ BLECharacteristic thresholdRxChar (UUID_GEN(" 2004" ) , BLEWrite , 4 , true );
86+ BLECharacteristic disableMagnetometerRx (UUID_GEN(" 2005" ) , BLEWrite , 1 , true );
87+
88+ BLECharacteristic stateRxChar (UUID_GEN(" 3001" ) , BLEWrite , 1 , true );
89+ BLECharacteristic stateTxChar (UUID_GEN(" 3002" ) , BLERead | BLENotify , 1 , true );
90+ BLECharacteristic fileTransferTypeRxChar (UUID_GEN(" 3003" ) , BLEWrite , 1 , true );
91+ BLECharacteristic hasModelTxChar (UUID_GEN(" 3004" ) , BLERead | BLENotify , 1 , true );
92+
93+ // Meta is for future-proofing, we can use it to store and read any 64 bytes
94+ BLECharacteristic metaRxChar (UUID_GEN( " 4001 " ) , BLEWrite , 64);
95+ BLECharacteristic metaTxChar (UUID_GEN( " 4002 " ) , BLERead , 64);
9696
9797/* ***********************************************************************
9898* Model file transfer
@@ -421,6 +421,7 @@ void setup()
421421 }
422422
423423 Bluefruit.autoConnLed (true );
424+ Bluefruit.configUuid128Count (20 );
424425 Bluefruit.configPrphBandwidth (BANDWIDTH_MAX);
425426 Bluefruit.begin ();
426427 Bluefruit.setTxPower (4 );
@@ -430,24 +431,23 @@ void setup()
430431 versionTxChar.begin ();
431432 dataProviderTxChar.begin ();
432433 dataProviderLabelsTxChar.begin ();
433-
434- #if 0
435- service.addCharacteristic(inferenceTxChar);
436-
437- service.addCharacteristic(numClassesRxChar);
438- service.addCharacteristic(numSamplesRxChar);
439- service.addCharacteristic(captureDelayRxChar);
440- service.addCharacteristic(thresholdRxChar);
441- service.addCharacteristic(disableMagnetometerRx);
442-
443- service.addCharacteristic(stateRxChar);
444- service.addCharacteristic(stateTxChar);
445- service.addCharacteristic(fileTransferTypeRxChar);
446- service.addCharacteristic(hasModelTxChar);
434+ inferenceTxChar.begin ();
435+
436+ numClassesRxChar.begin ();
437+ numSamplesRxChar.begin ();
438+ captureDelayRxChar.begin ();
439+ thresholdRxChar.begin ();
440+ disableMagnetometerRx.begin ();
441+
442+ stateRxChar.begin ();
443+ stateTxChar.begin ();
444+ fileTransferTypeRxChar.begin ();
445+ hasModelTxChar.begin ();
447446
448- service.addCharacteristic(metaRxChar );
449- service.addCharacteristic(metaTxChar );
447+ metaRxChar. begin ( );
448+ metaTxChar. begin ( );
450449
450+ #if 0
451451 // Event driven reads.
452452 numClassesRxChar.setEventHandler(BLEWritten, handleNumClassesRxWritten);
453453 numSamplesRxChar.setEventHandler(BLEWritten, handleNumSamplesRxWritten);
0 commit comments