Changeset 42 in pacpussensors for trunk/Sick/SickLDMRSSensor.cpp


Ignore:
Timestamp:
04/01/14 14:47:39 (10 years ago)
Author:
cfougera
Message:

Last version

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Sick/SickLDMRSSensor.cpp

    r37 r42  
    4343static const int SICKLDMRS_OBJECTDATA_TYPE  = 0x2221;
    4444
    45 //////////////////////////////////////////////////////////////////////////
    46 /// Constructor.
     45
    4746SickLDMRSSensor::SickLDMRSSensor(QObject *parent)
    4847    : ipaddr_("192.168.0.1"),
     
    8382}
    8483
    85 //////////////////////////////////////////////////////////////////////////
    86 /// Destructor.
     84
    8785SickLDMRSSensor::~SickLDMRSSensor()
    8886{
     
    9189}
    9290
    93 //////////////////////////////////////////////////////////////////////////
    94 /// Called by the ComponentManager to start the component
     91
    9592void SickLDMRSSensor::startActivity()
    9693{
     
    104101
    105102        try {
    106             dbtFile_.open(kSickDbtFileName, WriteMode, TELEM_SICK, sizeof(SickLDMRS_dbt));
     103            dbtFile_.open(kSickDbtFileName, WriteMode, TELEM_SICK_LDMRS, sizeof(SickLDMRS_dbt));
    107104        } catch (DbiteException & e) {
    108105            cerr << "error opening dbt file: "<< kSickDbtFileName << ", " << e.what() << endl;
     
    136133}
    137134
    138 //////////////////////////////////////////////////////////////////////////
    139 /// Called by the ComponentManager to stop the component
     135
    140136void SickLDMRSSensor::stopActivity()
    141137{
     
    161157
    162158
    163 //////////////////////////////////////////////////////////////////////////
    164 /// look for the position of the magic word in the packet.
    165 /// Return it if found else return -1
    166159u_int32_t SickLDMRSSensor::findMagicWord(const char * message, const unsigned length)
    167160{
     
    181174}
    182175
    183 //////////////////////////////////////////////////////////////////////////
    184 /// Return the size of the message contained in the packet
    185 /// You have to provide the position of the magic word in the packet
     176
    186177u_int32_t SickLDMRSSensor::getMessageSize(const char * message, const unsigned length, const long magicWordIndex)
    187178{
     
    198189}
    199190
    200 //////////////////////////////////////////////////////////////////////////
    201 /// @param size     the total size of the message including the 2 headers and the body
    202 /// @param length   the number of available bytes in the packet
     191
    203192bool SickLDMRSSensor::isMessageComplete(const unsigned length, const long size)
    204193{
     
    276265}
    277266
    278 //////////////////////////////////////////////////////////////////////////
    279 /// this function is called when no complete message has been found
    280 /// we set the flag previousData to true for the next processing stage
    281 /// and we store the timestamp of the bytes acquisition
     267
    282268void SickLDMRSSensor::storePendingBytes(road_time_t time)
    283269{
     
    406392}
    407393
    408 //////////////////////////////////////////////////////////////////////////
    409 /// write the data on the disk:
    410 /// - complete the dbt file with msg.hData
    411 /// - complete the binary data file with the alascaData.point
     394
    412395void SickLDMRSSensor::writeData(MessageLDMRS &msg)
    413396{
     
    419402    entry.hScan = msg.hScan;
    420403    entry.dataPos = dataFile_.tellp(); // absolute position of pointer in UTC file
    421     entry.time = msg.time;
    422     entry.timerange = msg.timerange;
     404//    entry.time = msg.time;
     405//    entry.timerange = msg.timerange;
    423406
    424407    // write DBT
     
    442425
    443426
    444 ///
    445427void SickLDMRSSensor::configure(){
    446428    // Start measuring
     
    451433
    452434
    453 //////////////////////////////////////////////////////////////////////////
    454 /// Event call by the SickSocket class when new data has been arrived
    455 /// on the network.
    456435void SickLDMRSSensor::customEvent(QEvent * e)
    457436{   
     
    476455            // write data on the disk
    477456            if (recording_)
    478                 writeData(msgList.front());
     457                writeData(msgToProcess);
    479458
    480459#ifdef SICKLDMRS_SH_MEM
     460            /// NOT TESTED !
    481461            /// push data in shared memory
    482462            // First the scan info
     
    499479        }
    500480
    501         // (malloced memory) ScanPoints[] or ScanObjects[] no longer needed
    502         free(msgToProcess.body);
    503 
    504481        // removes the processed item of the list
    505482        msgList.pop_front();
Note: See TracChangeset for help on using the changeset viewer.