def send_burst_transfer(self, channel, data): _logger.debug("send burst transfer %s", channel) Ant.send_burst_transfer(self, channel, data) self.wait_for_event(Message.Code.EVENT_TRANSFER_TX_START) x = self.wait_for_event(Message.Code.EVENT_TRANSFER_TX_COMPLETED) _logger.debug("done sending burst transfer %s", channel) return x
def __init__(self, idVendor, idProduct): Ant.__init__(self, idVendor, idProduct) self._responses_cond = threading.Condition() self._responses = collections.deque() self._event_cond = threading.Condition() self._events = collections.deque() self.start()
def send_acknowledged_data(self, channel, data): try: _logger.debug("send acknowledged data %s", channel) Ant.send_acknowledged_data(self, channel, data) self.wait_for_event([Message.Code.EVENT_TRANSFER_TX_COMPLETED]) _logger.debug("done sending acknowledged data %s", channel) except TransferFailedException: _logger.warning("failed to send acknowledged data %s, retrying", channel) self.send_acknowledged_data(channel, data)
def send_burst_transfer(self, channel, data): try: self._last_call = (self.send_burst_transfer, [channel, data]) _logger.debug("send burst transfer %s", channel) Ant.send_burst_transfer(self, channel, data) self.wait_for_event([Message.Code.EVENT_TRANSFER_TX_START]) self.wait_for_event([Message.Code.EVENT_TRANSFER_TX_COMPLETED]) _logger.debug("done sending burst transfer %s", channel) except TransferFailedException: _logger.warning("failed to send burst transfer %s, retrying", channel) self.send_burst_transfer(channel, data)
def set_network_key(self, network, key): Ant.set_network_key(self, network, key) return self.wait_for_response(Message.ID.SET_NETWORK_KEY)
def set_channel_search_timeout(self, channel, timeout): Ant.set_channel_search_timeout(self, channel, timeout) return self.wait_for_response(Message.ID.SET_CHANNEL_SEARCH_TIMEOUT)
def set_channel_id(self, channel, deviceNum, deviceType, transmissionType): Ant.set_channel_id(self, channel, deviceNum, deviceType, transmissionType) return self.wait_for_response(Message.ID.SET_CHANNEL_ID)
def send_burst_transfer_packet(self, channelSeq, data, first): _logger.debug("send burst transfer packet %s", data) Ant.send_burst_transfer_packet(self, channelSeq, data, first)
def reset_system(self): Ant.reset_system(self) return self.wait_for_response(Message.ID.STARTUP_MESSAGE)
def request_message(self, channel, messageId): _logger.debug("requesting message %#02x", messageId) Ant.request_message(self, channel, messageId) _logger.debug("done requesting message %#02x", messageId) return self.wait_for_response(messageId)
def set_search_waveform(self, channel, waveform): Ant.set_search_waveform(self, channel, waveform) return self.wait_for_response(Message.ID.SET_SEARCH_WAVEFORM)
def request_message(self, channel, messageId): _logger.debug("requesting message %#02x", messageId) Ant.request_message(self, channel, messageId) _logger.debug("done requesting message %#02x", messageId) return self.wait_for_special(messageId)
def send_acknowledged_data(self, channel, broadcastData): _logger.debug("send acknowledged data %s", channel) Ant.send_acknowledged_data(self, channel, broadcastData) x = self.wait_for_event(Message.Code.EVENT_TRANSFER_TX_COMPLETED) _logger.debug("done sending acknowledged data %s", channel) return x
def assign_channel(self, channel, channelType, networkNumber): Ant.assign_channel(self, channel, channelType, networkNumber) return self.wait_for_response(Message.ID.ASSIGN_CHANNEL)
def assign_channel(self, channel, channelType, networkNumber): Ant.assign_channel(self, channel, channelType, networkNumber) return self.wait_for_response(Message.ID.RESPONSE_CHANNEL)
def set_channel_rf_freq(self, channel, rfFreq): Ant.set_channel_rf_freq(self, channel, rfFreq) return self.wait_for_response(Message.ID.SET_CHANNEL_RF_FREQ)
def reset_system(self): Ant.reset_system(self) return self.wait_for_special(Message.ID.STARTUP_MESSAGE)
def open_channel(self, channel): Ant.open_channel(self, channel) return self.wait_for_response(Message.ID.RESPONSE_CHANNEL)
def open_channel(self, channel): Ant.open_channel(self, channel) return self.wait_for_response(Message.ID.OPEN_CHANNEL)
def set_channel_id(self, channel, deviceNum, deviceType, transmissionType): Ant.set_channel_id(self, channel, deviceNum, deviceType, transmissionType) return self.wait_for_response(Message.ID.RESPONSE_CHANNEL)
def set_channel_period(self, channel, messagePeriod): Ant.set_channel_period(self, channel, messagePeriod) return self.wait_for_response(Message.ID.SET_CHANNEL_PERIOD)
def set_channel_period(self, channel, messagePeriod): Ant.set_channel_period(self, channel, messagePeriod) return self.wait_for_response(Message.ID.RESPONSE_CHANNEL)
def set_channel_search_timeout(self, channel, timeout): Ant.set_channel_search_timeout(self, channel, timeout) return self.wait_for_response(Message.ID.RESPONSE_CHANNEL)
def set_channel_rf_freq(self, channel, rfFreq): Ant.set_channel_rf_freq(self, channel, rfFreq) return self.wait_for_response(Message.ID.RESPONSE_CHANNEL)
def set_network_key(self, network, key): Ant.set_network_key(self, network, key) return self.wait_for_response(Message.ID.RESPONSE_CHANNEL)
def set_search_waveform(self, channel, waveform): Ant.set_search_waveform(self, channel, waveform) return self.wait_for_response(Message.ID.RESPONSE_CHANNEL)