Сбор информации о погодных условиях
Dependencies: RF24 USBDevice mbed
Diff: WirelessListener.h
- Revision:
- 3:346b49152f1e
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/WirelessListener.h Wed Oct 28 20:49:13 2015 +0000 @@ -0,0 +1,58 @@ +#ifndef WIRELESSLISTENER_H +#define WIRELESSLISTENER_H + +#include "mbed.h" +#include "RF24.h" +#include "RequestsCodes.h" +#include "ThermometerTmp36.h" +#include "Thermistor.h" +#include "Photoresistor.h" + +//#define DEBUG + +#ifdef DEBUG +#include "USBSerial.h" +#endif + +/** +* Encapsulates inside accept requests, processing (reading sensor data) and transmission back +*/ +class WirelessListener{ +public: + /** + * The request handler + * @param readPipe Pipe identifier for receiving + * @param writePipe Pipe identifier for transmission + */ + WirelessListener(uint64_t readPipe, uint64_t writePipe); + + ~WirelessListener(); + + /** + * Start receiving and processing requests + */ + void startListening(); + + +private: +#ifdef DEBUG + USBSerial pc; +#endif + //Initialization of the transmitter + void wirelessInit(); + + //Receiving pipe + uint64_t readPipe; + //Transmission pipe + uint64_t writePipe; + //Transmitter + RF24 *radio; + + //Sensors + ThermometerTmp36 *termTmp36; + Thermistor *term503; + Photoresistor *photores; + +}; + +#endif \ No newline at end of file