@@ -472,7 +472,7 @@ DeviceCommissioner::DeviceCommissioner() :
472
472
DeviceCommissioner::~DeviceCommissioner ()
473
473
{
474
474
#if CHIP_DEVICE_CONFIG_ENABLE_WIFIPAF
475
- SetChkObjValid ((void *)this , ObjChkAction::Clear, nullptr );
475
+ SetChkObjValid ((void *) this , ObjChkAction::Clear, nullptr );
476
476
#endif
477
477
}
478
478
@@ -833,7 +833,7 @@ CHIP_ERROR DeviceCommissioner::EstablishPASEConnection(NodeId remoteDeviceId, Re
833
833
ExitNow (CHIP_ERROR_INTERNAL);
834
834
}
835
835
mRendezvousParametersForDeviceDiscoveredOverWiFiPAF = params;
836
- SetChkObjValid ((void *) this , ObjChkAction::Set, nullptr );
836
+ SetChkObjValid ((void *) this , ObjChkAction::Set, nullptr );
837
837
DeviceLayer::ConnectivityMgr ().WiFiPAFConnect (params.GetSetupDiscriminator ().value (), (void *) this ,
838
838
OnWiFiPAFSubscribeComplete, OnWiFiPAFSubscribeError);
839
839
ExitNow (CHIP_NO_ERROR);
@@ -908,49 +908,55 @@ void DeviceCommissioner::OnDiscoveredDeviceOverBleError(void * appState, CHIP_ER
908
908
#endif // CONFIG_NETWORK_LAYER_BLE
909
909
910
910
#if CHIP_DEVICE_CONFIG_ENABLE_WIFIPAF
911
- void DeviceCommissioner::SetChkObjValid (void * appObj, ObjChkAction action, bool * pIsObjValid)
911
+ void DeviceCommissioner::SetChkObjValid (void * appObj, ObjChkAction action, bool * pIsObjValid)
912
912
{
913
- static std::vector<void *> ObjVector;
913
+ static std::vector<void *> ObjVector;
914
914
bool IsObjValid = false ;
915
915
916
- switch (action) {
917
- case ObjChkAction::Set: {
918
- for (auto lt=ObjVector.begin (); lt!=ObjVector.end (); lt++)
916
+ switch (action)
917
+ {
918
+ case ObjChkAction::Set: {
919
+ for (auto lt = ObjVector.begin (); lt != ObjVector.end (); lt++)
920
+ {
921
+ if (*lt == appObj)
919
922
{
920
- if (*lt == appObj) {
921
- IsObjValid = true ;
922
- break ;
923
- }
924
- }
925
- if (IsObjValid == false ) {
926
- ObjVector.push_back (appObj);
927
923
IsObjValid = true ;
924
+ break ;
928
925
}
929
926
}
930
- break ;
931
- case ObjChkAction::Check: {
932
- for (auto lt=ObjVector.begin (); lt!=ObjVector.end (); lt++)
927
+ if (IsObjValid == false )
928
+ {
929
+ ObjVector.push_back (appObj);
930
+ IsObjValid = true ;
931
+ }
932
+ }
933
+ break ;
934
+ case ObjChkAction::Check: {
935
+ for (auto lt = ObjVector.begin (); lt != ObjVector.end (); lt++)
936
+ {
937
+ if (*lt == appObj)
933
938
{
934
- if (*lt == appObj) {
935
- IsObjValid = true ;
936
- break ;
937
- }
939
+ IsObjValid = true ;
940
+ break ;
938
941
}
939
942
}
940
- break ;
941
- case ObjChkAction::Clear: {
942
- for (auto lt=ObjVector.begin (); lt!=ObjVector.end (); lt++)
943
+ }
944
+ break ;
945
+ case ObjChkAction::Clear: {
946
+ for (auto lt = ObjVector.begin (); lt != ObjVector.end (); lt++)
947
+ {
948
+ if (*lt == appObj)
943
949
{
944
- if (*lt == appObj) {
945
- // Already existed in the list => Remove it
946
- ObjVector.erase (lt);
947
- break ;
948
- }
950
+ // Already existed in the list => Remove it
951
+ ObjVector.erase (lt);
952
+ break ;
949
953
}
950
954
}
951
- break ;
952
955
}
953
- if (pIsObjValid != nullptr ) {
956
+ break ;
957
+ }
958
+ if (pIsObjValid != nullptr )
959
+ {
954
960
*pIsObjValid = IsObjValid;
955
961
}
956
962
return ;
@@ -960,12 +966,13 @@ void DeviceCommissioner::OnWiFiPAFSubscribeComplete(void * appState)
960
966
{
961
967
bool isObjValid;
962
968
SetChkObjValid (appState, ObjChkAction::Check, &isObjValid);
963
- if (isObjValid == false ) {
969
+ if (isObjValid == false )
970
+ {
964
971
// The caller has been released.
965
972
ChipLogError (Controller, " DeviceCommissioner has been destroyed!" );
966
973
return ;
967
974
}
968
- auto self = (DeviceCommissioner*) appState;
975
+ auto self = (DeviceCommissioner *) appState;
969
976
auto device = self->mDeviceInPASEEstablishment ;
970
977
971
978
if (nullptr != device && device->GetDeviceTransportType () == Transport::Type::kWiFiPAF )
@@ -984,12 +991,13 @@ void DeviceCommissioner::OnWiFiPAFSubscribeError(void * appState, CHIP_ERROR err
984
991
{
985
992
bool isObjValid;
986
993
SetChkObjValid (appState, ObjChkAction::Check, &isObjValid);
987
- if (isObjValid == false ) {
994
+ if (isObjValid == false )
995
+ {
988
996
// The caller has been released.
989
997
ChipLogError (Controller, " DeviceCommissioner has been destroyed!" );
990
998
return ;
991
999
}
992
- auto self = (DeviceCommissioner*) appState;
1000
+ auto self = (DeviceCommissioner *) appState;
993
1001
auto device = self->mDeviceInPASEEstablishment ;
994
1002
995
1003
if (nullptr != device && device->GetDeviceTransportType () == Transport::Type::kWiFiPAF )
0 commit comments