#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>
#include <string.h>
#include <inttypes.h>
#define DATA_EP 5
static const uint8_t beacon_hdr[] =
{
0x42,
0x10, 0x32, 0x54, 0x76, 0x00, 0xc0,
0x02, 0x01, 0x04,
0x03, 0x03, 0xaa, 0xfe,
0x06, 0x16, 0xaa, 0xfe, 0x10, 0xf7,
0x00
};
static size_t makeBeacon(uint8_t * buffer,
const uint8_t * url,
size_t url_num_bytes)
{
{
return 0;
}
memcpy(buffer, beacon_hdr, sizeof(beacon_hdr));
app_res_e res = lib_settings->getNodeAddress(&addr);
{
return 0;
}
buffer[1] = (uint8_t)((addr >> 0) & 0xff);
buffer[2] = (uint8_t)((addr >> 8) & 0xff);
buffer[3] = (uint8_t)((addr >> 16) & 0xff);
buffer[4] = (uint8_t)((addr >> 24) & 0xff);
buffer[14] += url_num_bytes;
memcpy(buffer + sizeof(beacon_hdr), url, url_num_bytes);
return sizeof(beacon_hdr) + (size_t)url_num_bytes;
}
const shared_data_item_t * item,
{
(void) item;
size_t beacon_num_bytes;
(strncmp((
const char *)(data->
bytes), (
const char *)
"url ", 4) != 0))
{
}
else if ((beacon_num_bytes = makeBeacon(beacon,
{
data_to_send.
bytes = (
const uint8_t *)
"ERR";
lib_data->sendData(&data_to_send);
}
lib_beacon_tx->clearBeacons();
lib_beacon_tx->setBeaconInterval(333);
int8_t power = 8;
lib_beacon_tx->setBeaconPower(0, &power);
lib_beacon_tx->setBeaconChannels(
lib_beacon_tx->setBeaconContents(0, beacon, beacon_num_bytes);
lib_beacon_tx->enableBeacons(true);
data_to_send.
bytes = (
const uint8_t *)
"OK";
}
static shared_data_item_t all_packets_filter =
{
.cb = dataReceivedFunc,
.filter = {
.src_endpoint = DATA_EP,
.dest_endpoint = DATA_EP,
.multicast_cb = NULL
}
};
{
(void) functions;
{
return;
}
lib_state->startStack();
}
__STATIC_INLINE app_res_e configureNodeFromBuildParameters()
Wrapper on top of configureNode to get parameters from build system and hardcoded values from chip (f...
@ SHARED_DATA_NET_MODE_ALL
app_lib_data_send_res_e Shared_Data_sendData(app_lib_data_to_send_t *data, app_lib_data_data_sent_cb_f sent_cb)
Send data. The packet to send is represented as a app_lib_data_to_send_t struct.
app_res_e Shared_Data_addDataReceivedCb(shared_data_item_t *item)
Add a new packet received item to the list. If the item is already in the list it is only updated.
List of global functions, passed to App_entrypoint()
@ APP_LIB_BEACON_TX_CHANNELS_ALL
#define APP_LIB_BEACON_TX_MAX_NUM_BYTES
@ APP_LIB_DATA_SEND_FLAG_NONE
#define APP_LIB_DATA_NO_TRACKING_ID
When sending data and no tracking of packet is requested, this ID may be used.
app_lib_data_tracking_id_t tracking_id
@ APP_LIB_DATA_QOS_NORMAL
app_lib_data_receive_res_e
Return value of data reception callback.
@ APP_LIB_DATA_RECEIVE_RES_HANDLED
@ APP_LIB_DATA_RECEIVE_RES_NOT_FOR_APP
A struct for lib_data->sendData().
Struct passed to data reception callback functions.