diff --git a/wristwatch-test.cpp b/wristwatch-test.cpp index 560619b7de0da908218d9d6633811e6d4a33a0f3..4476126bc451beda8a1eb117f4ce279719ea4db2 100644 --- a/wristwatch-test.cpp +++ b/wristwatch-test.cpp @@ -12,6 +12,7 @@ #define GPS_CHAR_UUID "3d4512a1-e027-473d-b880-f58e75ad8a9e" #define STEP_COUNTER_CHAR_UUID "5609995a-8003-4f11-bd73-8ae0eee8d004" #define HEART_RATE_CHAR_UUID "50787168-dec5-437c-a6ab-e52fa492c85c" +#define WALKING_GAME_OVER_CHAR_UUID "3c79b9e0-c841-42a5-8641-a456e335460b" #define GPS_DATA_UPLOAD_INTERVAL 3 //in seconds @@ -19,9 +20,11 @@ BLECharacteristic *gpsChar; BLECharacteristic *stepCounterChar; BLECharacteristic *heartRateChar; +BLECharacteristic *walkingGameOverChar; //For testing uint8_t tempCounter1 = 0; +uint32_t tempCounter2 = 0; void gpsThread(void *parameter){ @@ -47,13 +50,11 @@ void gpsThread(void *parameter){ void stepCounterThread(void *parameter){ for(;;){ Serial.println("Looping step counter thread"); - unsigned char tempToggle = 0; //Toggle this value between 0 and 1 for every new step detected - tempToggle = tempToggle?0:1; - stepCounterChar->setValue(&tempToggle,1); + stepCounterChar->setValue(tempCounter2); //Put in a uint32_t stepCounterChar->notify(); - + tempCounter2++; delay(500); } } @@ -105,11 +106,18 @@ void setup() { BLECharacteristic::PROPERTY_NOTIFY | BLECharacteristic::PROPERTY_INDICATE ); - + walkingGameOverChar = mainService->createCharacteristic( + WALKING_GAME_OVER_CHAR_UUID, + BLECharacteristic::PROPERTY_READ | + BLECharacteristic::PROPERTY_WRITE | + BLECharacteristic::PROPERTY_NOTIFY | + BLECharacteristic::PROPERTY_INDICATE + ); //Add descriptor to set up notifications gpsChar->addDescriptor(new BLE2902()); stepCounterChar->addDescriptor(new BLE2902()); heartRateChar->addDescriptor(new BLE2902()); + walkingGameOverChar->addDescriptor(new BLE2902()); //Set initial values (this doesnt really matter) gpsChar->setValue("GPS initial data");