Пример #1
0
void
IsoMonitor_c::close()
{
  isoaglib_assert (initialized());

  isoaglib_assert( m_arrClientC1.empty() );
  isoaglib_assert( mvec_saClaimHandler.empty() );

  getSchedulerInstance().deregisterTask( *this );

  // We can clear the list of remote nodes.
  /// NOTE: We do currently NOT call "internalIsoItemErase",
  ///       because the list of SaClaimHandlers is empty anyway.
  ///       But if the erase does some more stuff, it may be needed
  ///       to call "internalIsoItemErase" for each item instead
  ///       of just clearing the container of isoMembers.
  mvec_isoMember.clear();

  getIsoRequestPgnInstance4Comm().unregisterPGN (mt_handler, ADDRESS_CLAIM_PGN);
#ifdef USE_WORKING_SET
  getIsoRequestPgnInstance4Comm().unregisterPGN (mt_handler, WORKING_SET_MASTER_PGN);
  getIsoRequestPgnInstance4Comm().unregisterPGN (mt_handler, WORKING_SET_MEMBER_PGN);
#endif

  getIsoBusInstance4Comm().deleteFilter( mt_customer, IsoAgLib::iMaskFilter_c( 0x3FFFF00UL, ((ADDRESS_CLAIM_PGN+0xFF) << 8) ) );
#ifdef USE_WORKING_SET
  getIsoBusInstance4Comm().deleteFilter( mt_customer, IsoAgLib::iMaskFilter_c( 0x3FFFF00UL, ((WORKING_SET_MASTER_PGN) << 8) ) );
  getIsoBusInstance4Comm().deleteFilter( mt_customer, IsoAgLib::iMaskFilter_c( 0x3FFFF00UL, ((WORKING_SET_MEMBER_PGN) << 8) ) );
#endif

  setClosed();
}
Пример #2
0
bool
IsoMonitor_c::sendRequestForClaimedAddress( bool ab_force, IsoItem_c *sender )
{ // trigger an initial request for claimed address
  // ( only if no request was detected )
  if ( ( lastIsoSaRequest() != -1 ) && ( ! ab_force ) )
  { // at least one request was already detected
    return false;
  }
  CanPkgExt_c c_data;

  c_data.setIsoPri(6);
  c_data.setIsoPgn(REQUEST_PGN_MSG_PGN);
  c_data.setIsoPs(255); // global request
  if ( sender )
    c_data.setMonitorItemForSA( sender );
  else
    c_data.setIsoSa( 0xFE );
  c_data.setLen(3);
  c_data.setUint32Data( 0, ADDRESS_CLAIM_PGN );
  getIsoBusInstance4Comm() << c_data;

  setLastIsoSaRequest( HAL::getTime() );

  // let local items answer, too!
  for( const_iterC1_t iter = m_arrClientC1.begin(); 
       iter != m_arrClientC1.end();
       ++iter )
  {
    IsoItem_c *localItem = (*iter)->getIsoItem();
    if( localItem )
      localItem->sendSaClaim();
  }
  return true;
}
Пример #3
0
  /** check if filter boxes shall be created - create only ISO filters based
      on active local idents which has already claimed an address
      --> avoid to much Filter Boxes
    */
  void TracFacilities_c::checkCreateReceiveFilter( )
  {
    if( !checkFilterCreated() )
    {
      setFilterCreated();

      IsoBus_c &c_can = getIsoBusInstance4Comm();
      c_can.insertFilter( *this, IsoAgLib::iMaskFilter_c( 0x3FFFF00UL, (TRACTOR_FACILITIES_PGN<<8) ), 8 );
    }
  }
Пример #4
0
  /** check if filter boxes shall be created - create only ISO filters based
      on active local idents which has already claimed an address
      --> avoid to much Filter Boxes
    */
  void TracLight_c::checkCreateReceiveFilter()
  {
    if( !checkFilterCreated() )
    {
      setFilterCreated();

      IsoBus_c &c_can = getIsoBusInstance4Comm();
      c_can.insertFilter(*this, IsoAgLib::iMaskFilter_c( 0x3FFFFLU << 8, LIGHTING_DATA_PGN << 8), 8 );
      c_can.insertFilter(*this,IsoAgLib::iMaskFilter_c( 0x3FFFFLU << 8, LIGHTING_COMMAND_PGN << 8), 8 );
    }
  }
Пример #5
0
  void TracPTO_c::checkCreateReceiveFilter( )
  {
    if ( !checkFilterCreated() )
    {
      setFilterCreated();

      IsoBus_c &c_can = getIsoBusInstance4Comm();
      c_can.insertFilter( *this, IsoAgLib::iMaskFilter_c( 0x3FFFF00UL, (FRONT_PTO_STATE_PGN<<8) ), 8 );
      c_can.insertFilter( *this, IsoAgLib::iMaskFilter_c( 0x3FFFF00UL, (REAR_PTO_STATE_PGN<<8) ), 8 );

    }
  }
Пример #6
0
IsoMonitor_c::IsoMonitor_c() :
  SchedulerTask_c( 125, true ),
  mvec_isoMember(),
  mt_handler(*this),
  mt_customer(*this),
  CONTAINER_CLIENT1_CTOR_INITIALIZER_LIST
{
}


void
IsoMonitor_c::init()
{
  isoaglib_assert (!initialized());
  isoaglib_assert (mvec_isoMember.empty());

  mi32_lastSaRequest = -1; // not yet requested. Do NOT use 0, as the first "setLastRequest()" could (and does randomly) occur at time0 as it's called at init() time.
  mc_tempIsoMemberItem.set( 0, IsoName_c::IsoNameUnspecified(), 0xFE, IState_c::Active, getMultitonInst() );

  setPeriod( 125, false );
  getSchedulerInstance().registerTask( *this, 0 );

  CNAMESPACE::memset( &m_isoItems, 0x0, sizeof( m_isoItems ) );

  // add filter REQUEST_PGN_MSG_PGN via IsoRequestPgn_c
  getIsoRequestPgnInstance4Comm().registerPGN (mt_handler, ADDRESS_CLAIM_PGN);
#ifdef USE_WORKING_SET
  getIsoRequestPgnInstance4Comm().registerPGN (mt_handler, WORKING_SET_MASTER_PGN);
  getIsoRequestPgnInstance4Comm().registerPGN (mt_handler, WORKING_SET_MEMBER_PGN);
#endif

  getIsoBusInstance4Comm().insertFilter( mt_customer, IsoAgLib::iMaskFilter_c( 0x3FFFF00UL, ((ADDRESS_CLAIM_PGN)+0xFF)<<8 ), 8 );
#ifdef USE_WORKING_SET
  getIsoBusInstance4Comm().insertFilter( mt_customer, IsoAgLib::iMaskFilter_c( 0x3FFFF00UL, (WORKING_SET_MASTER_PGN<<8) ), 8 );
  getIsoBusInstance4Comm().insertFilter( mt_customer, IsoAgLib::iMaskFilter_c( 0x3FFFF00UL, (WORKING_SET_MEMBER_PGN<<8) ), 8 );
#endif

  setInitialized();
}
Пример #7
0
  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;
  }
Пример #8
0
  /** 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;
  }