Geo beacon for VF.
Dependencies: MMA8452 aconno_bsp adc52832_common
Revision 42:bffc939efdf3, committed 2018-09-25
- Comitter:
- dbartolovic
- Date:
- Tue Sep 25 10:39:46 2018 +0000
- Branch:
- Lizzy_hardware
- Parent:
- 41:7d8ce2d8d167
- Commit message:
- Added new advertisement format for freight
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 7d8ce2d8d167 -r bffc939efdf3 main.cpp --- a/main.cpp Thu Jul 05 09:10:54 2018 +0000 +++ b/main.cpp Tue Sep 25 10:39:46 2018 +0000 @@ -76,6 +76,30 @@ #endif +#if ACN_FREIGHT + +/* Aconno ID universal to all projects */ +#define ACONNO_ID (0x69) +/* Internal unique product identification. When doing new projects, just + * increment old project ID by one. */ +#define PRODUCT_ID (0x03) +/* Version of the firmware. Start from zero and go upwards. */ +#define VERSION (0x02) + +/* Manufacturer that will sell the product. 0x0059 for general use case. */ +#define MANUFACTURER_ID (0x0059) + +struct __attribute__((packed, aligned(1))) AdvertisingFormat +{ + uint16_t manufacturerID; + uint8_t aconnoID; + uint8_t productID; + uint8_t version; +}; + +#endif + + uint8_t sleepFlag = true; uint8_t UUID[UUID_SIZE_B] = {0xE1, 0x61, 0x35, 0xBA, 0xC0, 0xEC, 0x47, 0x2A, 0x98, 0x00, 0xAF, 0x18, 0x43, 0xFF, 0x05, 0x00}; uint8_t startBuzz[2] = {0xBA, 0xBE}; @@ -295,7 +319,20 @@ ble.gap().onConnection(onConnectionCallback); ble.gattServer().onDataWritten(onDataWrittenCallback); - ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::INCOMPLETE_LIST_128BIT_SERVICE_IDS , (uint8_t*)UUID, sizeof(UUID)); +#if ACN_FREIGHT + AdvertisingFormat msd; + + msd.manufacturerID = MANUFACTURER_ID; + msd.aconnoID = ACONNO_ID; + msd.productID = PRODUCT_ID; + msd.version = VERSION; + + ble.gap().accumulateAdvertisingPayload( + GapAdvertisingData::MANUFACTURER_SPECIFIC_DATA, + (uint8_t*)&msd, sizeof(msd)); +#endif + + ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::INCOMPLETE_LIST_128BIT_SERVICE_IDS, (uint8_t*)UUID, sizeof(UUID)); ble.gap().setAdvertisingInterval(ADV_INTERVAL); // --> Has to be at least 100ms! }