Skip to content

Commit

Permalink
Merge pull request #1 from JC-282-AD/main
Browse files Browse the repository at this point in the history
update
  • Loading branch information
JC-282-AD authored Jun 27, 2024
2 parents 7570b6c + f5641c7 commit 562d1f9
Show file tree
Hide file tree
Showing 40 changed files with 272 additions and 181 deletions.
31 changes: 20 additions & 11 deletions .github/workflows/BLE_Examples_Test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ on:

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
push:


env:
LOCK_MAX32655_B2: false
Expand Down Expand Up @@ -604,15 +604,15 @@ jobs:
run: |
#set advertising names
sed -i "s/'S'/'?'/g" Examples/MAX32655/Bluetooth/BLE_dats/dats_main.c
sed -i "s/'S'/'?'/g" Examples/MAX32655/Bluetooth/BLE_datc/datc_main.c
sed -i "s/'S'/'!'/g" Examples/MAX32665/Bluetooth/BLE_dats/dats_main.c
sed -i "s/'S'/'!'/g" Examples/MAX32690/Bluetooth/BLE_datc/datc_main.c
# sed -i "s/'S'/'?'/g" Examples/MAX32655/Bluetooth/BLE_dats/dats_main.c
# sed -i "s/'S'/'?'/g" Examples/MAX32655/Bluetooth/BLE_datc/datc_main.c
# sed -i "s/'S'/'!'/g" Examples/MAX32665/Bluetooth/BLE_dats/dats_main.c
# sed -i "s/'S'/'!'/g" Examples/MAX32690/Bluetooth/BLE_datc/datc_main.c
sed -i "s/'S'/'?'/g" Examples/MAX32655/Bluetooth/BLE_otas/dats_main.c
sed -i "s/'S'/'?'/g" Examples/MAX32655/Bluetooth/BLE_otac/datc_main.c
sed -i "s/'S'/'!'/g" Examples/MAX32665/Bluetooth/BLE_otas/dats_main.c
sed -i "s/'S'/'!'/g" Examples/MAX32690/Bluetooth/BLE_otac/datc_main.c
# sed -i "s/'S'/'?'/g" Examples/MAX32655/Bluetooth/BLE_otas/dats_main.c
# sed -i "s/'S'/'?'/g" Examples/MAX32655/Bluetooth/BLE_otac/datc_main.c
# sed -i "s/'S'/'!'/g" Examples/MAX32665/Bluetooth/BLE_otas/dats_main.c
# sed -i "s/'S'/'!'/g" Examples/MAX32690/Bluetooth/BLE_otac/datc_main.c
- name: Erase Boards DATS
if: ${{env.MAX32655_DATS_CONNECTED_TEST == 'true' || env.MAX32665_DATS_CONNECTED_TEST == 'true' || env.MAX32690_DATS_CONNECTED_TEST == 'true'}}
Expand Down Expand Up @@ -643,7 +643,11 @@ jobs:
BLE_datc
suppress_output: true

build_flags: |
ADV_NAME=DAT?
ADV_NAME=DAT?
build: true
distclean: true

Expand Down Expand Up @@ -675,7 +679,12 @@ jobs:
max32655_board1
max32655_board2
max32665_board1
build_flags: |
ADV_NAME=OTA?
ADV_NAME=OTA?
ADV_NAME=OTA!
ADV_NAME=OTA!
project: |
BLE_otas
BLE_otac
Expand Down
8 changes: 4 additions & 4 deletions Examples/MAX32655/Bluetooth/BLE_datc/datc_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ static const appSecCfg_t datcSecCfg = {
DM_KEY_DIST_IRK, /*! Initiator key distribution flags */
DM_KEY_DIST_LTK | DM_KEY_DIST_IRK, /*! Responder key distribution flags */
FALSE, /*! TRUE if Out-of-band pairing data is present */
TRUE /*! TRUE to initiate security upon connection */
INIT_SECURITY /*! TRUE to initiate security upon connection */
};

