// Open an ant channel assignment. void ANTChannel::open(int device, int chan_type) { channel_type=chan_type; channel_type_flags = CHANNEL_TYPE_QUICK_SEARCH ; device_number=device; setId(); #if 0 if (channel_assigned) { parent->sendMessage(ANTMessage::unassignChannel(number)); } else { #endif attemptTransition(ANT_UNASSIGN_CHANNEL); //} } // close an ant channel assignment void ANTChannel::close() { emit lostInfo(number); lastMessage = ANTMessage(); parent->sendMessage(ANTMessage::close(number)); init(); }
// process a channel event message // would be good to refactor to use ANTMessage at some point // but not compelling reason to do so at this point and might // break existing code. void ANTChannel::channelEvent(unsigned char *ant_message) { unsigned char *message=ant_message+2; //qDebug()<<"channel event:"<< ANTMessage::channelEventMessage(*(message+1)); if (MESSAGE_IS_RESPONSE_NO_ERROR(message)) { attemptTransition(RESPONSE_NO_ERROR_MESSAGE_ID(message)); } else if (MESSAGE_IS_EVENT_CHANNEL_CLOSED(message)) { parent->sendMessage(ANTMessage::unassignChannel(number)); } else if (MESSAGE_IS_EVENT_RX_SEARCH_TIMEOUT(message)) { // timeouts are normal for search channel if (channel_type_flags & CHANNEL_TYPE_QUICK_SEARCH) { channel_type_flags &= ~CHANNEL_TYPE_QUICK_SEARCH; channel_type_flags |= CHANNEL_TYPE_WAITING; emit searchTimeout(number); } else { emit lostInfo(number); // Don't wipe out the channel settings when the search times out, // else can not reconnect to the device once back in range.. //channel_type=CHANNEL_TYPE_UNUSED; //channel_type_flags=0; //device_number=0; //value2=value=0; //setId(); parent->sendMessage(ANTMessage::unassignChannel(number)); } } else if (MESSAGE_IS_EVENT_RX_FAIL(message)) { messages_dropped++; double t=get_timestamp(); if (t > (last_message_timestamp + timeout_drop)) { if (channel_type != CHANNEL_TYPE_UNUSED) emit dropInfo(number, messages_dropped, messages_received); // this is a hacky way to prevent the drop message from sending multiple times last_message_timestamp+=2*timeout_drop; } } else if (MESSAGE_IS_EVENT_RX_ACKNOWLEDGED(message)) { exit(-10); } else if (MESSAGE_IS_EVENT_TRANSFER_TX_COMPLETED(message)) { // do nothing } }
// Open an ant channel assignment. void ANTChannel::open(int device, int chan_type) { channel_type=chan_type; channel_type_flags = CHANNEL_TYPE_QUICK_SEARCH ; device_number=device; setId(); attemptTransition(ANT_UNASSIGN_CHANNEL); }
BOOL LLPanelGroup::canClose() { if (mShowingNotifyDialog) return FALSE; if (mCurrentTab && mCurrentTab->hasModal()) return FALSE; if (mForceClose || !mAllowEdit) return TRUE; // Try to switch from the current panel to nothing, indicating a close action. mRequestedTab = NULL; return attemptTransition(); }
void LLPanelGroup::handleClickTab() { // If we are already handling a transition, // ignore this. if (mIgnoreTransition) { return; } mRequestedTab = (LLPanelGroupTab*) mTabContainer->getCurrentPanel(); // Make sure they aren't just clicking the same tab... if (mRequestedTab == mCurrentTab) { return; } // Try to switch from the current panel to the panel the user selected. attemptTransition(); }
// process a channel event message // XXX should re-use ANTMessage rather than // raw message data void ANTChannel::channelEvent(unsigned char *ant_message) { unsigned char *message=ant_message+2; //qDebug()<<"channel event:"<< ANTMessage::channelEventMessage(*(message+1)); if (MESSAGE_IS_RESPONSE_NO_ERROR(message)) { attemptTransition(RESPONSE_NO_ERROR_MESSAGE_ID(message)); } else if (MESSAGE_IS_EVENT_CHANNEL_CLOSED(message)) { parent->sendMessage(ANTMessage::unassignChannel(number)); } else if (MESSAGE_IS_EVENT_RX_SEARCH_TIMEOUT(message)) { // timeouts are normal for search channel if (channel_type_flags & CHANNEL_TYPE_QUICK_SEARCH) { channel_type_flags &= ~CHANNEL_TYPE_QUICK_SEARCH; channel_type_flags |= CHANNEL_TYPE_WAITING; emit searchTimeout(number); } else { emit lostInfo(number); channel_type=CHANNEL_TYPE_UNUSED; channel_type_flags=0; device_number=0; value2=value=0; setId(); parent->sendMessage(ANTMessage::unassignChannel(number)); } //XXX channel_manager_start_waiting_search(self->parent); } else if (MESSAGE_IS_EVENT_RX_FAIL(message)) { messages_dropped++; double t=get_timestamp(); if (t > (last_message_timestamp + timeout_drop)) { if (channel_type != CHANNEL_TYPE_UNUSED) emit dropInfo(number, messages_dropped, messages_received); // this is a hacky way to prevent the drop message from sending multiple times last_message_timestamp+=2*timeout_drop; } } else if (MESSAGE_IS_EVENT_RX_ACKNOWLEDGED(message)) { exit(-10); } else if (MESSAGE_IS_EVENT_TRANSFER_TX_COMPLETED(message)) { if (tx_ack_disposition) {} //XXX tx_ack_disposition(); } else { // XXX not handled! } }