Ez ki fogja törölni a(z) "get_data_from_frame_ext"
oldalt. Jól gondold meg.
def get_data_from_frame_ext(self, bytearray_of_frame, data_format):
The "get_data_from_frame_ext" method is used to decode data from the received byte-frame, what you get from the Xtender-System. If CRC-Check is active, it will check the byte-frame and raises a Value_Error, if a CRC-Error was detected. This method return a list with two elements. The first is a boolean value, which is true, if the xtender-system detects an error and the second element of the list then contains the error-id. If no error occures, then the first element is false und the second element contains the answer of your request. The returned value of the second element is a string, integer or float, depending of the service (read/write) of the request frame and of the format of the received Property_Data.
The "self" argument is pointing to the object, which calls the method.
The "bytearray_of_frame" argument is the frame what you get, when you receive data from the serial port.
The "data_format" described the format of the received Property_Data.
Format:
_format_bool = [1,1]
_format_format = [2,2]
_format_short_int = [3,2]
_format_enum = [4,2]
_format_short_enum = [5,2]
_format_long_enum = [6,4]
_format_error = [7,2]
_format_int32 = [8,4]
_format_float = [9,4]
_format_byte = [10,1]
Type -> list
list[0]: Type -> boolean
list[1]: Type -> depending of the service (read/write) of the request frame and of the format of the received Property_Data
>>> # create an object of the Xcom-API-Class
>>> Object = Xcom_API()
>>>
>>> # create a variable with a received frame
>>> Frame = bytearray(b'\\xAA\\x37\\x65\\x00\\x00\\x00\\x01\\x00\\x00\\x00\\x0E\\x00\\xAA\\x66\\x02\\x01\\x02\\x00\\x53\\x04\\x00\\x00\\x05\\x00\\x00\\xD0\\x14\\x42\\x86\\x8D')
>>>
>>> # call the Method 'get_data_from_frame_ext'
>>> Answer = Object.get_data_from_frame_ext(Frame, Xcom_API._format_float)
>>>
>>> # print Answer
>>> print(Answer)
(False, 37.203125)
Hochschule Anhalt | Anhalt University of Applied Sciences | Department 6 EMW
Xcom-API
Tobias Müller, M. Eng.
📧 Tobias.Mueller@HS-Anhalt.de
© es-lab.de, 31.10.2017
Ez ki fogja törölni a(z) "get_data_from_frame_ext"
oldalt. Jól gondold meg.