@@ -736,6 +736,9 @@ class VideoStreamSettings:
736
736
uri : std::string
737
737
Video stream URI
738
738
739
+ horizontal_fov_deg : float
740
+ Horizontal fov in degrees
741
+
739
742
"""
740
743
741
744
@@ -747,14 +750,16 @@ def __init__(
747
750
vertical_resolution_pix ,
748
751
bit_rate_b_s ,
749
752
rotation_deg ,
750
- uri ):
753
+ uri ,
754
+ horizontal_fov_deg ):
751
755
""" Initializes the VideoStreamSettings object """
752
756
self .frame_rate_hz = frame_rate_hz
753
757
self .horizontal_resolution_pix = horizontal_resolution_pix
754
758
self .vertical_resolution_pix = vertical_resolution_pix
755
759
self .bit_rate_b_s = bit_rate_b_s
756
760
self .rotation_deg = rotation_deg
757
761
self .uri = uri
762
+ self .horizontal_fov_deg = horizontal_fov_deg
758
763
759
764
def __equals__ (self , to_compare ):
760
765
""" Checks if two VideoStreamSettings are the same """
@@ -767,7 +772,8 @@ def __equals__(self, to_compare):
767
772
(self .vertical_resolution_pix == to_compare .vertical_resolution_pix ) and \
768
773
(self .bit_rate_b_s == to_compare .bit_rate_b_s ) and \
769
774
(self .rotation_deg == to_compare .rotation_deg ) and \
770
- (self .uri == to_compare .uri )
775
+ (self .uri == to_compare .uri ) and \
776
+ (self .horizontal_fov_deg == to_compare .horizontal_fov_deg )
771
777
772
778
except AttributeError :
773
779
return False
@@ -780,7 +786,8 @@ def __str__(self):
780
786
"vertical_resolution_pix: " + str (self .vertical_resolution_pix ),
781
787
"bit_rate_b_s: " + str (self .bit_rate_b_s ),
782
788
"rotation_deg: " + str (self .rotation_deg ),
783
- "uri: " + str (self .uri )
789
+ "uri: " + str (self .uri ),
790
+ "horizontal_fov_deg: " + str (self .horizontal_fov_deg )
784
791
])
785
792
786
793
return f"VideoStreamSettings: [{ struct_repr } ]"
@@ -805,7 +812,10 @@ def translate_from_rpc(rpcVideoStreamSettings):
805
812
rpcVideoStreamSettings .rotation_deg ,
806
813
807
814
808
- rpcVideoStreamSettings .uri
815
+ rpcVideoStreamSettings .uri ,
816
+
817
+
818
+ rpcVideoStreamSettings .horizontal_fov_deg
809
819
)
810
820
811
821
def translate_to_rpc (self , rpcVideoStreamSettings ):
@@ -848,6 +858,12 @@ def translate_to_rpc(self, rpcVideoStreamSettings):
848
858
849
859
850
860
861
+
862
+
863
+ rpcVideoStreamSettings .horizontal_fov_deg = self .horizontal_fov_deg
864
+
865
+
866
+
851
867
852
868
853
869
class VideoStreamInfo :
@@ -859,14 +875,17 @@ class VideoStreamInfo:
859
875
settings : VideoStreamSettings
860
876
Video stream settings
861
877
862
- status : Status
878
+ status : VideoStreamStatus
863
879
Current status of video streaming
864
880
881
+ spectrum : VideoStreamSpectrum
882
+ Light-spectrum of the video stream
883
+
865
884
"""
866
885
867
886
868
887
869
- class Status (Enum ):
888
+ class VideoStreamStatus (Enum ):
870
889
"""
871
890
Video stream status type.
872
891
@@ -885,18 +904,62 @@ class Status(Enum):
885
904
IN_PROGRESS = 1
886
905
887
906
def translate_to_rpc (self ):
888
- if self == VideoStreamInfo .Status .NOT_RUNNING :
889
- return camera_pb2 .VideoStreamInfo .STATUS_NOT_RUNNING
890
- if self == VideoStreamInfo .Status .IN_PROGRESS :
891
- return camera_pb2 .VideoStreamInfo .STATUS_IN_PROGRESS
907
+ if self == VideoStreamInfo .VideoStreamStatus .NOT_RUNNING :
908
+ return camera_pb2 .VideoStreamInfo .VIDEO_STREAM_STATUS_NOT_RUNNING
909
+ if self == VideoStreamInfo .VideoStreamStatus .IN_PROGRESS :
910
+ return camera_pb2 .VideoStreamInfo .VIDEO_STREAM_STATUS_IN_PROGRESS
911
+
912
+ @staticmethod
913
+ def translate_from_rpc (rpc_enum_value ):
914
+ """ Parses a gRPC response """
915
+ if rpc_enum_value == camera_pb2 .VideoStreamInfo .VIDEO_STREAM_STATUS_NOT_RUNNING :
916
+ return VideoStreamInfo .VideoStreamStatus .NOT_RUNNING
917
+ if rpc_enum_value == camera_pb2 .VideoStreamInfo .VIDEO_STREAM_STATUS_IN_PROGRESS :
918
+ return VideoStreamInfo .VideoStreamStatus .IN_PROGRESS
919
+
920
+ def __str__ (self ):
921
+ return self .name
922
+
923
+
924
+ class VideoStreamSpectrum (Enum ):
925
+ """
926
+ Video stream light spectrum type
927
+
928
+ Values
929
+ ------
930
+ UNKNOWN
931
+ Unknown
932
+
933
+ VISIBLE_LIGHT
934
+ Visible light
935
+
936
+ INFRARED
937
+ Infrared
938
+
939
+ """
940
+
941
+
942
+ UNKNOWN = 0
943
+ VISIBLE_LIGHT = 1
944
+ INFRARED = 2
945
+
946
+ def translate_to_rpc (self ):
947
+ if self == VideoStreamInfo .VideoStreamSpectrum .UNKNOWN :
948
+ return camera_pb2 .VideoStreamInfo .VIDEO_STREAM_SPECTRUM_UNKNOWN
949
+ if self == VideoStreamInfo .VideoStreamSpectrum .VISIBLE_LIGHT :
950
+ return camera_pb2 .VideoStreamInfo .VIDEO_STREAM_SPECTRUM_VISIBLE_LIGHT
951
+ if self == VideoStreamInfo .VideoStreamSpectrum .INFRARED :
952
+ return camera_pb2 .VideoStreamInfo .VIDEO_STREAM_SPECTRUM_INFRARED
892
953
893
954
@staticmethod
894
955
def translate_from_rpc (rpc_enum_value ):
895
956
""" Parses a gRPC response """
896
- if rpc_enum_value == camera_pb2 .VideoStreamInfo .STATUS_NOT_RUNNING :
897
- return VideoStreamInfo .Status .NOT_RUNNING
898
- if rpc_enum_value == camera_pb2 .VideoStreamInfo .STATUS_IN_PROGRESS :
899
- return VideoStreamInfo .Status .IN_PROGRESS
957
+ if rpc_enum_value == camera_pb2 .VideoStreamInfo .VIDEO_STREAM_SPECTRUM_UNKNOWN :
958
+ return VideoStreamInfo .VideoStreamSpectrum .UNKNOWN
959
+ if rpc_enum_value == camera_pb2 .VideoStreamInfo .VIDEO_STREAM_SPECTRUM_VISIBLE_LIGHT :
960
+ return VideoStreamInfo .VideoStreamSpectrum .VISIBLE_LIGHT
961
+ if rpc_enum_value == camera_pb2 .VideoStreamInfo .VIDEO_STREAM_SPECTRUM_INFRARED :
962
+ return VideoStreamInfo .VideoStreamSpectrum .INFRARED
900
963
901
964
def __str__ (self ):
902
965
return self .name
@@ -905,10 +968,12 @@ def __str__(self):
905
968
def __init__ (
906
969
self ,
907
970
settings ,
908
- status ):
971
+ status ,
972
+ spectrum ):
909
973
""" Initializes the VideoStreamInfo object """
910
974
self .settings = settings
911
975
self .status = status
976
+ self .spectrum = spectrum
912
977
913
978
def __equals__ (self , to_compare ):
914
979
""" Checks if two VideoStreamInfo are the same """
@@ -917,7 +982,8 @@ def __equals__(self, to_compare):
917
982
# VideoStreamInfo object
918
983
return \
919
984
(self .settings == to_compare .settings ) and \
920
- (self .status == to_compare .status )
985
+ (self .status == to_compare .status ) and \
986
+ (self .spectrum == to_compare .spectrum )
921
987
922
988
except AttributeError :
923
989
return False
@@ -926,7 +992,8 @@ def __str__(self):
926
992
""" VideoStreamInfo in string representation """
927
993
struct_repr = ", " .join ([
928
994
"settings: " + str (self .settings ),
929
- "status: " + str (self .status )
995
+ "status: " + str (self .status ),
996
+ "spectrum: " + str (self .spectrum )
930
997
])
931
998
932
999
return f"VideoStreamInfo: [{ struct_repr } ]"
@@ -939,7 +1006,10 @@ def translate_from_rpc(rpcVideoStreamInfo):
939
1006
VideoStreamSettings .translate_from_rpc (rpcVideoStreamInfo .settings ),
940
1007
941
1008
942
- VideoStreamInfo .Status .translate_from_rpc (rpcVideoStreamInfo .status )
1009
+ VideoStreamInfo .VideoStreamStatus .translate_from_rpc (rpcVideoStreamInfo .status ),
1010
+
1011
+
1012
+ VideoStreamInfo .VideoStreamSpectrum .translate_from_rpc (rpcVideoStreamInfo .spectrum )
943
1013
)
944
1014
945
1015
def translate_to_rpc (self , rpcVideoStreamInfo ):
@@ -958,6 +1028,12 @@ def translate_to_rpc(self, rpcVideoStreamInfo):
958
1028
959
1029
960
1030
1031
+
1032
+
1033
+ rpcVideoStreamInfo .spectrum = self .spectrum .translate_to_rpc ()
1034
+
1035
+
1036
+
961
1037
962
1038
963
1039
class Status :
@@ -1009,12 +1085,16 @@ class StorageStatus(Enum):
1009
1085
FORMATTED
1010
1086
Storage is formatted (i.e. has recognized a file system)
1011
1087
1088
+ NOT_SUPPORTED
1089
+ Storage status is not supported
1090
+
1012
1091
"""
1013
1092
1014
1093
1015
1094
NOT_AVAILABLE = 0
1016
1095
UNFORMATTED = 1
1017
1096
FORMATTED = 2
1097
+ NOT_SUPPORTED = 3
1018
1098
1019
1099
def translate_to_rpc (self ):
1020
1100
if self == Status .StorageStatus .NOT_AVAILABLE :
@@ -1023,6 +1103,8 @@ def translate_to_rpc(self):
1023
1103
return camera_pb2 .Status .STORAGE_STATUS_UNFORMATTED
1024
1104
if self == Status .StorageStatus .FORMATTED :
1025
1105
return camera_pb2 .Status .STORAGE_STATUS_FORMATTED
1106
+ if self == Status .StorageStatus .NOT_SUPPORTED :
1107
+ return camera_pb2 .Status .STORAGE_STATUS_NOT_SUPPORTED
1026
1108
1027
1109
@staticmethod
1028
1110
def translate_from_rpc (rpc_enum_value ):
@@ -1033,6 +1115,8 @@ def translate_from_rpc(rpc_enum_value):
1033
1115
return Status .StorageStatus .UNFORMATTED
1034
1116
if rpc_enum_value == camera_pb2 .Status .STORAGE_STATUS_FORMATTED :
1035
1117
return Status .StorageStatus .FORMATTED
1118
+ if rpc_enum_value == camera_pb2 .Status .STORAGE_STATUS_NOT_SUPPORTED :
1119
+ return Status .StorageStatus .NOT_SUPPORTED
1036
1120
1037
1121
def __str__ (self ):
1038
1122
return self .name
0 commit comments