bool CTouchTranslator::TranslateAction(int window, unsigned int touchCommand, int touchPointers, unsigned int &actionId, std::string &actionString) { unsigned int touchActionKey = GetTouchActionKey(touchCommand, touchPointers); actionId = GetActionID(window, touchActionKey, actionString); return actionId != ACTION_NONE; }
/*-------------------------------------------------------------------------------------------------- Name : AvcReadMessage Description : Read incoming messages on the AVC LAN bus. Argument(s) : None. Return value : (AvcActionID) -> Action ID associated with this message. --------------------------------------------------------------------------------------------------*/ AvcActionID AvcReadMessage ( void ) { ReadBits( 1 ); // Start bit. LedOn(); Broadcast = ReadBits( 1 ); MasterAddress = ReadBits( 12 ); bool p = ParityBit; if ( p != ReadBits( 1 ) ) { UsartPutCStr( PSTR("AvcReadMessage: Parity error @ MasterAddress!\r\n") ); return (AvcActionID)FALSE; } SlaveAddress = ReadBits( 12 ); p = ParityBit; if ( p != ReadBits( 1 ) ) { UsartPutCStr( PSTR("AvcReadMessage: Parity error @ SlaveAddress!\r\n") ); return (AvcActionID)FALSE; } bool forMe = ( SlaveAddress == MY_ADDRESS ); // In point-to-point communication, sender issues an ack bit with value '1' (20us). Receiver // upon acking will extend the bit until it looks like a '0' (32us) on the bus. In broadcast // mode, receiver disregards the bit. if ( forMe ) { // Send ACK. Send1BitWord( 0 ); } else { ReadBits( 1 ); } Control = ReadBits( 4 ); p = ParityBit; if ( p != ReadBits( 1 ) ) { UsartPutCStr( PSTR("AvcReadMessage: Parity error @ Control!\r\n") ); return (AvcActionID)FALSE; } if ( forMe ) { // Send ACK. Send1BitWord( 0 ); } else { ReadBits( 1 ); } DataSize = ReadBits( 8 ); p = ParityBit; if ( p != ReadBits( 1 ) ) { UsartPutCStr( PSTR("AvcReadMessage: Parity error @ DataSize!\r\n") ); return (AvcActionID)FALSE; } if ( forMe ) { // Send ACK. Send1BitWord( 0 ); } else { ReadBits( 1 ); } byte i; for ( i = 0; i < DataSize; i++ ) { Data[i] = ReadBits( 8 ); p = ParityBit; if ( p != ReadBits( 1 ) ) { sprintf( UsartMsgBuffer, "AvcReadMessage: Parity error @ Data[%d]\r\n", i ); UsartPutStr( UsartMsgBuffer ); return (AvcActionID)FALSE; } if ( forMe ) { // Send ACK. Send1BitWord( 0 ); } else { ReadBits( 1 ); } } // Dump message on terminal. if ( forMe ) UsartPutCStr( PSTR("AvcReadMessage: This message is for me!\r\n") ); AvcActionID actionID = GetActionID(); // switch ( actionID ) { // case /* value */: // } DumpRawMessage( FALSE ); LedOff(); return actionID; }