16
16
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
17
* See the License for the specific language governing permissions and
18
18
* limitations under the License.
19
- */
19
+ */
20
20
21
21
#include < type_traits>
22
22
45
45
#include < credentials/attestation_verifier/DeviceAttestationVerifier.h>
46
46
#include < credentials/attestation_verifier/FileAttestationTrustStore.h>
47
47
48
- // Including AutoCommissioner initialization here for getting RootCert
48
+ // Including AutoCommissioner initialization here for getting RootCert
49
49
#include < controller/AutoCommissioner.h>
50
- #include < openssl/x509.h>
51
- #include < openssl/bio.h>
52
- #include < openssl/pem.h>
53
- #include < cstddef> // Added for size_t
50
+ #include < cstddef> // Added for size_t
54
51
#include < functional> // Added for std::function
55
52
#include < lib/core/TLVReader.h>
56
53
#include < lib/core/TLVTypes.h>
57
- // #include <thread> // Include this for std::this_thread
58
- // #include <chrono> // Include this for std::chrono::milliseconds
54
+ #include < openssl/bio.h>
55
+ #include < openssl/pem.h>
56
+ #include < openssl/x509.h>
57
+ // #include <thread> // Include this for std::this_thread
58
+ // #include <chrono> // Include this for std::chrono::milliseconds
59
59
60
60
using namespace chip ;
61
61
@@ -168,7 +168,7 @@ class TestCommissioner : public chip::Controller::AutoCommissioner
168
168
if (report.Is <chip::Controller::NocChain>())
169
169
{
170
170
auto nocChain = report.Get <chip::Controller::NocChain>();
171
- MutableByteSpan rcacSpan (const_cast <uint8_t *>(nocChain.rcac .data ()), nocChain.rcac .size ());
171
+ MutableByteSpan rcacSpan (const_cast <uint8_t *>(nocChain.rcac .data ()), nocChain.rcac .size ());
172
172
173
173
chip::ByteSpan rcacByteSpan (rcacSpan.data (), rcacSpan.size ());
174
174
@@ -337,10 +337,7 @@ class TestCommissioner : public chip::Controller::AutoCommissioner
337
337
}
338
338
}
339
339
340
- CHIP_ERROR GetCommissioningResultError () const
341
- {
342
- return mCommissioningResultError ;
343
- }
340
+ CHIP_ERROR GetCommissioningResultError () const { return mCommissioningResultError ; }
344
341
345
342
void SetOnRCACReadyCallback (RCACReadyCallback callback)
346
343
{
@@ -351,8 +348,8 @@ class TestCommissioner : public chip::Controller::AutoCommissioner
351
348
CHIP_ERROR GetCompletionError () { return mCompletionError ; }
352
349
353
350
// Getter method to access RCAC data
354
- // const std::vector<uint8_t>& GetRCACData() const { return mRCACData; }
355
- const std::vector<uint8_t >& GetCHIPRCACData () const { return mCHIPRCACData ; }
351
+ // const std::vector<uint8_t>& GetRCACData() const { return mRCACData; }
352
+ const std::vector<uint8_t > & GetCHIPRCACData () const { return mCHIPRCACData ; }
356
353
357
354
private:
358
355
void NotifyRCACDataReady ()
@@ -624,7 +621,8 @@ PyChipError pychip_OpCreds_AllocateController(OpCredsContext * context, chip::Co
624
621
{
625
622
initParams.defaultCommissioner = &sTestCommissioner ;
626
623
pairingDelegate->SetCommissioningSuccessCallback (pychip_OnCommissioningSuccess);
627
- // pairingDelegate->SetCommissioningSuccessCallback([](chip::PeerId peerId) { pychip_OnCommissioningSuccess(peerId, sTestCommissioner.GetRCACData().data(), sTestCommissioner.GetRCACData().size()); });
624
+ // pairingDelegate->SetCommissioningSuccessCallback([](chip::PeerId peerId) { pychip_OnCommissioningSuccess(peerId,
625
+ // sTestCommissioner.GetRCACData().data(), sTestCommissioner.GetRCACData().size()); });
628
626
pairingDelegate->SetCommissioningFailureCallback (pychip_OnCommissioningFailure);
629
627
pairingDelegate->SetCommissioningStatusUpdateCallback (pychip_OnCommissioningStatusUpdate);
630
628
}
@@ -764,29 +762,28 @@ PyChipError pychip_GetCompletionError()
764
762
}
765
763
766
764
extern " C" {
767
- // Define a global callback to set the RCAC data callback
768
- using PythonRCACCallback = void (*)(const uint8_t *, size_t );
769
- static PythonRCACCallback gPythonRCACCallback = nullptr ;
765
+ // Define a global callback to set the RCAC data callback
766
+ using PythonRCACCallback = void (*)(const uint8_t *, size_t );
767
+ static PythonRCACCallback gPythonRCACCallback = nullptr ;
770
768
769
+ // Function to set the Python callback
770
+ void pychip_SetCommissioningRCACCallback (PythonRCACCallback callback)
771
+ {
772
+ ChipLogProgress (Controller, " Attempting to set Python RCAC callback in C++" );
773
+ gPythonRCACCallback = callback;
771
774
772
- // Function to set the Python callback
773
- void pychip_SetCommissioningRCACCallback (PythonRCACCallback callback)
774
- {
775
- ChipLogProgress (Controller, " Attempting to set Python RCAC callback in C++" );
776
- gPythonRCACCallback = callback;
777
-
778
- // Set C++ TestCommissioner callback to notify Python when RCAC data is ready
779
- sTestCommissioner .SetOnRCACReadyCallback ([](const std::vector<uint8_t > & rcacData) {
780
- if (gPythonRCACCallback )
781
- {
782
- ChipLogProgress (Controller, " RCAC callback in C++ set" );
783
- gPythonRCACCallback (rcacData.data (), rcacData.size ());
784
- }
785
- else
786
- {
787
- ChipLogError (Controller, " Python RCAC callback is not set." );
788
- }
789
- });
775
+ // Set C++ TestCommissioner callback to notify Python when RCAC data is ready
776
+ sTestCommissioner .SetOnRCACReadyCallback ([](const std::vector<uint8_t > & rcacData) {
777
+ if (gPythonRCACCallback )
778
+ {
779
+ ChipLogProgress (Controller, " RCAC callback in C++ set" );
780
+ gPythonRCACCallback (rcacData.data (), rcacData.size ());
790
781
}
791
- }
782
+ else
783
+ {
784
+ ChipLogError (Controller, " Python RCAC callback is not set." );
785
+ }
786
+ });
787
+ }
788
+ }
792
789
} // extern "C"
0 commit comments