diff --git a/herald-mesh-relay/src/main.cpp b/herald-mesh-relay/src/main.cpp index 24f5f48..fbe6f61 100644 --- a/herald-mesh-relay/src/main.cpp +++ b/herald-mesh-relay/src/main.cpp @@ -200,24 +200,23 @@ void herald_entry() // Disable receiver / scanning mode - we're just transmitting our value BLESensorConfiguration config = ctx.getSensorConfiguration(); // copy ctor - config.scanningEnabled = false; + config.scanningEnabled = true; // To see other nearby BLE devices // config.advertisingEnabled = true; // default ctx.setSensorConfiguration(config); ConcreteExtendedDataV1 extendedData; extendedData.addSection(ExtendedDataSegmentCodesV1::TextPremises, erinsStakehouse.name); + // TODO get this from configuration of the MESH element (Nav beacon model) payload::beacon::ConcreteBeaconPayloadDataSupplierV1 pds( erinsStakehouse.country, erinsStakehouse.state, erinsStakehouse.code, extendedData); - herald::ble::nordic_uart::NordicUartSensorDelegate nus(ctx); - // this is unusual, but required. Really we should log activity to serial BLE or similar DummyDelegate appDelegate; - SensorDelegateSet sensorDelegates(appDelegate, nus); + SensorDelegateSet sensorDelegates(appDelegate); ConcreteBLESensor ble(ctx, ctx.getBluetoothStateManager(), pds, sensorDelegates); SensorArray sa(ctx, pds, ble); @@ -286,6 +285,8 @@ void main(void) APP_DBG("Bluetooth init failed (err %d)", err); } + // TODO don't start Herald until enrolled and configured via MESH + // Start herald entry on a new thread in case of errors, or needing to do something on the main thread [[maybe_unused]] k_tid_t herald_pid = k_thread_create(&herald_thread, herald_stack, stackMaxSize, diff --git a/herald/include/herald/mesh/location_services.h b/herald/include/herald/mesh/location_services.h index 78b7372..338d128 100644 --- a/herald/include/herald/mesh/location_services.h +++ b/herald/include/herald/mesh/location_services.h @@ -14,9 +14,12 @@ extern "C" { #endif +/** + * Herald device and other Bluetooth LE Proximity Server. + */ /** Bluetooth MESH Herald presence values **/ -enum bt_mesh_herald_location_services_cli_presence { +enum bt_mesh_model_herald_presence_status { BT_MESH_HERALD_PRESENCE_OBSERVED, BT_MESH_HERALD_PRESENCE_IDENTIFIED, BT_MESH_HERALD_PRESENCE_VANISHED @@ -25,13 +28,55 @@ enum bt_mesh_herald_location_services_cli_presence { /** * \brief Herald presence message for a BLE node near a beacon */ -struct bt_mesh_herald_location_services_presence { +struct bt_mesh_model_herald_presence { /** \brief BLE Mac Address **/ uint8_t address[6]; /** \brief The last RSSI observed **/ int8_t rssi; /** \brief The current derived presence status for this observer **/ - enum bt_mesh_herald_location_services_cli_presence status; + enum bt_mesh_model_herald_presence_status status; +}; + + + +/** + * Herald campus navigation capabilities via MESH. + */ + +/** + * \brief Herald location beacon model, adapted for MESH + * and campus navigation. + * @see herald::payload::beacon::ConcreteBeaconPayloadDataSupplierV1 + */ +struct bt_mesh_model_herald_location_beacon { + /** \brief Herald Location Country **/ + uint16_t country; + /** \brief Herald Location State **/ + uint16_t state; + /** \brief Herald Location Code (NOT beacon identifier) **/ + uint32_t code; + /** + * \brief Herald Location Beacon ID (Beacon identifier) + * \since v2.2 + **/ + uint16_t id; + + // Note: We only supported limited extension fields + /** + * \brief Location further information URL + * \note 0x13 in Herald Extended data area. MUST be https. + **/ + char* ext_url; + /** \brief Length of location URL **/ + uint16_t ext_url_length; // URL GET is max 2048 thus 11 bytes for length + + // char* ext_name; // 0x10 in Herald Extended data area + // size_t ext_name_length; + + // char* ext_location; // 0x11 in Herald Extended data area + // size_t ext_location_length; + + // TODO public security key for beacon later };