Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Your driver class should inherit from DebugStreamAsynDriver class (and therefore will become an asyn driver)
  2. call the DebugStreamAsynDriver in the initializer list or the constructor of the asyn driver
  3. create your parameters in constructor
  4. Overload the virtual asyn write and read functions if necessary
  5. Overload the virtual streamPoll command of the parent class GmdDebugStream. This is where you will read and process the streams. 

...

Code Block
languagecpp
themeRDark
titlestreamPoll method
void GmdDebugStream::streamPoll(const int ch) {
    // First check if the user created the channel
    if(! _stream[ch]) {
        return;
    }

    try {
        rdLen[ch] = _stream[ch]->read(buff[ch], size, CTimeout(2000000));
    }
    catch (IOError &e) {
        // A timeout happened
        timeoutCnt ++;
        timeoutCnt_perStream[ch] ++;
    }
    catch (CPSWError &e) {
        // Don't print, as we are inside a polling. Wait for the next try, as
        // rdLen[ch] will be zero.
    }
    
    if(rdLen[ch] == 0 ) {
        return;
    }

    epicsTimeStamp time;
        
    rdCnt++; rdCnt_perStream[ch]++;

    /* extract data in stream */          
	stream_with_header_t *p = (stream_with_header_t *) buff[ch];
    time.nsec               = p->packet.time.

	secPastEpoch;
    time.secPastEpoch       = p->packet.time.nsec;   /* Set PVs from extracted data */
	...

	setTimeStamp(&time);
    callParamCallbacks();

}

...