Dali 3D User Interface Engine
network-performance-server.h
Go to the documentation of this file.
1 #ifndef __DALI_INTERNAL_ADAPTOR_NETWORK_PERFORMANCE_SERVER_H__
2 #define __DALI_INTERNAL_ADAPTOR_NETWORK_PERFORMANCE_SERVER_H__
3 
4 /*
5  * Copyright (c) 2015 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20 
21 // EXTERNAL INCLUDES
22 #include <pthread.h>
25 
26 // INTERNAL INCLUDES
30 
31 namespace Dali
32 {
33 
34 namespace Internal
35 {
36 
37 namespace Adaptor
38 {
39 
40 class SocketInterface;
41 class PerformanceMarker;
42 
62 {
63 
64 public:
65 
71  NetworkPerformanceServer( AdaptorInternalServices& adaptorServices, const EnvironmentOptions& logOptions );
72 
73 
78  void Start();
79 
84  void Stop();
85 
89  bool IsRunning() const;
90 
98  void TransmitMarker( const PerformanceMarker& marker, const char* const description );
99 
104 
105 protected: // ClientSendDataInterface
106 
110  virtual void SendData( const char* const data, unsigned int bufferSizeInBytes, unsigned int clientId );
111 
112 private:
113 
118  static void* ConnectionListenerFunc( void* This )
119  {
120  ( static_cast<NetworkPerformanceServer*>( This ) )->ConnectionListener();
121  return NULL;
122  }
123 
128  static void* ClientThreadFunc( void* data );
129 
134  void ClientThread( NetworkPerformanceClient* client );
135 
139  void StopClients();
140 
144  void ConnectionListener();
145 
152  NetworkPerformanceClient* AddClient( SocketInterface* clientSocket, pthread_t* clientThread );
153 
158  void DeleteClient( NetworkPerformanceClient* client );
159 
162 
163 
164  TriggerEventFactoryInterface& mTriggerEventFactory;
168  pthread_t mServerThread;
171  unsigned int mClientUniqueId;
172  volatile unsigned int mClientCount;
174 
175 };
176 
177 
178 } // namespace Internal
179 
180 } // namespace Adaptor
181 
182 } // namespace Dali
183 
184 #endif //__DALI_INTERNAL_ADAPTOR_NETWORK_PERFORMANCE_SERVER_H__
Dali Docs Home
Read more about Dali