pycomm3/clx.py
def _parse_instance_attribute_list(self, response, tag_list):
        """ extract the tags list from the message received"""

        tags_returned = response.data
        tags_returned_length = len(tags_returned)
        idx = count = instance = 0
        try:
            while idx < tags_returned_length:
                instance = Unpack.dint(tags_returned[idx:idx + 4])
                idx += 4
                tag_length = Unpack.uint(tags_returned[idx:idx + 2])
                idx += 2
                tag_name = tags_returned[idx:idx + tag_length]
                idx += tag_length
                symbol_type = Unpack.uint(tags_returned[idx:idx + 2])
                idx += 2
                count += 1
                symbol_address = Unpack.udint(tags_returned[idx:idx + 4])
                idx += 4
                symbol_object_address = Unpack.udint(tags_returned[idx:idx + 4])
                idx += 4
                software_control = Unpack.udint(tags_returned[idx:idx + 4])
                idx += 4

                dim1 = Unpack.udint(tags_returned[idx:idx + 4])
                idx += 4
                dim2 = Unpack.udint(tags_returned[idx:idx + 4])
                idx += 4
                dim3 = Unpack.udint(tags_returned[idx:idx + 4])
                idx += 4

                if self.info.get('version_major', 0) >= MIN_VER_EXTERNAL_ACCESS:
                    access = tags_returned[idx] & 0b_0011
                    idx += 1
                else:
                    access = None

                tag_list.append({'instance_id': instance,
                                 'tag_name': tag_name,
                                 'symbol_type': symbol_type,
                                 'symbol_address': symbol_address,
                                 'symbol_object_address': symbol_object_address,
                                 'software_control': software_control,
                                 'external_access': EXTERNAL_ACCESS.get(access, 'Unknown'),
                                 'dimensions': [dim1, dim2, dim3]})

        except Exception as e:
            raise DataError(e)

        if response.service_status == SUCCESS:
            last_instance = -1
        elif response.service_status == INSUFFICIENT_PACKETS:
            last_instance = instance + 1
        else:
            self.__log.warning('unknown status during _parse_instance_attribute_list')
            last_instance = -1

        return last_instance
 extract the tags list from the message received
extract the tags list from the message received
extract the tags list from the message received
def _parse_instance_attribute_list(self, response, tag_list):
        tags_returned = response.data
        tags_returned_length = len(tags_returned)
        idx = count = instance = 0
        try:
            while idx < tags_returned_length:
                instance = Unpack.dint(tags_returned[idx:idx + 4])
                idx += 4
                tag_length = Unpack.uint(tags_returned[idx:idx + 2])
                idx += 2
                tag_name = tags_returned[idx:idx + tag_length]
                idx += tag_length
                symbol_type = Unpack.uint(tags_returned[idx:idx + 2])
                idx += 2
                count += 1
                symbol_address = Unpack.udint(tags_returned[idx:idx + 4])
                idx += 4
                symbol_object_address = Unpack.udint(tags_returned[idx:idx + 4])
                idx += 4
                software_control = Unpack.udint(tags_returned[idx:idx + 4])
                idx += 4
                dim1 = Unpack.udint(tags_returned[idx:idx + 4])
                idx += 4
                dim2 = Unpack.udint(tags_returned[idx:idx + 4])
                idx += 4
                dim3 = Unpack.udint(tags_returned[idx:idx + 4])
                idx += 4
                if self.info.get('version_major', 0) >= MIN_VER_EXTERNAL_ACCESS:
                    access = tags_returned[idx] & 0b_0011
                    idx += 1
                else:
                    access = None
                tag_list.append({'instance_id': instance,
                                 'tag_name': tag_name,
                                 'symbol_type': symbol_type,
                                 'symbol_address': symbol_address,
                                 'symbol_object_address': symbol_object_address,
                                 'software_control': software_control,
                                 'external_access': EXTERNAL_ACCESS.get(access, 'Unknown'),
                                 'dimensions': [dim1, dim2, dim3]})
        except Exception as e:
            raise DataError(e)
        if response.service_status == SUCCESS:
            last_instance = -1
        elif response.service_status == INSUFFICIENT_PACKETS:
            last_instance = instance + 1
        else:
            self.__log.warning('unknown status during _parse_instance_attribute_list')
            last_instance = -1
        return last_instance
def _parse_instance_attribute_list ( self , response , tag_list ) : tags_returned = response . data tags_returned_length = len ( tags_returned ) idx = count = instance = 0 try : while idx < tags_returned_length : instance = Unpack . dint ( tags_returned [ idx : idx + 4 ] ) idx += 4 tag_length = Unpack . uint ( tags_returned [ idx : idx + 2 ] ) idx += 2 tag_name = tags_returned [ idx : idx + tag_length ] idx += tag_length symbol_type = Unpack . uint ( tags_returned [ idx : idx + 2 ] ) idx += 2 count += 1 symbol_address = Unpack . udint ( tags_returned [ idx : idx + 4 ] ) idx += 4 symbol_object_address = Unpack . udint ( tags_returned [ idx : idx + 4 ] ) idx += 4 software_control = Unpack . udint ( tags_returned [ idx : idx + 4 ] ) idx += 4 dim1 = Unpack . udint ( tags_returned [ idx : idx + 4 ] ) idx += 4 dim2 = Unpack . udint ( tags_returned [ idx : idx + 4 ] ) idx += 4 dim3 = Unpack . udint ( tags_returned [ idx : idx + 4 ] ) idx += 4 if self . info . get ( 'version_major' , 0 ) >= MIN_VER_EXTERNAL_ACCESS : access = tags_returned [ idx ] & 0b_0011 idx += 1 else : access = None tag_list . append ( { 'instance_id' : instance , 'tag_name' : tag_name , 'symbol_type' : symbol_type , 'symbol_address' : symbol_address , 'symbol_object_address' : symbol_object_address , 'software_control' : software_control , 'external_access' : EXTERNAL_ACCESS . get ( access , 'Unknown' ) , 'dimensions' : [ dim1 , dim2 , dim3 ] } ) except Exception as e : raise DataError ( e ) if response . service_status == SUCCESS : last_instance = - 1 elif response . service_status == INSUFFICIENT_PACKETS : last_instance = instance + 1 else : self . __log . warning ( 'unknown status during _parse_instance_attribute_list' ) last_instance = - 1 return last_instance
extract the tags list from the message received
extract the tags list from the message received
""" extract the tags list from the message received"""
self
response
tag_list