@@ -680,12 +680,52 @@ def __init__(self, future: Future, eventLoop, devCtrl, returnClusterObject: bool
680
680
self ._pReadClient = None
681
681
self ._pReadCallback = None
682
682
self ._resultError = None
683
+
684
+ print ("\n \n \n " )
685
+ print (f"AsyncReadTransaction - __init__" )
686
+ print (f"self._event_loop: { self ._event_loop } " )
687
+ print (f"self._future: { self ._future } " )
688
+ print (f"self._subscription_handler: { self ._subscription_handler } " )
689
+ print (f"self._events: { self ._events } " )
690
+ print (f"self._devCtrl: { self ._devCtrl } " )
691
+ print (f"self._cache: { self ._cache } " )
692
+ print (f"self._changedPathSet: { self ._changedPathSet } " )
693
+ print (f"self._pReadClient: { self ._pReadClient } " )
694
+ print (f"self._pReadCallback: { self ._pReadCallback } " )
695
+ print (f"self._resultError: { self ._resultError } " )
696
+ print ("\n \n \n " )
683
697
684
698
def SetClientObjPointers (self , pReadClient , pReadCallback ):
685
699
self ._pReadClient = pReadClient
686
700
self ._pReadCallback = pReadCallback
701
+ print ("\n \n \n " )
702
+ print (f"AsyncReadTransaction - SetClientObjPointers" )
703
+ print (f"self._event_loop: { self ._event_loop } " )
704
+ print (f"self._future: { self ._future } " )
705
+ print (f"self._subscription_handler: { self ._subscription_handler } " )
706
+ print (f"self._events: { self ._events } " )
707
+ print (f"self._devCtrl: { self ._devCtrl } " )
708
+ print (f"self._cache: { self ._cache } " )
709
+ print (f"self._changedPathSet: { self ._changedPathSet } " )
710
+ print (f"self._pReadClient: { self ._pReadClient } " )
711
+ print (f"self._pReadCallback: { self ._pReadCallback } " )
712
+ print (f"self._resultError: { self ._resultError } " )
713
+ print ("\n \n \n " )
687
714
688
715
def GetAllEventValues (self ):
716
+ print ("\n \n \n " )
717
+ print (f"AsyncReadTransaction - GetAllEventValues" )
718
+ print (f"self._event_loop: { self ._event_loop } " )
719
+ print (f"self._future: { self ._future } " )
720
+ print (f"self._subscription_handler: { self ._subscription_handler } " )
721
+ print (f"self._events: { self ._events } " )
722
+ print (f"self._devCtrl: { self ._devCtrl } " )
723
+ print (f"self._cache: { self ._cache } " )
724
+ print (f"self._changedPathSet: { self ._changedPathSet } " )
725
+ print (f"self._pReadClient: { self ._pReadClient } " )
726
+ print (f"self._pReadCallback: { self ._pReadCallback } " )
727
+ print (f"self._resultError: { self ._resultError } " )
728
+ print ("\n \n \n " )
689
729
return self ._events
690
730
691
731
def handleAttributeData (self , path : AttributePathWithListIndex , dataVersion : int , status : int , data : bytes ):
@@ -702,6 +742,20 @@ def handleAttributeData(self, path: AttributePathWithListIndex, dataVersion: int
702
742
self ._cache .UpdateTLV (path , dataVersion , attributeValue )
703
743
self ._changedPathSet .add (path )
704
744
745
+ print ("\n \n \n " )
746
+ print (f"AsyncReadTransaction - handleAttributeData" )
747
+ print (f"self._event_loop: { self ._event_loop } " )
748
+ print (f"self._future: { self ._future } " )
749
+ print (f"self._subscription_handler: { self ._subscription_handler } " )
750
+ print (f"self._events: { self ._events } " )
751
+ print (f"self._devCtrl: { self ._devCtrl } " )
752
+ print (f"self._cache: { self ._cache } " )
753
+ print (f"self._changedPathSet: { self ._changedPathSet } " )
754
+ print (f"self._pReadClient: { self ._pReadClient } " )
755
+ print (f"self._pReadCallback: { self ._pReadCallback } " )
756
+ print (f"self._resultError: { self ._resultError } " )
757
+ print ("\n \n \n " )
758
+
705
759
except Exception as ex :
706
760
logging .exception (ex )
707
761
@@ -742,11 +796,39 @@ def handleEventData(self, header: EventHeader, path: EventPath, data: bytes, sta
742
796
self ._subscription_handler .OnEventChangeCb (
743
797
eventResult , self ._subscription_handler )
744
798
799
+ print ("\n \n \n " )
800
+ print (f"AsyncReadTransaction - handleEventData" )
801
+ print (f"self._event_loop: { self ._event_loop } " )
802
+ print (f"self._future: { self ._future } " )
803
+ print (f"self._subscription_handler: { self ._subscription_handler } " )
804
+ print (f"self._events: { self ._events } " )
805
+ print (f"self._devCtrl: { self ._devCtrl } " )
806
+ print (f"self._cache: { self ._cache } " )
807
+ print (f"self._changedPathSet: { self ._changedPathSet } " )
808
+ print (f"self._pReadClient: { self ._pReadClient } " )
809
+ print (f"self._pReadCallback: { self ._pReadCallback } " )
810
+ print (f"self._resultError: { self ._resultError } " )
811
+ print ("\n \n \n " )
812
+
745
813
except Exception as ex :
746
814
logging .exception (ex )
747
815
748
816
def handleError (self , chipError : PyChipError ):
749
817
self ._resultError = chipError .code
818
+
819
+ print ("\n \n \n " )
820
+ print (f"AsyncReadTransaction - handleError" )
821
+ print (f"self._event_loop: { self ._event_loop } " )
822
+ print (f"self._future: { self ._future } " )
823
+ print (f"self._subscription_handler: { self ._subscription_handler } " )
824
+ print (f"self._events: { self ._events } " )
825
+ print (f"self._devCtrl: { self ._devCtrl } " )
826
+ print (f"self._cache: { self ._cache } " )
827
+ print (f"self._changedPathSet: { self ._changedPathSet } " )
828
+ print (f"self._pReadClient: { self ._pReadClient } " )
829
+ print (f"self._pReadCallback: { self ._pReadCallback } " )
830
+ print (f"self._resultError: { self ._resultError } " )
831
+ print ("\n \n \n " )
750
832
751
833
def _handleSubscriptionEstablished (self , subscriptionId ):
752
834
if not self ._future .done ():
@@ -762,6 +844,20 @@ def _handleSubscriptionEstablished(self, subscriptionId):
762
844
else :
763
845
self ._subscription_handler ._onResubscriptionSucceededCb (self ._subscription_handler )
764
846
847
+ print ("\n \n \n " )
848
+ print (f"AsyncReadTransaction - _handleSubscriptionEstablished" )
849
+ print (f"self._event_loop: { self ._event_loop } " )
850
+ print (f"self._future: { self ._future } " )
851
+ print (f"self._subscription_handler: { self ._subscription_handler } " )
852
+ print (f"self._events: { self ._events } " )
853
+ print (f"self._devCtrl: { self ._devCtrl } " )
854
+ print (f"self._cache: { self ._cache } " )
855
+ print (f"self._changedPathSet: { self ._changedPathSet } " )
856
+ print (f"self._pReadClient: { self ._pReadClient } " )
857
+ print (f"self._pReadCallback: { self ._pReadCallback } " )
858
+ print (f"self._resultError: { self ._resultError } " )
859
+ print ("\n \n \n " )
860
+
765
861
def handleSubscriptionEstablished (self , subscriptionId ):
766
862
self ._event_loop .call_soon_threadsafe (
767
863
self ._handleSubscriptionEstablished , subscriptionId )
@@ -777,11 +873,52 @@ def handleResubscriptionAttempted(self, terminationCause: PyChipError, nextResub
777
873
self ._subscription_handler ._onResubscriptionAttemptedCb ,
778
874
self ._subscription_handler , terminationCause .code , nextResubscribeIntervalMsec )
779
875
876
+ print ("\n \n \n " )
877
+ print (f"AsyncReadTransaction - handleResubscriptionAttempted" )
878
+ print (f"self._event_loop: { self ._event_loop } " )
879
+ print (f"self._future: { self ._future } " )
880
+ print (f"self._subscription_handler: { self ._subscription_handler } " )
881
+ print (f"self._events: { self ._events } " )
882
+ print (f"self._devCtrl: { self ._devCtrl } " )
883
+ print (f"self._cache: { self ._cache } " )
884
+ print (f"self._changedPathSet: { self ._changedPathSet } " )
885
+ print (f"self._pReadClient: { self ._pReadClient } " )
886
+ print (f"self._pReadCallback: { self ._pReadCallback } " )
887
+ print (f"self._resultError: { self ._resultError } " )
888
+ print ("\n \n \n " )
889
+
780
890
def _handleReportBegin (self ):
891
+ print ("\n \n \n " )
892
+ print (f"AsyncReadTransaction - _handleReportBegin" )
893
+ print (f"self._event_loop: { self ._event_loop } " )
894
+ print (f"self._future: { self ._future } " )
895
+ print (f"self._subscription_handler: { self ._subscription_handler } " )
896
+ print (f"self._events: { self ._events } " )
897
+ print (f"self._devCtrl: { self ._devCtrl } " )
898
+ print (f"self._cache: { self ._cache } " )
899
+ print (f"self._changedPathSet: { self ._changedPathSet } " )
900
+ print (f"self._pReadClient: { self ._pReadClient } " )
901
+ print (f"self._pReadCallback: { self ._pReadCallback } " )
902
+ print (f"self._resultError: { self ._resultError } " )
903
+ print ("\n \n \n " )
781
904
pass
782
905
783
- def _handleReportEnd (self ):
906
+ def _handleReportEnd (self ):
784
907
self ._cache .UpdateCachedData (self ._changedPathSet )
908
+
909
+ print ("\n \n \n " )
910
+ print (f"AsyncReadTransaction - _handleReportEnd" )
911
+ print (f"self._event_loop: { self ._event_loop } " )
912
+ print (f"self._future: { self ._future } " )
913
+ print (f"self._subscription_handler: { self ._subscription_handler } " )
914
+ print (f"self._events: { self ._events } " )
915
+ print (f"self._devCtrl: { self ._devCtrl } " )
916
+ print (f"self._cache: { self ._cache } " )
917
+ print (f"self._changedPathSet: { self ._changedPathSet } " )
918
+ print (f"self._pReadClient: { self ._pReadClient } " )
919
+ print (f"self._pReadCallback: { self ._pReadCallback } " )
920
+ print (f"self._resultError: { self ._resultError } " )
921
+ print ("\n \n \n " )
785
922
786
923
if (self ._subscription_handler is not None ):
787
924
for change in self ._changedPathSet :
@@ -813,6 +950,20 @@ def _handleDone(self):
813
950
else :
814
951
self ._future .set_result (AsyncReadTransaction .ReadResponse (
815
952
attributes = self ._cache .attributeCache , events = self ._events , tlvAttributes = self ._cache .attributeTLVCache ))
953
+
954
+ print ("\n \n \n " )
955
+ print (f"AsyncReadTransaction - _handleDone" )
956
+ print (f"self._event_loop: { self ._event_loop } " )
957
+ print (f"self._future: { self ._future } " )
958
+ print (f"self._subscription_handler: { self ._subscription_handler } " )
959
+ print (f"self._events: { self ._events } " )
960
+ print (f"self._devCtrl: { self ._devCtrl } " )
961
+ print (f"self._cache: { self ._cache } " )
962
+ print (f"self._changedPathSet: { self ._changedPathSet } " )
963
+ print (f"self._pReadClient: { self ._pReadClient } " )
964
+ print (f"self._pReadCallback: { self ._pReadCallback } " )
965
+ print (f"self._resultError: { self ._resultError } " )
966
+ print ("\n \n \n " )
816
967
817
968
#
818
969
# Decrement the ref on ourselves to match the increment that happened at allocation.
@@ -823,14 +974,33 @@ def _handleDone(self):
823
974
824
975
def handleDone (self ):
825
976
self ._event_loop .call_soon_threadsafe (self ._handleDone )
826
-
977
+
827
978
def handleReportBegin (self ):
828
- pass
829
-
979
+ self . _handleReportBegin ()
980
+
830
981
def handleReportEnd (self ):
831
- # self._event_loop.call_soon_threadsafe(self._handleReportEnd)
832
982
self ._handleReportEnd ()
833
983
984
+ def _handleNotifySubscriptionStillActive (self ):
985
+ pass
986
+
987
+ def handleNotifySubscriptionStillActive (self ):
988
+ print ("\n \n \n \n \n \n \n \n \n \n \n " )
989
+ print (f"closure.handleNotifySubscriptionStillActive" )
990
+ print (f"\t \t AsyncReadTransaction - _handleReportBegin" )
991
+ print (f"\t \t self._event_loop: { self ._event_loop } " )
992
+ print (f"\t \t self._future: { self ._future } " )
993
+ print (f"\t \t self._subscription_handler: { self ._subscription_handler } " )
994
+ print (f"\t \t self._events: { self ._events } " )
995
+ print (f"\t \t self._devCtrl: { self ._devCtrl } " )
996
+ print (f"\t \t self._cache: { self ._cache } " )
997
+ print (f"\t \t self._changedPathSet: { self ._changedPathSet } " )
998
+ print (f"\t \t self._pReadClient: { self ._pReadClient } " )
999
+ print (f"\t \t self._pReadCallback: { self ._pReadCallback } " )
1000
+ print (f"\t \t self._resultError: { self ._resultError } " )
1001
+ print ("\n \n \n \n \n \n \n \n \n \n \n " )
1002
+ self ._handleNotifySubscriptionStillActive ()
1003
+
834
1004
835
1005
class AsyncWriteTransaction :
836
1006
def __init__ (self , future : Future , eventLoop ):
@@ -889,7 +1059,8 @@ def handleDone(self):
889
1059
None , py_object )
890
1060
_OnReportEndCallbackFunct = CFUNCTYPE (
891
1061
None , py_object )
892
-
1062
+ _OnNotifySubscriptionStillActiveCallbackFunct = CFUNCTYPE (
1063
+ None , py_object )
893
1064
894
1065
@_OnReadAttributeDataCallbackFunct
895
1066
def _OnReadAttributeDataCallback (closure , dataVersion : int , endpoint : int , cluster : int , attribute : int , status , data , len ):
@@ -937,6 +1108,11 @@ def _OnReportEndCallback(closure):
937
1108
closure .handleReportEnd ()
938
1109
939
1110
1111
+ @_OnNotifySubscriptionStillActiveCallbackFunct
1112
+ def _OnNotifySubscriptionStillActiveCallback (closure ):
1113
+ closure .handleNotifySubscriptionStillActive ()
1114
+
1115
+
940
1116
@_OnReadDoneCallbackFunct
941
1117
def _OnReadDoneCallback (closure ):
942
1118
closure .handleDone ()
@@ -1208,14 +1384,15 @@ def Init():
1208
1384
_OnReadAttributeDataCallbackFunct , _OnReadEventDataCallbackFunct ,
1209
1385
_OnSubscriptionEstablishedCallbackFunct , _OnResubscriptionAttemptedCallbackFunct ,
1210
1386
_OnReadErrorCallbackFunct , _OnReadDoneCallbackFunct ,
1211
- _OnReportBeginCallbackFunct , _OnReportEndCallbackFunct ])
1387
+ _OnReportBeginCallbackFunct , _OnReportEndCallbackFunct ,
1388
+ _OnNotifySubscriptionStillActiveCallbackFunct ])
1212
1389
1213
1390
handle .pychip_WriteClient_InitCallbacks (
1214
1391
_OnWriteResponseCallback , _OnWriteErrorCallback , _OnWriteDoneCallback )
1215
1392
handle .pychip_ReadClient_InitCallbacks (
1216
1393
_OnReadAttributeDataCallback , _OnReadEventDataCallback ,
1217
1394
_OnSubscriptionEstablishedCallback , _OnResubscriptionAttemptedCallback , _OnReadErrorCallback , _OnReadDoneCallback ,
1218
- _OnReportBeginCallback , _OnReportEndCallback )
1395
+ _OnReportBeginCallback , _OnReportEndCallback , _OnNotifySubscriptionStillActiveCallback )
1219
1396
1220
1397
_BuildAttributeIndex ()
1221
1398
_BuildClusterIndex ()
0 commit comments