TracLight_c::SendMessage_e TracLight_c::helpSendMessage( CanPkgExt_c& pkg ) { // there is no need to check for address claim in tractor mode because this is already done in the timeEvent // function of base class BaseCommon_c pkg.setMonitorItemForSA( getIdentItem()->getIsoItem() ); pkg.setLen(8); uint16_t ui16_temp = 0; ui16_temp = (mt_cmd.daytimeRunning << 0) + (mt_cmd.alternateHead << 2) + (mt_cmd.lowBeamHead << 4) + (mt_cmd.highBeamHead << 6) + (mt_cmd.frontFog << 8) + (mt_cmd.beacon << 10) + (mt_cmd.rightTurn << 12) + (mt_cmd.leftTurn << 14); pkg.setUint16Data(0, ui16_temp); ui16_temp = 0; ui16_temp = (mt_cmd.backUpLightAlarmHorn << 0) + (mt_cmd.centerStop << 2) + (mt_cmd.rightStop << 4) + (mt_cmd.leftStop << 6) + (mt_cmd.implClearance << 8) + (mt_cmd.tracClearance << 10) + (mt_cmd.implMarker << 12) + (mt_cmd.tracMarker << 14); pkg.setUint16Data(2, ui16_temp); ui16_temp = 0; ui16_temp = (mt_cmd.rearFog << 0) + (mt_cmd.undersideWork << 2) + (mt_cmd.rearLowWork << 4) + (mt_cmd.rearHighWork << 6) + (mt_cmd.sideLowWork << 8) + (mt_cmd.sideHighWork << 10) + (mt_cmd.frontLowWork << 12) + (mt_cmd.frontHighWork << 14); pkg.setUint16Data(4, ui16_temp); // CanIo_c::operator<< retreives the information with the help of CanPkg_c::getData // then it sends the data getIsoBusInstance4Comm() << pkg; return MessageSent; }
/** send a PGN request */ bool BaseCommon_c::sendPgnRequest(uint32_t ui32_requestedPGN) { if( ( ! getIdentItem() ) || ( ! getIdentItem()->isClaimedAddress() ) ) return false; IsoItem_c *dest = getSelectedDataSourceISONameConst().isSpecified() ? getIsoMonitorInstance( getIdentItem()->getMultitonInst() ).item( getSelectedDataSourceISONameConst(), true ) : NULL; // --> ask to global CanPkgExt_c pkg; pkg.setIsoPri(6); pkg.setIsoPgn(REQUEST_PGN_MSG_PGN); pkg.setMonitorItemForSA( getIdentItem()->getIsoItem() ); pkg.setMonitorItemForDA( dest ); pkg.setLen( 3 ); pkg.setUint32Data( 0 , ui32_requestedPGN ); getIsoBusInstance( getIdentItem()->getMultitonInst() ) << pkg; return true; }
/** send facilities data @see TracFacilities_c::processMsgRequestPGN @see CanIo_c::operator<< */ void TracFacilities_c::sendFacilities( ) {// there is no need to check for address claim because this is already done in the processMsgRequestPGN; // this function is only be called on request!! isoaglib_assert( getIdentItem() ); IsoBus_c& c_can = getIsoBusInstance4Comm(); CanPkgExt_c pkg; pkg.setMonitorItemForSA( getIdentItem()->getIsoItem() ); setSelectedDataSourceISOName( getIdentItem()->isoName() ); pkg.setIsoPri(3); pkg.setLen(8); pkg.setIsoPgn(TRACTOR_FACILITIES_PGN); for (uint8_t ui8_counter = 0;ui8_counter<sizeof(arrui8_facilitiesBitData)/sizeof(uint8_t);++ui8_counter) pkg.setUint8Data(ui8_counter,arrui8_facilitiesBitData[ui8_counter]); // CanIo_c::operator<< retreives the information with the help of CanPkg_c::getData // then it sends the data c_can << pkg; }