28#define currentReceiverTemperature TemperatureN[0].value
37 LOG_INFO(
"Simple Receiver connected successfully!");
50 LOG_INFO(
"Simple Receiver disconnected successfully!");
59 return "Simple Receiver";
119void SimpleReceiver::setupParams()
134 IntegrationRequest = duration;
139 gettimeofday(&CapStart,
nullptr);
141 InIntegration =
true;
152 InIntegration =
false;
170float SimpleReceiver::CalcTimeLeft()
179 gettimeofday(&now,
nullptr);
181 timesince = (double)(now.tv_sec * 1000.0 + now.tv_usec / 1000) -
182 (double)(CapStart.tv_sec * 1000.0 + CapStart.tv_usec / 1000);
183 timesince = timesince / 1000;
185 timeleft = IntegrationRequest - timesince;
201 timeleft = CalcTimeLeft();
208 LOG_INFO(
"Integration done, downloading image...");
214 InIntegration =
false;
242 LOG_INFO(
"Target temperature reached.");
262void SimpleReceiver::grabFrame()
272 for (
int i = 0; i < len; i++)
273 continuum[i] = rand() % 255;
void setDefaultPollingPeriod(uint32_t msec)
setDefaultPollingPeriod Change the default polling period to call TimerHit() function in the driver.
uint32_t getCurrentPollingPeriod() const
getCurrentPollingPeriod Return the current polling period.
void addAuxControls()
Add Debug, Simulation, and Configuration options to the driver.
int SetTimer(uint32_t ms)
Set a timer to call the function TimerHit after ms milliseconds.
void setGain(double gain)
setGain Set gain of Receiver device.
virtual bool updateProperties() override
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
void setBandwidth(double bandwidth)
setBandwidth Set bandwidth of Receiver device.
void setBPS(int BPS)
setBPS Set the bits per sample.
virtual bool initProperties() override
Initialize properties initial state and value. The child class must implement this function.
void setFrequency(double freq)
setFrequency Set the frequency observed.
double getSampleRate()
getSampleRate Get requested sample rate for the sensor in Hz.
void setSampleRate(double sr)
setSampleRate Set depth of Receiver device.
void SetCapability(uint32_t cap)
SetCapability Set the Sensor capabilities. Al fields must be initialized.
void setBufferSize(int nbuf, bool allocMem=true)
setBufferSize Set desired buffer size. The function will allocate memory accordingly....
void setIntegrationLeft(double duration)
setIntegrationLeft Update Integration time left. Inform the client of the new Integration time left v...
void setIntegrationTime(double duration)
setIntegrationTime Set desired Sensor frame Integration duration for next Integration....
INumberVectorProperty TemperatureNP
virtual bool IntegrationComplete()
Uploads target Device exposed buffer as FITS to the client. Derived classes should class this functio...
uint8_t * getBuffer()
getBuffer Get continuum buffer of the stream of the Sensor device.
int getBPS() const
getBPS Get Sensor depth (bits per sample).
double getIntegrationTime() const
getIntegrationTime Get requested Integration duration for the Sensor device in seconds.
void TimerHit() override
Callback function to be called once SetTimer duration elapses.
bool StartIntegration(double duration) override
Start integration from the Sensor device.
bool initProperties() override
Initialize properties initial state and value. The child class must implement this function.
bool Connect() override
Connect to the device. INDI::DefaultDevice implementation connects to appropriate connection interfac...
bool Disconnect() override
Disconnect from device.
const char * getDefaultName() override
int SetTemperature(double temperature) override
Set Sensor temperature.
bool paramsUpdated(float sr, float freq, float bps, float bw, float gain)
bool updateProperties() override
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
bool AbortIntegration() override
Abort ongoing Integration.
void IDSetNumber(const INumberVectorProperty *nvp, const char *fmt,...)
std::unique_ptr< SimpleReceiver > simpleReceiver(new SimpleReceiver())
#define currentReceiverTemperature