Skip to content
Snippets Groups Projects
Commit 21a99831 authored by Hauke Mehrtens's avatar Hauke Mehrtens
Browse files

BLE: FileTrans: Do not provide static space for callbacks


When we use callbacks to not provide a space to store the variable, this
way we can safe some memory.

Signed-off-by: default avatarHauke Mehrtens <hauke@hauke-m.de>
parent 7e48d60f
No related branches found
No related tags found
No related merge requests found
...@@ -96,8 +96,6 @@ static const uint16_t txChConfig_len = sizeof(txChConfig); ...@@ -96,8 +96,6 @@ static const uint16_t txChConfig_len = sizeof(txChConfig);
static const uint8_t attTxChConfigUuid[] = { FILE_TRANS_UUID_SUFFIX, static const uint8_t attTxChConfigUuid[] = { FILE_TRANS_UUID_SUFFIX,
0x01, 0x01,
FILE_TRANS_UUID_PREFIX }; FILE_TRANS_UUID_PREFIX };
static uint8_t attTxChConfigValue[128];
static uint16_t attTxChConfigValue_len = sizeof(attTxChConfigUuid);
/* BLE File transfer Central RX configuration */ /* BLE File transfer Central RX configuration */
static const uint8_t rxChConfig[] = { ATT_PROP_READ | ATT_PROP_NOTIFY, static const uint8_t rxChConfig[] = { ATT_PROP_READ | ATT_PROP_NOTIFY,
...@@ -113,7 +111,7 @@ static const uint8_t attRxChConfigUuid[] = { FILE_TRANS_UUID_SUFFIX, ...@@ -113,7 +111,7 @@ static const uint8_t attRxChConfigUuid[] = { FILE_TRANS_UUID_SUFFIX,
0x02, 0x02,
FILE_TRANS_UUID_PREFIX }; FILE_TRANS_UUID_PREFIX };
static uint8_t attRxChConfigValue[64]; static uint8_t attRxChConfigValue[64];
static uint16_t attRxChConfigValue_len = sizeof(attRxChConfigUuid); static uint16_t attRxChConfigValue_len = 0;
/* File descriptor of the currently transferred file */ /* File descriptor of the currently transferred file */
static int file_fd = -1; static int file_fd = -1;
...@@ -141,10 +139,9 @@ static const attsAttr_t fileTransCfgList[] = { ...@@ -141,10 +139,9 @@ static const attsAttr_t fileTransCfgList[] = {
/* File transfer Central TX, this contains information about the real data */ /* File transfer Central TX, this contains information about the real data */
{ {
.pUuid = attTxChConfigUuid, .pUuid = attTxChConfigUuid,
.pValue = attTxChConfigValue, .pValue = NULL,
.pLen = &attTxChConfigValue_len, .pLen = NULL,
/* use last biyte for null termination */ .maxLen = 128,
.maxLen = sizeof(attTxChConfigValue) - 1,
.settings = ATTS_SET_WRITE_CBACK | ATTS_SET_VARIABLE_LEN, .settings = ATTS_SET_WRITE_CBACK | ATTS_SET_VARIABLE_LEN,
.permissions = ATTS_PERMIT_WRITE, .permissions = ATTS_PERMIT_WRITE,
}, },
...@@ -163,7 +160,7 @@ static const attsAttr_t fileTransCfgList[] = { ...@@ -163,7 +160,7 @@ static const attsAttr_t fileTransCfgList[] = {
.pValue = attRxChConfigValue, .pValue = attRxChConfigValue,
.pLen = &attRxChConfigValue_len, .pLen = &attRxChConfigValue_len,
.maxLen = sizeof(attRxChConfigValue), .maxLen = sizeof(attRxChConfigValue),
.settings = ATTS_SET_READ_CBACK, .settings = ATTS_SET_VARIABLE_LEN,
.permissions = ATTS_PERMIT_READ, .permissions = ATTS_PERMIT_READ,
}, },
/* File transfer Central RX notification channel */ /* File transfer Central RX notification channel */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment