def set_table_data(self, tableid, data, offset=None): """ Write data to a table. :param int tableid: The table number to write to (0x0000 <= tableid <= 0xffff) :param str data: The data to write into the table. :param int offset: The offset at which to start to write the data (0x000000 <= octetcount <= 0xffffff). """ self.send(C1218WriteRequest(tableid, data, offset)) data = self.recv() if data[0] != 0x00: status = data[0] details = (C1218_RESPONSE_CODES.get(status) or 'unknown response code') self.logger.error('could not write data to the table, error: ' + details) raise C1218WriteTableError('could not write data to the table, error: ' + details, status) return
def set_table_data(self, tableid, data, offset = None): """ Write data to a table. @type tableid: Integer (0x0000 <= tableid <= 0xffff) @param tableid: The table number to write to @type data: String @param data: The data to write into the table. @type offset: Integer (0x000000 <= octetcount <= 0xffffff) @param offset: The offset at which to start to write the data. """ self.send(C1218WriteRequest(tableid, data, offset)) data = self.recv() if data[0] != '\x00': status = ord(data[0]) details = (C1218_RESPONSE_CODES.get(status) or 'unknown response code') self.logger.error('could not write data to the table, error: ' + details) raise C1218WriteTableError('could not write data to the table, error: ' + details, status) return None