/* OOB UART parameters */
Expand Down Expand Up @@ -569,9 +569,9 @@ static void datcScanReport(dmEvt_t *pMsg)
if (!connect && ((pData = DmFindAdType(DM_ADV_TYPE_LOCAL_NAME, pMsg->scanReport.len,
pMsg->scanReport.pData)) != NULL)) {
/* check length and device name */
if (pData[DM_AD_LEN_IDX] >= 4 && (pData[DM_AD_DATA_IDX] == 'D') &&
(pData[DM_AD_DATA_IDX + 1] == 'A') && (pData[DM_AD_DATA_IDX + 2] == 'T') &&
(pData[DM_AD_DATA_IDX + 3] == 'S')) {
char advName[] = ADV_NAME;
if (pData[DM_AD_LEN_IDX] == sizeof(advName) &&
!strncmp(advName, (char *)&(pData[DM_AD_DATA_IDX]), sizeof(advName))) {
connect = TRUE;
}
}
Expand Down
8 changes: 8 additions & 0 deletions Examples/MAX32655/Bluetooth/BLE_datc/project.mk
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,11 @@ INIT_CENTRAL = 1
# Set to 1 to enable serial port trace messages
# Set to 2 to enable verbose messages
TRACE = 1

# set ADVTISEMENT name you want to connect
ADV_NAME?=DATS
PROJ_CFLAGS += -DADV_NAME=\"$(ADV_NAME)\"

### CONFIGURE security
# /*! TRUE to initiate security upon connection*/
PROJ_CFLAGS += -DINIT_SECURITY=TRUE
19 changes: 7 additions & 12 deletions Examples/MAX32655/Bluetooth/BLE_dats/dats_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ static const appSecCfg_t datsSecCfg = {
DM_KEY_DIST_IRK, /*! Initiator key distribution flags */
DM_KEY_DIST_LTK | DM_KEY_DIST_IRK, /*! Responder key distribution flags */
FALSE, /*! TRUE if Out-of-band pairing data is present */
TRUE /*! TRUE to initiate security upon connection */
INIT_SECURITY /*! TRUE to initiate security upon connection */
};

/* OOB UART parameters */
Expand Down Expand Up @@ -214,15 +214,8 @@ static const uint8_t datsAdvDataDisc[] = {
};

/*! scan data, discoverable mode */
static const uint8_t datsScanDataDisc[] = {
/*! device name */
5, /*! length */
DM_ADV_TYPE_LOCAL_NAME, /*! AD type */
'D',
'A',
'T',
'S'
};
static const uint8_t deviceName[] = ADV_NAME;
static uint8_t datsScanDataDisc[sizeof(deviceName) + 2];

/**************************************************************************************************
Client Characteristic Configuration Descriptors
Expand Down Expand Up @@ -538,7 +531,9 @@ static void datsSetup(dmEvt_t *pMsg)
{
/* Initialize control information */
datsCb.restoringResList = FALSE;

memcpy(&datsScanDataDisc[2], deviceName, sizeof(deviceName));
datsScanDataDisc[0] = sizeof(deviceName);
datsScanDataDisc[1] = DM_ADV_TYPE_LOCAL_NAME;
/* set advertising and scan response data for discoverable mode */
AppAdvSetData(APP_ADV_DATA_DISCOVERABLE, sizeof(datsAdvDataDisc), (uint8_t *)datsAdvDataDisc);
AppAdvSetData(APP_SCAN_DATA_DISCOVERABLE, sizeof(datsScanDataDisc),
Expand Down Expand Up @@ -760,7 +755,7 @@ void DatsHandlerInit(wsfHandlerId_t handlerId)
AppGetBdAddr(addr);
APP_TRACE_INFO6("MAC Addr: %02x:%02x:%02x:%02x:%02x:%02x", addr[5], addr[4], addr[3], addr[2],
addr[1], addr[0]);
APP_TRACE_INFO1("Adv local name: %s", &datsScanDataDisc[2]);
APP_TRACE_INFO1("Adv local name: %s", deviceName);

/* store handler ID */
datsCb.handlerId = handlerId;
Expand Down
9 changes: 9 additions & 0 deletions Examples/MAX32655/Bluetooth/BLE_dats/project.mk
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,12 @@ TRACE = 1
# Add services directory to build
IPATH += services
VPATH += services

# SET advertising name
ADV_NAME?=DATS
PROJ_CFLAGS += -DADV_NAME=\"$(ADV_NAME)\"


### CONFIGURE security
# /*! TRUE to initiate security upon connection*/
PROJ_CFLAGS += -DINIT_SECURITY=FALSE
8 changes: 4 additions & 4 deletions Examples/MAX32655/Bluetooth/BLE_otac/datc_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ static const appSecCfg_t datcSecCfg = {
DM_KEY_DIST_IRK, /*! Initiator key distribution flags */
DM_KEY_DIST_LTK | DM_KEY_DIST_IRK, /*! Responder key distribution flags */
FALSE, /*! TRUE if Out-of-band pairing data is present */
TRUE /*! TRUE to initiate security upon connection */
INIT_SECURITY /*! TRUE to initiate security upon connection */
};

/*! TRUE if Out-of-band pairing data is to be sent */
Expand Down Expand Up @@ -494,9 +494,9 @@ static void datcScanReport(dmEvt_t *pMsg)
if (!connect && ((pData = DmFindAdType(DM_ADV_TYPE_LOCAL_NAME, pMsg->scanReport.len,
pMsg->scanReport.pData)) != NULL)) {
/* check length and device name */
if (pData[DM_AD_LEN_IDX] >= 4 && (pData[DM_AD_DATA_IDX] == 'O') &&
(pData[DM_AD_DATA_IDX + 1] == 'T') && (pData[DM_AD_DATA_IDX + 2] == 'A') &&
(pData[DM_AD_DATA_IDX + 3] == 'S')) {
char advName[] = ADV_NAME;
if (pData[DM_AD_LEN_IDX] == sizeof(advName) &&
!strncmp(advName, (char *)&(pData[DM_AD_DATA_IDX]), sizeof(advName))) {
connect = TRUE;
}
}
Expand Down
10 changes: 10 additions & 0 deletions Examples/MAX32655/Bluetooth/BLE_otac/project.mk
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,13 @@ fw_obj: $(FW_UPDATE_OBJ)

${FW_UPDATE_OBJ}: fw_update.S ${FW_UPDATE_BIN}
${CC} ${AFLAGS} -o ${@} -c fw_update.S

# set ADVTISEMENT name you want to connect
ADV_NAME?=DATS
PROJ_CFLAGS += -DADV_NAME=\"$(ADV_NAME)\"



### CONFIGURE security
# /*! TRUE to initiate security upon connection*/
PROJ_CFLAGS += -DINIT_SECURITY=TRUE
18 changes: 7 additions & 11 deletions Examples/MAX32655/Bluetooth/BLE_otas/dats_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ static const appSecCfg_t datsSecCfg = {
DM_KEY_DIST_IRK, /*! Initiator key distribution flags */
DM_KEY_DIST_LTK | DM_KEY_DIST_IRK, /*! Responder key distribution flags */
FALSE, /*! TRUE if Out-of-band pairing data is present */
TRUE /*! TRUE to initiate security upon connection */
INIT_SECURITY /*! TRUE to initiate security upon connection */
};

/*! TRUE if Out-of-band pairing data is to be sent */
Expand Down Expand Up @@ -200,15 +200,8 @@ static const uint8_t datsAdvDataDisc[] = {
};

/*! scan data, discoverable mode */
static const uint8_t datsScanDataDisc[] = {
/*! device name */
5, /*! length */
DM_ADV_TYPE_LOCAL_NAME, /*! AD type */
'O',
'T',
'A',
'S'
};
static const uint8_t deviceName[] = ADV_NAME;
static uint8_t datsScanDataDisc[sizeof(deviceName) + 2];

/**************************************************************************************************
Client Characteristic Configuration Descriptors
Expand Down Expand Up @@ -462,6 +455,9 @@ static void datsSetup(dmEvt_t *pMsg)
{
/* Initialize control information */
datsCb.restoringResList = FALSE;
memcpy(&datsScanDataDisc[2], deviceName, sizeof(deviceName));
datsScanDataDisc[0] = sizeof(deviceName);
datsScanDataDisc[1] = DM_ADV_TYPE_LOCAL_NAME;

/* set advertising and scan response data for discoverable mode */
AppAdvSetData(APP_ADV_DATA_DISCOVERABLE, sizeof(datsAdvDataDisc), (uint8_t *)datsAdvDataDisc);
Expand Down Expand Up @@ -683,7 +679,7 @@ void DatsHandlerInit(wsfHandlerId_t handlerId)
AppGetBdAddr(addr);
APP_TRACE_INFO6("MAC Addr: %02x:%02x:%02x:%02x:%02x:%02x", addr[5], addr[4], addr[3], addr[2],
addr[1], addr[0]);
APP_TRACE_INFO1("Adv local name: %s", &datsScanDataDisc[2]);
APP_TRACE_INFO1("Adv local name: %s", deviceName);

/* store handler ID */
datsCb.handlerId = handlerId;
Expand Down
9 changes: 9 additions & 0 deletions Examples/MAX32655/Bluetooth/BLE_otas/project.mk
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,12 @@ bl_obj: $(BOOTLOADER_OBJ)
${BOOTLOADER_OBJ}: bl_build.S ${BOOTLOADER_BIN}
${CC} ${AFLAGS} -o ${@} -c bl_build.S
endif

# SET advertising name
ADV_NAME?=DATS
PROJ_CFLAGS += -DADV_NAME=\"$(ADV_NAME)\"


### CONFIGURE security
# /*! TRUE to initiate security upon connection*/
PROJ_CFLAGS += -DINIT_SECURITY=TRUE
13 changes: 6 additions & 7 deletions Examples/MAX32665/Bluetooth/BLE_datc/datc_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -568,13 +568,12 @@ static void datcScanReport(dmEvt_t *pMsg)
/* find device name */
if (!connect && ((pData = DmFindAdType(DM_ADV_TYPE_LOCAL_NAME, pMsg->scanReport.len,
pMsg->scanReport.pData)) != NULL)) {
/* check length and device name */
char advName[] = ADV_NAME;
/*if (pData[DM_AD_LEN_IDX] >= 4 && (pData[DM_AD_DATA_IDX] == 'D') &&
(pData[DM_AD_DATA_IDX + 1] == 'A') && (pData[DM_AD_DATA_IDX + 2] == 'T') &&
(pData[DM_AD_DATA_IDX + 3] == 'S')) */
if (pData[DM_AD_LEN_IDX] == sizeof(advName)
&& !strncmp(advName, (char*)&(pData[DM_AD_DATA_IDX]), sizeof(advName))){

/* check length and device name */
char advName[] = ADV_NAME;
if (pData[DM_AD_LEN_IDX] == sizeof(advName) &&
!strncmp(advName, (char *)&(pData[DM_AD_DATA_IDX]), sizeof(advName))) {

connect = TRUE;
}
}
Expand Down
15 changes: 2 additions & 13 deletions Examples/MAX32665/Bluetooth/BLE_datc/project.mk
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,9 @@ INIT_CENTRAL = 1
TRACE = 1

# set ADVTISEMENT name you want to connect
PROJ_CFLAGS += -DADV_NAME=\"DATS\"
ADV_NAME?=DATS
PROJ_CFLAGS += -DADV_NAME=\"$(ADV_NAME)\"

### CONFIGURE security
# /*! Authentication and bonding flags */
#PROJ_CFLAGS += -DAUTH_BOND='DM_AUTH_BOND_FLAG | DM_AUTH_SC_FLAG | DM_AUTH_MITM_FLAG'

# /*! Initiator key distribution flags */
#PROJ_CFLAGS += -DINIT_KEY_DIST='DM_KEY_DIST_IRK'

# /*! Responder key distribution flags */
#PROJ_CFLAGS += -DRESP_KEY_DIST='DM_KEY_DIST_LTK | DM_KEY_DIST_IRK'

# /*! TRUE if Out-of band pairing data is present */
#PROJ_CFLAGS += -DOUT_OF_BAND=FALSE

# /*! TRUE to initiate security upon connection*/
PROJ_CFLAGS += -DINIT_SECURITY=TRUE
9 changes: 5 additions & 4 deletions Examples/MAX32665/Bluetooth/BLE_dats/dats_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ static const uint8_t datsAdvDataDisc[] = {

/*! scan data, discoverable mode */
static const uint8_t deviceName[] = ADV_NAME;
static uint8_t datsScanDataDisc[sizeof(deviceName)+2];
static uint8_t datsScanDataDisc[sizeof(deviceName) + 2];

/**************************************************************************************************
Client Characteristic Configuration Descriptors
Expand Down Expand Up @@ -530,9 +530,10 @@ static void datsSetup(dmEvt_t *pMsg)
{
/* Initialize control information */
datsCb.restoringResList = FALSE;
memcpy(&datsScanDataDisc[2], deviceName,sizeof(deviceName));
datsScanDataDisc[0] = sizeof(deviceName);
datsScanDataDisc[1] = DM_ADV_TYPE_LOCAL_NAME;

memcpy(&datsScanDataDisc[2], deviceName, sizeof(deviceName));
datsScanDataDisc[0] = sizeof(deviceName);
datsScanDataDisc[1] = DM_ADV_TYPE_LOCAL_NAME;
/* set advertising and scan response data for discoverable mode */
AppAdvSetData(APP_ADV_DATA_DISCOVERABLE, sizeof(datsAdvDataDisc), (uint8_t *)datsAdvDataDisc);
AppAdvSetData(APP_SCAN_DATA_DISCOVERABLE, sizeof(datsScanDataDisc),
Expand Down
17 changes: 2 additions & 15 deletions Examples/MAX32665/Bluetooth/BLE_dats/project.mk
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,9 @@ VPATH += services


# SET advertising name
#PROJ_CFLAGS += -DADV_NAME=\"This\ is\ the\ real\ world\"
PROJ_CFLAGS += -DADV_NAME=\"DATS\"

ADV_NAME?=DATS
PROJ_CFLAGS += -DADV_NAME=\"$(ADV_NAME)\"

### CONFIGURE security
# /*! Authentication and bonding flags */
#PROJ_CFLAGS += -DAUTH_BOND='DM_AUTH_BOND_FLAG | DM_AUTH_SC_FLAG | DM_AUTH_MITM_FLAG'

# /*! Initiator key distribution flags */
#PROJ_CFLAGS += -DINIT_KEY_DIST='DM_KEY_DIST_IRK'

# /*! Responder key distribution flags */
#PROJ_CFLAGS += -DRESP_KEY_DIST='DM_KEY_DIST_LTK | DM_KEY_DIST_IRK'

# /*! TRUE if Out-of band pairing data is present */
#PROJ_CFLAGS += -DOUT_OF_BAND=FALSE

# /*! TRUE to initiate security upon connection*/
PROJ_CFLAGS += -DINIT_SECURITY=FALSE
8 changes: 4 additions & 4 deletions Examples/MAX32665/Bluetooth/BLE_otac/datc_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ static const appSecCfg_t datcSecCfg = {
DM_KEY_DIST_IRK, /*! Initiator key distribution flags */
DM_KEY_DIST_LTK | DM_KEY_DIST_IRK, /*! Responder key distribution flags */
FALSE, /*! TRUE if Out-of-band pairing data is present */
TRUE /*! TRUE to initiate security upon connection */
INIT_SECURITY /*! TRUE to initiate security upon connection */
};

/*! TRUE if Out-of-band pairing data is to be sent */
Expand Down Expand Up @@ -494,9 +494,9 @@ static void datcScanReport(dmEvt_t *pMsg)
if (!connect && ((pData = DmFindAdType(DM_ADV_TYPE_LOCAL_NAME, pMsg->scanReport.len,
pMsg->scanReport.pData)) != NULL)) {
/* check length and device name */
if (pData[DM_AD_LEN_IDX] >= 4 && (pData[DM_AD_DATA_IDX] == 'O') &&
(pData[DM_AD_DATA_IDX + 1] == 'T') && (pData[DM_AD_DATA_IDX + 2] == 'A') &&
(pData[DM_AD_DATA_IDX + 3] == 'S')) {
char advName[] = ADV_NAME;
if (pData[DM_AD_LEN_IDX] == sizeof(advName) &&
!strncmp(advName, (char *)&(pData[DM_AD_DATA_IDX]), sizeof(advName))) {
connect = TRUE;
}
}
Expand Down
10 changes: 10 additions & 0 deletions Examples/MAX32665/Bluetooth/BLE_otac/project.mk
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,13 @@ fw_obj: $(FW_UPDATE_OBJ)
${FW_UPDATE_OBJ}: fw_update.S ${FW_UPDATE_BIN}
${CC} ${AFLAGS} -o ${@} -c fw_update.S


# set ADVTISEMENT name you want to connect
ADV_NAME?=DATS
PROJ_CFLAGS += -DADV_NAME=\"$(ADV_NAME)\"



### CONFIGURE security
# /*! TRUE to initiate security upon connection*/
PROJ_CFLAGS += -DINIT_SECURITY=TRUE
Loading

0 comments on commit 562d1f9

Please sign in to comment.