@@ -634,6 +634,12 @@ static struct bt_mesh_model root_models[] = {
634
634
#if defined(CONFIG_BT_MESH_LARGE_COMP_DATA_CLI )
635
635
BT_MESH_MODEL_LARGE_COMP_DATA_CLI (& lcd_cli ),
636
636
#endif
637
+ #if defined(CONFIG_BT_MESH_OP_AGG_SRV )
638
+ BT_MESH_MODEL_OP_AGG_SRV ,
639
+ #endif
640
+ #if defined(CONFIG_BT_MESH_OP_AGG_CLI )
641
+ BT_MESH_MODEL_OP_AGG_CLI ,
642
+ #endif
637
643
#if defined(CONFIG_BT_MESH_RPR_CLI )
638
644
BT_MESH_MODEL_RPR_CLI (& rpr_cli ),
639
645
#endif
@@ -2491,6 +2497,8 @@ static uint8_t config_model_app_bind(const void *cmd, uint16_t cmd_len,
2491
2497
2492
2498
LOG_DBG ("" );
2493
2499
2500
+ bt_mesh_cfg_cli_timeout_set (5000 );
2501
+
2494
2502
err = bt_mesh_cfg_cli_mod_app_bind (sys_le16_to_cpu (cp -> net_idx ),
2495
2503
sys_le16_to_cpu (cp -> address ),
2496
2504
sys_le16_to_cpu (cp -> elem_address ),
@@ -2934,7 +2942,7 @@ static uint8_t health_fault_clear(const void *cmd, uint16_t cmd_len,
2934
2942
.addr = sys_le16_to_cpu (cp -> address ),
2935
2943
.app_idx = sys_le16_to_cpu (cp -> app_idx ),
2936
2944
};
2937
- uint8_t test_id ;
2945
+ uint8_t test_id = 0 ;
2938
2946
size_t fault_count = 16 ;
2939
2947
uint8_t faults [fault_count ];
2940
2948
int err ;
@@ -2944,7 +2952,20 @@ static uint8_t health_fault_clear(const void *cmd, uint16_t cmd_len,
2944
2952
if (cp -> ack ) {
2945
2953
err = bt_mesh_health_cli_fault_clear (& health_cli , & ctx ,
2946
2954
sys_le16_to_cpu (cp -> cid ),
2947
- & test_id , faults ,
2955
+ #if defined(CONFIG_BT_MESH_OP_AGG_CLI )
2956
+ bt_mesh_op_agg_cli_seq_is_started () ?
2957
+ NULL :
2958
+ #endif
2959
+ & test_id ,
2960
+ #if defined(CONFIG_BT_MESH_OP_AGG_CLI )
2961
+ bt_mesh_op_agg_cli_seq_is_started () ?
2962
+ NULL :
2963
+ #endif
2964
+ faults ,
2965
+ #if defined(CONFIG_BT_MESH_OP_AGG_CLI )
2966
+ bt_mesh_op_agg_cli_seq_is_started () ?
2967
+ NULL :
2968
+ #endif
2948
2969
& fault_count );
2949
2970
} else {
2950
2971
err = bt_mesh_health_cli_fault_clear_unack (& health_cli , & ctx ,
@@ -2977,20 +2998,37 @@ static uint8_t health_fault_test(const void *cmd, uint16_t cmd_len,
2977
2998
};
2978
2999
size_t fault_count = 16 ;
2979
3000
uint8_t faults [fault_count ];
2980
- uint8_t test_id ;
2981
- uint16_t cid ;
2982
3001
int err ;
2983
3002
2984
3003
LOG_DBG ("" );
2985
3004
2986
- test_id = cp -> test_id ;
2987
- cid = sys_le16_to_cpu (cp -> cid );
2988
-
2989
3005
if (cp -> ack ) {
2990
- err = bt_mesh_health_cli_fault_test (& health_cli , & ctx , cid , test_id , faults ,
3006
+ err = bt_mesh_health_cli_fault_test (& health_cli , & ctx ,
3007
+ sys_le16_to_cpu (cp -> cid ),
3008
+ #if defined(CONFIG_BT_MESH_OP_AGG_CLI )
3009
+ bt_mesh_op_agg_cli_seq_is_started () ?
3010
+ 0 :
3011
+ #endif
3012
+ cp -> test_id ,
3013
+ #if defined(CONFIG_BT_MESH_OP_AGG_CLI )
3014
+ bt_mesh_op_agg_cli_seq_is_started () ?
3015
+ NULL :
3016
+ #endif
3017
+ faults ,
3018
+ #if defined(CONFIG_BT_MESH_OP_AGG_CLI )
3019
+ bt_mesh_op_agg_cli_seq_is_started () ?
3020
+ NULL :
3021
+ #endif
2991
3022
& fault_count );
3023
+ #if defined(CONFIG_BT_MESH_OP_AGG_CLI )
3024
+ if (bt_mesh_op_agg_cli_seq_is_started ()) {
3025
+ fault_count = 0 ;
3026
+ }
3027
+ #endif
2992
3028
} else {
2993
- err = bt_mesh_health_cli_fault_test_unack (& health_cli , & ctx , cid , test_id );
3029
+ err = bt_mesh_health_cli_fault_test_unack (& health_cli , & ctx ,
3030
+ sys_le16_to_cpu (cp -> cid ),
3031
+ cp -> test_id );
2994
3032
}
2995
3033
2996
3034
if (err ) {
@@ -3001,8 +3039,8 @@ static uint8_t health_fault_test(const void *cmd, uint16_t cmd_len,
3001
3039
if (cp -> ack ) {
3002
3040
struct btp_mesh_health_fault_test_rp * rp = rsp ;
3003
3041
3004
- rp -> test_id = test_id ;
3005
- rp -> cid = sys_cpu_to_le16 ( cid ) ;
3042
+ rp -> test_id = cp -> test_id ;
3043
+ rp -> cid = cp -> cid ;
3006
3044
(void )memcpy (rp -> faults , faults , fault_count );
3007
3045
3008
3046
* rsp_len = sizeof (* rp ) + fault_count ;
@@ -3051,6 +3089,10 @@ static uint8_t health_period_set(const void *cmd, uint16_t cmd_len,
3051
3089
3052
3090
if (cp -> ack ) {
3053
3091
err = bt_mesh_health_cli_period_set (& health_cli , & ctx , cp -> divisor ,
3092
+ #if defined(CONFIG_BT_MESH_OP_AGG_CLI )
3093
+ bt_mesh_op_agg_cli_seq_is_started () ?
3094
+ NULL :
3095
+ #endif
3054
3096
& updated_divisor );
3055
3097
} else {
3056
3098
err = bt_mesh_health_cli_period_set_unack (& health_cli , & ctx , cp -> divisor );
@@ -3112,6 +3154,10 @@ static uint8_t health_attention_set(const void *cmd, uint16_t cmd_len,
3112
3154
3113
3155
if (cp -> ack ) {
3114
3156
err = bt_mesh_health_cli_attention_set (& health_cli , & ctx , cp -> attention ,
3157
+ #if defined(CONFIG_BT_MESH_OP_AGG_CLI )
3158
+ bt_mesh_op_agg_cli_seq_is_started () ?
3159
+ NULL :
3160
+ #endif
3115
3161
& updated_attention );
3116
3162
} else {
3117
3163
err = bt_mesh_health_cli_attention_set_unack (& health_cli , & ctx , cp -> attention );
@@ -3133,6 +3179,41 @@ static uint8_t health_attention_set(const void *cmd, uint16_t cmd_len,
3133
3179
return BTP_STATUS_SUCCESS ;
3134
3180
}
3135
3181
3182
+ #if defined(CONFIG_BT_MESH_OP_AGG_CLI )
3183
+ static uint8_t opcodes_aggregator_init (const void * cmd , uint16_t cmd_len ,
3184
+ void * rsp , uint16_t * rsp_len )
3185
+ {
3186
+ const struct btp_mesh_opcodes_aggregator_init_cmd * cp = cmd ;
3187
+ int err ;
3188
+
3189
+ LOG_DBG ("" );
3190
+
3191
+ err = bt_mesh_op_agg_cli_seq_start (cp -> net_idx , cp -> app_idx , cp -> dst , cp -> elem_addr );
3192
+ if (err ) {
3193
+ LOG_ERR ("Failed to init Opcodes Aggregator Context (err %d)" , err );
3194
+ return BTP_STATUS_FAILED ;
3195
+ }
3196
+
3197
+ return BTP_STATUS_SUCCESS ;
3198
+ }
3199
+
3200
+ static uint8_t opcodes_aggregator_send (const void * cmd , uint16_t cmd_len ,
3201
+ void * rsp , uint16_t * rsp_len )
3202
+ {
3203
+ int err ;
3204
+
3205
+ LOG_DBG ("" );
3206
+
3207
+ err = bt_mesh_op_agg_cli_seq_send ();
3208
+ if (err ) {
3209
+ LOG_ERR ("Failed to send Opcodes Aggregator message (err %d)" , err );
3210
+ return BTP_STATUS_FAILED ;
3211
+ }
3212
+
3213
+ return BTP_STATUS_SUCCESS ;
3214
+ }
3215
+ #endif
3216
+
3136
3217
#if defined(CONFIG_BT_MESH_RPR_CLI )
3137
3218
static uint8_t rpr_scan_start (const void * cmd , uint16_t cmd_len ,
3138
3219
void * rsp , uint16_t * rsp_len )
@@ -4426,6 +4507,18 @@ static const struct btp_handler handlers[] = {
4426
4507
.expect_len = sizeof (struct btp_mesh_models_metadata_get_cmd ),
4427
4508
.func = models_metadata_get
4428
4509
},
4510
+ #endif
4511
+ #if defined(CONFIG_BT_MESH_OP_AGG_CLI )
4512
+ {
4513
+ .opcode = BTP_MESH_OPCODES_AGGREGATOR_INIT ,
4514
+ .expect_len = sizeof (struct btp_mesh_opcodes_aggregator_init_cmd ),
4515
+ .func = opcodes_aggregator_init
4516
+ },
4517
+ {
4518
+ .opcode = BTP_MESH_OPCODES_AGGREGATOR_SEND ,
4519
+ .expect_len = 0 ,
4520
+ .func = opcodes_aggregator_send
4521
+ },
4429
4522
#endif
4430
4523
{
4431
4524
.opcode = BTP_MESH_COMP_CHANGE_PREPARE ,
0 commit comments