myriadrf / LimeSuite

Driver and GUI for LMS7002M-based SDR platforms
https://myriadrf.org/projects/lime-suite/
Apache License 2.0
465 stars 182 forks source link

fix API functions LMS_StartStream() and LMS_StopStream() : #390

Open mbraune opened 6 months ago

mbraune commented 6 months ago

pls fix wrong behaviour if stream started without creation in src/API/lms7_api.cpp: functions LMS_StartStream(lms_stream_t stream) and
LMS_StopStream(lms_stream_t
stream)
return 0 (success) if stream==NULL or stream->handle==0 this should be changed to return -1

mbraune commented 6 months ago

suggested change:

API_EXPORT int CALL_CONV LMS_StartStream(lms_stream_t *stream)
{
    if (stream==nullptr || stream->handle==0)
        return -1;
    return reinterpret_cast<lime::StreamChannel*>(stream->handle)->Start();
}

API_EXPORT int CALL_CONV LMS_StopStream(lms_stream_t *stream)
{
    if (stream==nullptr || stream->handle==0)
        return -1;
    return reinterpret_cast<lime::StreamChannel*>(stream->handle)->Stop();
}