diff --git a/herald-mesh-relay/.vscode/settings.json b/herald-mesh-relay/.vscode/settings.json index 0bd4fea..912d65b 100644 --- a/herald-mesh-relay/.vscode/settings.json +++ b/herald-mesh-relay/.vscode/settings.json @@ -68,7 +68,8 @@ "cmake.configureEnvironment": { // "BOARD": "nrf52dk_nrf52832" // "BOARD": "nrf52833dk_nrf52833" - "BOARD": "nrf52840dk_nrf52840" + // "BOARD": "nrf52840dk_nrf52840" + "BOARD": "nrf52840dongle_nrf52840" // Maker Diary nrf52840mdk-dongle // "BOARD": "nrf5340dk_nrf5340_cpuapp" // ,"HERALD_ANALYSIS_ENABLED":"y" }, diff --git a/herald-mesh-relay/src/herald_handler.cpp b/herald-mesh-relay/src/herald_handler.cpp index af1b45c..b3c7d39 100644 --- a/herald-mesh-relay/src/herald_handler.cpp +++ b/herald-mesh-relay/src/herald_handler.cpp @@ -56,87 +56,88 @@ constexpr int stackMaxSize = K_THREAD_STACK_DEFINE(herald_stack, stackMaxSize); // Was 9192 for nRF5340 (10 conns), 2048 // for nRF52832 (3 conns) - -class AppLoggingDelegate { - public: - AppLoggingDelegate() = default; - ~AppLoggingDelegate() = default; - - void sensor(SensorType sensor, const TargetIdentifier& didDetect) { - // LOG_DBG("sensor didDetect"); - APP_DBG("sensor didDetect: %s", - str(didDetect)); // May want to disable this - logs A LOT of info - } - - /// Read payload data from target, e.g. encrypted device identifier from BLE - /// peripheral after successful connection. - void sensor(SensorType sensor, const PayloadData& didRead, - const TargetIdentifier& fromTarget) { - // LOG_DBG("sensor didRead"); - APP_DBG("sensor didRead: %s with payload: %s", str(fromTarget), - log_strdup(didRead.hexEncodedString().c_str())); - } - - /// Receive written immediate send data from target, e.g. important timing - /// signal. - void sensor(SensorType sensor, const ImmediateSendData& didReceive, - const TargetIdentifier& fromTarget) { - // LOG_DBG("sensor didReceive"); - APP_DBG("sensor didReceive: %s with immediate send data: %s", - str(fromTarget), log_strdup(didReceive.hexEncodedString().c_str())); - } - - /// Read payload data of other targets recently acquired by a target, e.g. - /// Android peripheral sharing payload data acquired from nearby iOS - /// peripherals. - void sensor(SensorType sensor, const std::vector& didShare, - const TargetIdentifier& fromTarget) { - APP_DBG("sensor didShare"); - // LOG_DBG("sensor didShare: %s", str(fromTarget) ); - // for (auto& p : didShare) { - // LOG_DBG(" - %s", log_strdup(p.hexEncodedString().c_str())); - // } - } - - /// Measure proximity to target, e.g. a sample of RSSI values from BLE - /// peripheral. - void sensor(SensorType sensor, const Proximity& didMeasure, - const TargetIdentifier& fromTarget) { - APP_DBG( - "didMeasure: %s, fromTarget: %s", - log_strdup(didMeasure.description().c_str()), - log_strdup( - ((std::string)BLEMacAddress(fromTarget.underlyingData())).c_str())); - // LOG_DBG("sensor didMeasure: %s with proximity: %d", str(fromTarget), - // didMeasure.value); - } - - /// Detection of time spent at location, e.g. at specific restaurant between - /// 02/06/2020 19:00 and 02/06/2020 21:00 - template - void sensor(SensorType sensor, const Location& didVisit) { - APP_DBG("sensor didVisit"); - } - - /// Measure proximity to target with payload data. Combines didMeasure and - /// didRead into a single convenient delegate method - void sensor(SensorType sensor, const Proximity& didMeasure, - const TargetIdentifier& fromTarget, - const PayloadData& withPayload) { - // ERR so it stands out in the logging! - APP_ERR( - "didMeasure=%s, fromTarget=%s, withPayload=%s", - log_strdup(didMeasure.description().c_str()), - log_strdup( - ((std::string)BLEMacAddress(fromTarget.underlyingData())).c_str()), - log_strdup(withPayload.hexEncodedString().c_str())); - } - - /// Sensor state update - void sensor(SensorType sensor, const SensorState& didUpdateState) { - APP_DBG("sensor didUpdateState"); - } -}; +struct DummyDelegate{}; +// using namespace herald::datatype; +// class AppLoggingDelegate { +// public: +// AppLoggingDelegate() = default; +// ~AppLoggingDelegate() = default; + +// void sensor(SensorType sensor, const TargetIdentifier& didDetect) { +// // LOG_DBG("sensor didDetect"); +// APP_DBG("sensor didDetect: %s", +// str(didDetect)); // May want to disable this - logs A LOT of info +// } + +// /// Read payload data from target, e.g. encrypted device identifier from BLE +// /// peripheral after successful connection. +// void sensor(SensorType sensor, const PayloadData& didRead, +// const TargetIdentifier& fromTarget) { +// // LOG_DBG("sensor didRead"); +// APP_DBG("sensor didRead: %s with payload: %s", str(fromTarget), +// log_strdup(didRead.hexEncodedString().c_str())); +// } + +// /// Receive written immediate send data from target, e.g. important timing +// /// signal. +// void sensor(SensorType sensor, const ImmediateSendData& didReceive, +// const TargetIdentifier& fromTarget) { +// // LOG_DBG("sensor didReceive"); +// APP_DBG("sensor didReceive: %s with immediate send data: %s", +// str(fromTarget), log_strdup(didReceive.hexEncodedString().c_str())); +// } + +// /// Read payload data of other targets recently acquired by a target, e.g. +// /// Android peripheral sharing payload data acquired from nearby iOS +// /// peripherals. +// void sensor(SensorType sensor, const std::vector& didShare, +// const TargetIdentifier& fromTarget) { +// APP_DBG("sensor didShare"); +// // LOG_DBG("sensor didShare: %s", str(fromTarget) ); +// // for (auto& p : didShare) { +// // LOG_DBG(" - %s", log_strdup(p.hexEncodedString().c_str())); +// // } +// } + +// /// Measure proximity to target, e.g. a sample of RSSI values from BLE +// /// peripheral. +// void sensor(SensorType sensor, const Proximity& didMeasure, +// const TargetIdentifier& fromTarget) { +// APP_DBG( +// "didMeasure: %s, fromTarget: %s", +// log_strdup(didMeasure.description().c_str()), +// log_strdup( +// ((std::string)BLEMacAddress(fromTarget.underlyingData())).c_str())); +// // LOG_DBG("sensor didMeasure: %s with proximity: %d", str(fromTarget), +// // didMeasure.value); +// } + +// /// Detection of time spent at location, e.g. at specific restaurant between +// /// 02/06/2020 19:00 and 02/06/2020 21:00 +// template +// void sensor(SensorType sensor, const Location& didVisit) { +// APP_DBG("sensor didVisit"); +// } + +// /// Measure proximity to target with payload data. Combines didMeasure and +// /// didRead into a single convenient delegate method +// void sensor(SensorType sensor, const Proximity& didMeasure, +// const TargetIdentifier& fromTarget, +// const PayloadData& withPayload) { +// // ERR so it stands out in the logging! +// APP_ERR( +// "didMeasure=%s, fromTarget=%s, withPayload=%s", +// log_strdup(didMeasure.description().c_str()), +// log_strdup( +// ((std::string)BLEMacAddress(fromTarget.underlyingData())).c_str()), +// log_strdup(withPayload.hexEncodedString().c_str())); +// } + +// /// Sensor state update +// void sensor(SensorType sensor, const SensorState& didUpdateState) { +// APP_DBG("sensor didUpdateState"); +// } +// }; using MYUINT32 = unsigned long; @@ -208,7 +209,7 @@ void herald_entry() { // this is unusual, but required. Really we should log activity to serial BLE // or similar - AppLoggingDelegate appDelegate; + DummyDelegate appDelegate; SensorDelegateSet sensorDelegates(appDelegate); ConcreteBLESensor ble(ctx, ctx.getBluetoothStateManager(), pds, diff --git a/herald-venue-beacon/.vscode/settings.json b/herald-venue-beacon/.vscode/settings.json index b70517a..4d377fc 100644 --- a/herald-venue-beacon/.vscode/settings.json +++ b/herald-venue-beacon/.vscode/settings.json @@ -27,7 +27,13 @@ "cmake.configureEnvironment": { // "BOARD": "nrf52dk_nrf52832" // "BOARD": "nrf52833dk_nrf52833" - "BOARD": "nrf52840dk_nrf52840" + // "BOARD": "nrf52840dk_nrf52840" + "BOARD": "nrf52840dongle_nrf52840" // Maker Diary nrf52840mdk-dongle // "BOARD": "nrf5340dk_nrf5340_cpuapp" - } + }, + "nrf-connect.topdir": "${nrf-connect.sdk:1.9.1}", + "nrf-connect.toolchain.path": "${nrf-connect.toolchain:1.9.1}", + "nrf-connect.applications": [ + "${workspaceFolder}" + ] } \ No newline at end of file diff --git a/herald-venue-beacon/src/main.cpp b/herald-venue-beacon/src/main.cpp index 318bd77..95f4ef8 100644 --- a/herald-venue-beacon/src/main.cpp +++ b/herald-venue-beacon/src/main.cpp @@ -196,12 +196,12 @@ void herald_entry() { ctx.setSensorConfiguration(config); ConcreteExtendedDataV1 extendedData; - extendedData.addSection(ExtendedDataSegmentCodesV1::TextPremises, erinsStakehouse.name); + extendedData.addSection(ExtendedDataSegmentCodesV1::TextPremises, adamsOffice.name); payload::beacon::ConcreteBeaconPayloadDataSupplierV1 pds( - erinsStakehouse.country, - erinsStakehouse.state, - erinsStakehouse.code, + adamsOffice.country, + adamsOffice.state, + adamsOffice.code, extendedData );