#ifndef __RILMONITOR_H__ #define __RILMONITOR_H__ // vim: ts=4 sw=4 et #include #include "waitvariable.h" // this is the baseclass of the specific requests. // // handle() is called by the ril-stack ( in this case 'rilsimulate' ) // request() is called by rilmonitor_impl::process_request // notify() should be called by the handle() function, after the state of the request object has been updated // wait() is called by the caller of the request object class requesthandler { public: requesthandler() : _ready(false) { } virtual ~requesthandler() { } void notify() { _ready.set(true); } void wait() { _ready.wait_equal(true); } virtual void handle(long dwCode, const void *data, size_t size)= 0; virtual bool request(int& cmdid)= 0; // todo: call process_request from here /* bool call() { return ril->process_requst(this); } // end then use: // requesthandler_ptr p= requesthandler_ptr(new request1handler(l, ril)); // p->call(); // p->wait(); // // this gets rid of the request_value1 etc functions in rilmonitor. */ private: waitvariable _ready; }; typedef boost::shared_ptr requesthandler_ptr; // rilmonitor_impl talks to the RIL stack directly // it is seperate from rilmonitor so the user of rilmonitor.h // is not burdened with including all ril specific lowlevel details. class rilmonitor_impl; class rilmonitor { public: rilmonitor(); ~rilmonitor(); // ril functions requesthandler_ptr request_value1(long &level, int p); requesthandler_ptr request_value2(long &level, int p1, int p2); rilmonitor_impl *_; }; #endif