Merge branch 'temp'
This commit is contained in:
commit
fe2d90068e
2 changed files with 27 additions and 5 deletions
|
@ -11,7 +11,8 @@
|
||||||
|
|
||||||
static const char *TAG = "BLE";
|
static const char *TAG = "BLE";
|
||||||
static bool Host_And_Controller_Synced = false;
|
static bool Host_And_Controller_Synced = false;
|
||||||
static bool Is_Scanning_And_Advertising = false;
|
static bool Is_Scanning = false;
|
||||||
|
static bool Is_Advertising = false;
|
||||||
|
|
||||||
static uint8_t Advertising_Data[BLE_KTAG_PACKET_TOTAL_SIZE] = {0x1E, 0xFF, 0xFF, 0xFF, 'K', 'T', 'a', 'g'};
|
static uint8_t Advertising_Data[BLE_KTAG_PACKET_TOTAL_SIZE] = {0x1E, 0xFF, 0xFF, 0xFF, 'K', 'T', 'a', 'g'};
|
||||||
|
|
||||||
|
@ -247,7 +248,7 @@ SystemKResult_T BLE_SetAdvertisingData(BLE_AdvertisingData_T *data)
|
||||||
memcpy(Advertising_Data, data, BLE_KTAG_PACKET_TOTAL_SIZE);
|
memcpy(Advertising_Data, data, BLE_KTAG_PACKET_TOTAL_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Is_Scanning_And_Advertising == true)
|
if (Is_Advertising == true)
|
||||||
{
|
{
|
||||||
// Restart advertising to put the new data into the advertisement.
|
// Restart advertising to put the new data into the advertisement.
|
||||||
ble_gap_adv_stop();
|
ble_gap_adv_stop();
|
||||||
|
@ -263,11 +264,32 @@ SystemKResult_T BLE_ScanAndAdvertise(void)
|
||||||
|
|
||||||
if (Host_And_Controller_Synced == true)
|
if (Host_And_Controller_Synced == true)
|
||||||
{
|
{
|
||||||
if (Is_Scanning_And_Advertising == false)
|
if (Is_Scanning == false)
|
||||||
{
|
{
|
||||||
ble_scan();
|
ble_scan();
|
||||||
|
Is_Scanning = true;
|
||||||
|
}
|
||||||
|
if (Is_Advertising == false)
|
||||||
|
{
|
||||||
ble_advertise();
|
ble_advertise();
|
||||||
Is_Scanning_And_Advertising = true;
|
Is_Advertising = true;
|
||||||
|
}
|
||||||
|
result = SYSTEMK_RESULT_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
SystemKResult_T BLE_StopAdvertising(void)
|
||||||
|
{
|
||||||
|
SystemKResult_T result = SYSTEMK_RESULT_NOT_READY;
|
||||||
|
|
||||||
|
if (Host_And_Controller_Synced == true)
|
||||||
|
{
|
||||||
|
if (Is_Advertising == true)
|
||||||
|
{
|
||||||
|
ble_gap_adv_stop();
|
||||||
|
Is_Advertising = false;
|
||||||
}
|
}
|
||||||
result = SYSTEMK_RESULT_SUCCESS;
|
result = SYSTEMK_RESULT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
#define VERSION_H
|
#define VERSION_H
|
||||||
|
|
||||||
#define VERSION_MAJOR 00
|
#define VERSION_MAJOR 00
|
||||||
#define VERSION_MINOR 39
|
#define VERSION_MINOR 40
|
||||||
|
|
||||||
#define STRINGIFY(number) #number
|
#define STRINGIFY(number) #number
|
||||||
#define VERSION_STRING(major, minor) STRINGIFY(major) "." STRINGIFY(minor)
|
#define VERSION_STRING(major, minor) STRINGIFY(major) "." STRINGIFY(minor)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue