Bluetooth: btp: Add Mesh Clear Replay Protection List Cache command
This command is needed for Bluetooth Mesh testing against PTS. Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
This commit is contained in:
parent
a909aa3a0b
commit
8274cbabf6
4 changed files with 35 additions and 0 deletions
|
@ -89,6 +89,12 @@ int bt_test_mesh_lpn_group_add(u16_t group);
|
|||
*/
|
||||
int bt_test_mesh_lpn_group_remove(u16_t *groups, size_t groups_count);
|
||||
|
||||
/** Clear replay protection list cache.
|
||||
*
|
||||
* @return Zero on success or (negative) error code otherwise.
|
||||
*/
|
||||
int bt_test_mesh_rpl_clear(void);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
|
||||
#include "mesh/net.h"
|
||||
#include "mesh/lpn.h"
|
||||
#include "mesh/transport.h"
|
||||
|
||||
#include "testing.h"
|
||||
|
||||
|
@ -88,3 +89,10 @@ int bt_test_mesh_lpn_group_remove(u16_t *groups, size_t groups_count)
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int bt_test_mesh_rpl_clear(void)
|
||||
{
|
||||
bt_mesh_rpl_clear();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -765,6 +765,8 @@ struct mesh_lpn_unsubscribe_cmd {
|
|||
u16_t address;
|
||||
} __packed;
|
||||
|
||||
#define MESH_RPL_CLEAR 0x12
|
||||
|
||||
/* events */
|
||||
#define MESH_EV_OUT_NUMBER_ACTION 0x80
|
||||
struct mesh_out_number_action_ev {
|
||||
|
|
|
@ -88,6 +88,7 @@ static void supported_commands(u8_t *data, u16_t len)
|
|||
#if defined(CONFIG_BT_TESTING)
|
||||
tester_set_bit(buf->data, MESH_LPN_SUBSCRIBE);
|
||||
tester_set_bit(buf->data, MESH_LPN_UNSUBSCRIBE);
|
||||
tester_set_bit(buf->data, MESH_RPL_CLEAR);
|
||||
#endif /* CONFIG_BT_TESTING */
|
||||
|
||||
tester_send(BTP_SERVICE_ID_MESH, MESH_READ_SUPPORTED_COMMANDS,
|
||||
|
@ -690,6 +691,21 @@ static void lpn_unsubscribe(u8_t *data, u16_t len)
|
|||
tester_rsp(BTP_SERVICE_ID_MESH, MESH_LPN_UNSUBSCRIBE, CONTROLLER_INDEX,
|
||||
err ? BTP_STATUS_FAILED : BTP_STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
static void rpl_clear(u8_t *data, u16_t len)
|
||||
{
|
||||
int err;
|
||||
|
||||
SYS_LOG_DBG("");
|
||||
|
||||
err = bt_test_mesh_rpl_clear();
|
||||
if (err) {
|
||||
SYS_LOG_ERR("Failed to clear RPL (err %d)", err);
|
||||
}
|
||||
|
||||
tester_rsp(BTP_SERVICE_ID_MESH, MESH_RPL_CLEAR, CONTROLLER_INDEX,
|
||||
err ? BTP_STATUS_FAILED : BTP_STATUS_SUCCESS);
|
||||
}
|
||||
#endif /* CONFIG_BT_TESTING */
|
||||
|
||||
void tester_handle_mesh(u8_t opcode, u8_t index, u8_t *data, u16_t len)
|
||||
|
@ -747,6 +763,9 @@ void tester_handle_mesh(u8_t opcode, u8_t index, u8_t *data, u16_t len)
|
|||
case MESH_LPN_UNSUBSCRIBE:
|
||||
lpn_unsubscribe(data, len);
|
||||
break;
|
||||
case MESH_RPL_CLEAR:
|
||||
rpl_clear(data, len);
|
||||
break;
|
||||
#endif /* CONFIG_BT_TESTING */
|
||||
default:
|
||||
tester_rsp(BTP_SERVICE_ID_MESH, opcode, index,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue