diff options
author | christian mueller <christian.ei.mueller@bmw.de> | 2011-12-21 23:58:33 +0100 |
---|---|---|
committer | christian mueller <christian.ei.mueller@bmw.de> | 2011-12-21 23:58:33 +0100 |
commit | b9b9e9ace5c6c7c493438ecf9a4b33b47543e8e3 (patch) | |
tree | 3b5492551a61dd862fb3a042795dd1e59c0cfed6 /AudioManagerDaemon/test | |
parent | f8a41c140abbd1d193ed19f6c2be598adc01292a (diff) | |
download | audiomanager-b9b9e9ace5c6c7c493438ecf9a4b33b47543e8e3.tar.gz |
* first version of SocketHandler working with DBus
* currently Sockethandler test not working
Diffstat (limited to 'AudioManagerDaemon/test')
-rw-r--r-- | AudioManagerDaemon/test/CMakeLists.txt | 2 | ||||
-rw-r--r-- | AudioManagerDaemon/test/sockethandler/sockethandlerTest.cpp | 38 | ||||
-rw-r--r-- | AudioManagerDaemon/test/sockethandler/sockethandlerTest.h | 12 |
3 files changed, 26 insertions, 26 deletions
diff --git a/AudioManagerDaemon/test/CMakeLists.txt b/AudioManagerDaemon/test/CMakeLists.txt index e2e22c0..3ee415a 100644 --- a/AudioManagerDaemon/test/CMakeLists.txt +++ b/AudioManagerDaemon/test/CMakeLists.txt @@ -15,4 +15,4 @@ cmake_minimum_required(VERSION 2.6) add_subdirectory (database) add_subdirectory (routingInterface) add_subdirectory (controlInterface) -add_subdirectory (sockethandler)
\ No newline at end of file +#add_subdirectory (sockethandler)
\ No newline at end of file diff --git a/AudioManagerDaemon/test/sockethandler/sockethandlerTest.cpp b/AudioManagerDaemon/test/sockethandler/sockethandlerTest.cpp index 2cab649..c9c17cb 100644 --- a/AudioManagerDaemon/test/sockethandler/sockethandlerTest.cpp +++ b/AudioManagerDaemon/test/sockethandler/sockethandlerTest.cpp @@ -25,7 +25,7 @@ sockethandlerTest::~sockethandlerTest() { } -void fdCallBack::connectSocket(int fd, const short events) +void fdCallBack::connectSocket(int fd, const short events,void * userData) { std::cout<<"Socket connection received and open"<<std::endl; @@ -34,9 +34,9 @@ void fdCallBack::connectSocket(int fd, const short events) short event = 0; event |=POLLIN; - TBasicPollCallback* buf=&pSocketDataCallback; + shPollCallBack* buf=&pSocketDataCallback; //add new socketConnection to the handler - mSocketHandler->addFDPoll(mSocketConnection,event,buf); + mSocketHandler->addFDPoll(mSocketConnection,event,buf,NULL); } @@ -52,7 +52,7 @@ fdCallBack::fdCallBack(SocketHandler *SocketHandler) -void am::fdCallBack::handleSocketData(int fd, const short events) +void am::fdCallBack::handleSocketData(int fd, const short events, void* userdata) { char buffer[3000]; std::string msg; @@ -93,36 +93,36 @@ am::timerCallBack::~timerCallBack() -void am::timerCallBack::timer1Callback(SocketHandler::timerHandle_t handle) +void am::timerCallBack::timer1Callback(SocketHandler::sh_timerHandle_t handle, void* userData) { std::cout<<"callback1 called"<<std::endl; timespec timeout; timeout.tv_nsec=0; timeout.tv_sec=1; TBasicTimerCallback *buf=&pTimer1Callback; - SocketHandler::timerHandle_t handle_; - mSocketHandler->addTimer(timeout,buf,handle_); + SocketHandler::sh_timerHandle_t handle_; + mSocketHandler->addTimer(timeout,buf,handle_,NULL); } -void am::timerCallBack::timer2Callback(SocketHandler::timerHandle_t handle) +void am::timerCallBack::timer2Callback(SocketHandler::sh_timerHandle_t handle, void* userData) { std::cout<<"callback2 called"<<std::endl; timespec timeout; timeout.tv_nsec=0; timeout.tv_sec=1; TBasicTimerCallback *buf=&pTimer2Callback; - SocketHandler::timerHandle_t handle_; - mSocketHandler->addTimer(timeout,buf,handle_); + SocketHandler::sh_timerHandle_t handle_; + mSocketHandler->addTimer(timeout,buf,handle_,NULL); } -void am::timerCallBack::timer3Callback(SocketHandler::timerHandle_t handle) +void am::timerCallBack::timer3Callback(SocketHandler::sh_timerHandle_t handle, void* userData) { std::cout<<"callback3 called"<<std::endl; } -void am::timerCallBack::timer4Callback(SocketHandler::timerHandle_t handle) +void am::timerCallBack::timer4Callback(SocketHandler::sh_timerHandle_t handle, void* userData) { std::cout<<"callback4 called"<<std::endl; } @@ -151,9 +151,9 @@ void* playWithSocketServer(void* data) short event = 0; event |=POLLIN; - TBasicPollCallback* buf=&testCallback.pSocketConnectionCallback; + shPollCallBack* buf=&testCallback.pSocketConnectionCallback; //add the callback to the Sockethandler - myHandler.addFDPoll(socketHandle, event, buf); + myHandler.addFDPoll(socketHandle, event, buf, NULL); //start the mainloop myHandler.start_listenting(); @@ -216,11 +216,11 @@ TEST(sockethandlerTest,playWithTimers) TBasicTimerCallback* buf2=&testCallback.pTimer2Callback; TBasicTimerCallback* buf3=&testCallback.pTimer3Callback; TBasicTimerCallback* buf4=&testCallback.pTimer4Callback; - SocketHandler::timerHandle_t handle; - myHandler.addTimer(timeoutTime,buf,handle); - myHandler.addTimer(timeout2,buf2,handle); - myHandler.addTimer(timeout3,buf3,handle); - myHandler.addTimer(timeout4,buf4,handle); + SocketHandler::sh_timerHandle_t handle; + myHandler.addTimer(timeoutTime,buf,handle,NULL); + myHandler.addTimer(timeout2,buf2,handle,NULL); + myHandler.addTimer(timeout3,buf3,handle,NULL); + myHandler.addTimer(timeout4,buf4,handle,NULL); myHandler.start_listenting(); } diff --git a/AudioManagerDaemon/test/sockethandler/sockethandlerTest.h b/AudioManagerDaemon/test/sockethandler/sockethandlerTest.h index 5b86ad9..81ded2a 100644 --- a/AudioManagerDaemon/test/sockethandler/sockethandlerTest.h +++ b/AudioManagerDaemon/test/sockethandler/sockethandlerTest.h @@ -18,8 +18,8 @@ class fdCallBack public: fdCallBack(SocketHandler *SocketHandler); virtual ~fdCallBack(); - void connectSocket(int fd,const short events); - void handleSocketData(int fd,const short events); + void connectSocket(int fd,const short events,void * userData); + void handleSocketData(int fd,const short events,void * userData); TSpecificPollCallback<fdCallBack> pSocketDataCallback; TSpecificPollCallback<fdCallBack> pSocketConnectionCallback; private: @@ -32,10 +32,10 @@ class timerCallBack public: timerCallBack(SocketHandler *SocketHandler); virtual ~timerCallBack(); - void timer1Callback(SocketHandler::timerHandle_t handle); - void timer2Callback(SocketHandler::timerHandle_t handle); - void timer3Callback(SocketHandler::timerHandle_t handle); - void timer4Callback(SocketHandler::timerHandle_t handle); + void timer1Callback(SocketHandler::sh_timerHandle_t handle,void * userData); + void timer2Callback(SocketHandler::sh_timerHandle_t handle,void * userData); + void timer3Callback(SocketHandler::sh_timerHandle_t handle,void * userData); + void timer4Callback(SocketHandler::sh_timerHandle_t handle,void * userData); TSpecificTimerCallback<timerCallBack> pTimer1Callback; TSpecificTimerCallback<timerCallBack> pTimer2Callback; TSpecificTimerCallback<timerCallBack> pTimer3Callback; |