@@ -773,6 +773,108 @@ static uint8_t proxy_private_identity_enable(const void *cmd, uint16_t cmd_len,
773
773
}
774
774
#endif
775
775
776
+ #if defined(CONFIG_BT_MESH_SOL_PDU_RPL_CLI )
777
+ static struct bt_mesh_sol_pdu_rpl_cli srpl_cli ;
778
+ #endif
779
+
780
+
781
+ #if defined(CONFIG_BT_MESH_OD_PRIV_PROXY_CLI )
782
+ static struct bt_mesh_od_priv_proxy_cli od_priv_proxy_cli ;
783
+
784
+ static uint8_t od_priv_proxy_get (const void * cmd , uint16_t cmd_len ,
785
+ void * rsp , uint16_t * rsp_len )
786
+ {
787
+ const struct btp_od_priv_proxy_get_cmd * cp = cmd ;
788
+ uint8_t val_rsp ;
789
+ int err ;
790
+
791
+ LOG_DBG ("" );
792
+
793
+ err = bt_mesh_od_priv_proxy_cli_get (net .net_idx , cp -> dst , & val_rsp );
794
+ if (err ) {
795
+ LOG_ERR ("Failed to get On-Demand Private Proxy state (err %d)" , err );
796
+ return BTP_STATUS_FAILED ;
797
+ }
798
+
799
+ LOG_DBG ("On-Demand Private Proxy state: %u" , val_rsp );
800
+
801
+ return BTP_STATUS_SUCCESS ;
802
+ }
803
+
804
+ static uint8_t od_priv_proxy_set (const void * cmd , uint16_t cmd_len ,
805
+ void * rsp , uint16_t * rsp_len )
806
+ {
807
+ const struct btp_od_priv_proxy_set_cmd * cp = cmd ;
808
+ uint8_t val_rsp ;
809
+ int err ;
810
+
811
+ LOG_DBG ("" );
812
+
813
+ err = bt_mesh_od_priv_proxy_cli_set (net .net_idx , cp -> dst , cp -> val , & val_rsp );
814
+ if (err ) {
815
+ LOG_ERR ("Failed to set On-Demand Private Proxy state (err %d)" , err );
816
+ return BTP_STATUS_FAILED ;
817
+ }
818
+
819
+ LOG_DBG ("On-Demand Private Proxy set state: %u" , val_rsp );
820
+
821
+ return BTP_STATUS_SUCCESS ;
822
+ }
823
+
824
+ #endif
825
+
826
+ #if defined(CONFIG_BT_MESH_SOL_PDU_RPL_CLI )
827
+ static uint8_t srpl_clear (const void * cmd , uint16_t cmd_len ,
828
+ void * rsp , uint16_t * rsp_len )
829
+ {
830
+ const struct btp_srpl_clear_cmd * cp = cmd ;
831
+ uint16_t app_idx = BT_MESH_KEY_UNUSED ;
832
+ uint16_t start_rsp ;
833
+ uint8_t len_rsp ;
834
+ int err ;
835
+
836
+ /* Lookup source address */
837
+ for (int i = 0 ; i < ARRAY_SIZE (model_bound ); i ++ ) {
838
+ if (model_bound [i ].model -> id == BT_MESH_MODEL_ID_SOL_PDU_RPL_CLI ) {
839
+ app_idx = model_bound [i ].appkey_idx ;
840
+ break ;
841
+ }
842
+ }
843
+
844
+ struct bt_mesh_msg_ctx ctx = BT_MESH_MSG_CTX_INIT_APP (app_idx , cp -> dst );
845
+
846
+ if (cp -> acked ) {
847
+ err = bt_mesh_sol_pdu_rpl_clear (& ctx , cp -> range_start , cp -> range_len , & start_rsp ,
848
+ & len_rsp );
849
+ } else {
850
+ err = bt_mesh_sol_pdu_rpl_clear_unack (& ctx , cp -> range_start , cp -> range_len );
851
+ }
852
+ if (err ) {
853
+ LOG_ERR ("Failed to clear SRPL (err %d)" , err );
854
+ return BTP_STATUS_FAILED ;
855
+ }
856
+
857
+ return BTP_STATUS_SUCCESS ;
858
+ }
859
+ #endif
860
+
861
+ #if defined(CONFIG_BT_MESH_PROXY_SOLICITATION )
862
+ static uint8_t proxy_solicit (const void * cmd , uint16_t cmd_len ,
863
+ void * rsp , uint16_t * rsp_len )
864
+ {
865
+ const struct btp_proxy_solicit_cmd * cp = cmd ;
866
+ int err ;
867
+
868
+ err = bt_mesh_proxy_solicit (cp -> net_idx );
869
+ if (err ) {
870
+ LOG_ERR ("Failed to advertise solicitation PDU (err %d)" , err );
871
+ return BTP_STATUS_FAILED ;
872
+ }
873
+
874
+ return BTP_STATUS_SUCCESS ;
875
+ }
876
+ #endif /* CONFIG_BT_MESH_PROXY_SOLICITATION */
877
+
776
878
static struct bt_mesh_model root_models [] = {
777
879
BT_MESH_MODEL_CFG_SRV ,
778
880
BT_MESH_MODEL_CFG_CLI (& cfg_cli ),
@@ -817,6 +919,16 @@ static struct bt_mesh_model root_models[] = {
817
919
#if defined(CONFIG_BT_MESH_PRIV_BEACON_CLI )
818
920
BT_MESH_MODEL_PRIV_BEACON_CLI (& priv_beacon_cli ),
819
921
#endif
922
+ #if defined(CONFIG_BT_MESH_OD_PRIV_PROXY_CLI )
923
+ BT_MESH_MODEL_OD_PRIV_PROXY_CLI (& od_priv_proxy_cli ),
924
+ #endif
925
+ #if defined(CONFIG_BT_MESH_SOL_PDU_RPL_CLI )
926
+ BT_MESH_MODEL_SOL_PDU_RPL_CLI (& srpl_cli ),
927
+ #endif
928
+ #if defined(CONFIG_BT_MESH_OD_PRIV_PROXY_SRV )
929
+ BT_MESH_MODEL_OD_PRIV_PROXY_SRV ,
930
+ #endif
931
+
820
932
};
821
933
struct model_data * lookup_model_bound (uint16_t id )
822
934
{
@@ -4783,6 +4895,32 @@ static const struct btp_handler handlers[] = {
4783
4895
.func = proxy_private_identity_enable
4784
4896
},
4785
4897
#endif
4898
+ #if defined(CONFIG_BT_MESH_OD_PRIV_PROXY_CLI )
4899
+ {
4900
+ .opcode = BTP_MESH_OD_PRIV_PROXY_GET ,
4901
+ .expect_len = sizeof (struct btp_od_priv_proxy_get_cmd ),
4902
+ .func = od_priv_proxy_get
4903
+ },
4904
+ {
4905
+ .opcode = BTP_MESH_OD_PRIV_PROXY_SET ,
4906
+ .expect_len = sizeof (struct btp_od_priv_proxy_set_cmd ),
4907
+ .func = od_priv_proxy_set
4908
+ },
4909
+ #endif
4910
+ #if defined(CONFIG_BT_MESH_SOL_PDU_RPL_CLI )
4911
+ {
4912
+ .opcode = BTP_MESH_SRPL_CLEAR ,
4913
+ .expect_len = sizeof (struct btp_srpl_clear_cmd ),
4914
+ .func = srpl_clear
4915
+ },
4916
+ #endif
4917
+ #if defined(CONFIG_BT_MESH_SOLICITATION )
4918
+ {
4919
+ .opcode = BTP_MESH_PROXY_SOLICIT ,
4920
+ .expect_len = sizeof (struct btp_proxy_solicit_cmd ),
4921
+ .func = proxy_solicit
4922
+ },
4923
+ #endif
4786
4924
};
4787
4925
4788
4926
0 commit comments