MediaController_server_g.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353
  1. #ifndef __MEDIACONTROLLER_SERVER_G_H
  2. #define __MEDIACONTROLLER_SERVER_G_H
  3. #pragma once
  4. // This code is generated by spgen tool!
  5. #include "MediaController_def_g.h"
  6. namespace MediaController {
  7. class MediaService_ServerSessionBase : public CServerSessionBase
  8. {
  9. public:
  10. MediaService_ServerSessionBase()
  11. {
  12. /// override by user
  13. }
  14. virtual ~MediaService_ServerSessionBase()
  15. {
  16. /// override by user
  17. }
  18. virtual bool IsExclusive() { return false; }
  19. virtual bool IsSessionOverlap() { return true; }
  20. virtual ErrorCodeEnum GetMessageAttr(DWORD dwMessageID, DWORD dwSignature, bool &bOverlap)
  21. {
  22. ErrorCodeEnum Error = Error_Succeed;
  23. switch (dwMessageID) {
  24. case MediaService_Method_GetAudioDevices:
  25. if (dwSignature == MediaService_MethodSignature_GetAudioDevices) {
  26. bOverlap = true;
  27. } else {
  28. Error = Error_MethodSignatureFailed;
  29. }
  30. break;
  31. case MediaService_Method_GetVideoDevices:
  32. if (dwSignature == MediaService_MethodSignature_GetVideoDevices) {
  33. bOverlap = true;
  34. } else {
  35. Error = Error_MethodSignatureFailed;
  36. }
  37. break;
  38. case MediaService_Method_GetCameraInfos:
  39. if (dwSignature == MediaService_MethodSignature_GetCameraInfos) {
  40. bOverlap = true;
  41. } else {
  42. Error = Error_MethodSignatureFailed;
  43. }
  44. break;
  45. case MediaService_Method_ManipulateCameras:
  46. if (dwSignature == MediaService_MethodSignature_ManipulateCameras) {
  47. bOverlap = true;
  48. } else {
  49. Error = Error_MethodSignatureFailed;
  50. }
  51. break;
  52. case MediaService_Method_GetEnvCameraVideoCaptureInfo:
  53. if (dwSignature == MediaService_MethodSignature_GetEnvCameraVideoCaptureInfo) {
  54. bOverlap = true;
  55. } else {
  56. Error = Error_MethodSignatureFailed;
  57. }
  58. break;
  59. case MediaService_Method_GetEnvCamRawBrightnessInfo:
  60. if (dwSignature == MediaService_MethodSignature_GetEnvCamRawBrightnessInfo) {
  61. bOverlap = true;
  62. } else {
  63. Error = Error_MethodSignatureFailed;
  64. }
  65. break;
  66. case MediaService_Method_SetEnvCamRawBrightness:
  67. if (dwSignature == MediaService_MethodSignature_SetEnvCamRawBrightness) {
  68. bOverlap = true;
  69. } else {
  70. Error = Error_MethodSignatureFailed;
  71. }
  72. break;
  73. case MediaService_Method_TurnOnCamera:
  74. if (dwSignature == MediaService_MethodSignature_TurnOnCamera) {
  75. bOverlap = true;
  76. } else {
  77. Error = Error_MethodSignatureFailed;
  78. }
  79. break;
  80. case MediaService_Method_TurnOffCamera:
  81. if (dwSignature == MediaService_MethodSignature_TurnOffCamera) {
  82. bOverlap = true;
  83. } else {
  84. Error = Error_MethodSignatureFailed;
  85. }
  86. break;
  87. case MediaService_Method_IsCameraOnStatus:
  88. if (dwSignature == MediaService_MethodSignature_IsCameraOnStatus) {
  89. bOverlap = true;
  90. } else {
  91. Error = Error_MethodSignatureFailed;
  92. }
  93. break;
  94. default:
  95. Error = Error_MethodNotFound;
  96. break;
  97. }
  98. return Error;
  99. }
  100. int CheckMessageSignature(DWORD dwMessageID, DWORD dwSignature)
  101. {
  102. ErrorCodeEnum Error = Error_Succeed;
  103. switch (dwMessageID) {
  104. case MediaService_Method_GetAudioDevices:
  105. if (dwSignature != MediaService_MethodSignature_GetAudioDevices) {
  106. Error = Error_MethodSignatureFailed;
  107. }
  108. break;
  109. case MediaService_Method_GetVideoDevices:
  110. if (dwSignature != MediaService_MethodSignature_GetVideoDevices) {
  111. Error = Error_MethodSignatureFailed;
  112. }
  113. break;
  114. case MediaService_Method_GetCameraInfos:
  115. if (dwSignature != MediaService_MethodSignature_GetCameraInfos) {
  116. Error = Error_MethodSignatureFailed;
  117. }
  118. break;
  119. case MediaService_Method_ManipulateCameras:
  120. if (dwSignature != MediaService_MethodSignature_ManipulateCameras) {
  121. Error = Error_MethodSignatureFailed;
  122. }
  123. break;
  124. case MediaService_Method_GetEnvCameraVideoCaptureInfo:
  125. if (dwSignature != MediaService_MethodSignature_GetEnvCameraVideoCaptureInfo) {
  126. Error = Error_MethodSignatureFailed;
  127. }
  128. break;
  129. case MediaService_Method_GetEnvCamRawBrightnessInfo:
  130. if (dwSignature != MediaService_MethodSignature_GetEnvCamRawBrightnessInfo) {
  131. Error = Error_MethodSignatureFailed;
  132. }
  133. break;
  134. case MediaService_Method_SetEnvCamRawBrightness:
  135. if (dwSignature != MediaService_MethodSignature_SetEnvCamRawBrightness) {
  136. Error = Error_MethodSignatureFailed;
  137. }
  138. break;
  139. case MediaService_Method_TurnOnCamera:
  140. if (dwSignature != MediaService_MethodSignature_TurnOnCamera) {
  141. Error = Error_MethodSignatureFailed;
  142. }
  143. break;
  144. case MediaService_Method_TurnOffCamera:
  145. if (dwSignature != MediaService_MethodSignature_TurnOffCamera) {
  146. Error = Error_MethodSignatureFailed;
  147. }
  148. break;
  149. case MediaService_Method_IsCameraOnStatus:
  150. if (dwSignature != MediaService_MethodSignature_IsCameraOnStatus) {
  151. Error = Error_MethodSignatureFailed;
  152. }
  153. break;
  154. default:
  155. Error = Error_MethodNotFound;
  156. break;
  157. }
  158. return Error;
  159. }
  160. virtual void Handle_GetAudioDevices(SpReqAnsContext<MediaService_GetAudioDevices_Req, MediaService_GetAudioDevices_Ans>::Pointer ctx)
  161. {
  162. /// override by user
  163. }
  164. virtual void Handle_GetVideoDevices(SpReqAnsContext<MediaService_GetVideoDevices_Req, MediaService_GetVideoDevices_Ans>::Pointer ctx)
  165. {
  166. /// override by user
  167. }
  168. virtual void Handle_GetCameraInfos(SpReqAnsContext<MediaService_GetCameraInfos_Req, MediaService_GetCameraInfos_Ans>::Pointer ctx)
  169. {
  170. /// override by user
  171. }
  172. virtual void Handle_ManipulateCameras(SpReqAnsContext<MediaService_ManipulateCameras_Req, MediaService_ManipulateCameras_Ans>::Pointer ctx)
  173. {
  174. /// override by user
  175. }
  176. virtual void Handle_GetEnvCameraVideoCaptureInfo(SpReqAnsContext<MediaService_GetEnvCameraVideoCaptureInfo_Req, MediaService_GetEnvCameraVideoCaptureInfo_Ans>::Pointer ctx)
  177. {
  178. /// override by user
  179. }
  180. virtual void Handle_GetEnvCamRawBrightnessInfo(SpReqAnsContext<MediaService_GetEnvCamRawBrightnessInfo_Req, MediaService_GetEnvCamRawBrightnessInfo_Ans>::Pointer ctx)
  181. {
  182. /// override by user
  183. }
  184. virtual void Handle_SetEnvCamRawBrightness(SpReqAnsContext<MediaService_SetEnvCamRawBrightness_Req, MediaService_SetEnvCamRawBrightness_Ans>::Pointer ctx)
  185. {
  186. /// override by user
  187. }
  188. virtual void Handle_TurnOnCamera(SpReqAnsContext<MediaService_TurnOnCamera_Req, MediaService_TurnOnCamera_Ans>::Pointer ctx)
  189. {
  190. /// override by user
  191. }
  192. virtual void Handle_TurnOffCamera(SpReqAnsContext<MediaService_TurnOffCamera_Req, MediaService_TurnOffCamera_Ans>::Pointer ctx)
  193. {
  194. /// override by user
  195. }
  196. virtual void Handle_IsCameraOnStatus(SpReqAnsContext<MediaService_IsCameraOnStatus_Req, MediaService_IsCameraOnStatus_Ans>::Pointer ctx)
  197. {
  198. /// override by user
  199. }
  200. virtual void OnRequest(CSmartPointer<ITransactionContext> pTransactionContext)
  201. {
  202. CAutoBuffer Buf;
  203. DWORD dwMessageID;
  204. DWORD dwMessageSignature;
  205. ErrorCodeEnum Error = pTransactionContext->GetReceiveBuffer(dwMessageID, dwMessageSignature, Buf);
  206. if (Error == Error_Succeed) {
  207. #ifdef DEBUG
  208. assert(CheckMessageSignature(dwMessageID, dwMessageSignature) == Error_Succeed);
  209. #else
  210. if (CheckMessageSignature(dwMessageID, dwMessageSignature) != Error_Succeed) {
  211. pTransactionContext->SendAnswer(Error_MethodSignatureFailed);
  212. return;
  213. }
  214. #endif
  215. switch (dwMessageID) {
  216. case MediaService_Method_GetAudioDevices:
  217. {
  218. SpReqAnsContext<MediaService_GetAudioDevices_Req,MediaService_GetAudioDevices_Ans>::Pointer ctx;
  219. ctx.Attach(new SpReqAnsContext<MediaService_GetAudioDevices_Req,MediaService_GetAudioDevices_Ans>(pTransactionContext));
  220. SpBuffer2Object(Buf, ctx->Req);
  221. pTransactionContext->GetLinkContext(ctx->link);
  222. EntityResource::setLink(ctx->link);
  223. Handle_GetAudioDevices(ctx);
  224. }
  225. break;
  226. case MediaService_Method_GetVideoDevices:
  227. {
  228. SpReqAnsContext<MediaService_GetVideoDevices_Req,MediaService_GetVideoDevices_Ans>::Pointer ctx;
  229. ctx.Attach(new SpReqAnsContext<MediaService_GetVideoDevices_Req,MediaService_GetVideoDevices_Ans>(pTransactionContext));
  230. SpBuffer2Object(Buf, ctx->Req);
  231. pTransactionContext->GetLinkContext(ctx->link);
  232. EntityResource::setLink(ctx->link);
  233. Handle_GetVideoDevices(ctx);
  234. }
  235. break;
  236. case MediaService_Method_GetCameraInfos:
  237. {
  238. SpReqAnsContext<MediaService_GetCameraInfos_Req,MediaService_GetCameraInfos_Ans>::Pointer ctx;
  239. ctx.Attach(new SpReqAnsContext<MediaService_GetCameraInfos_Req,MediaService_GetCameraInfos_Ans>(pTransactionContext));
  240. SpBuffer2Object(Buf, ctx->Req);
  241. pTransactionContext->GetLinkContext(ctx->link);
  242. EntityResource::setLink(ctx->link);
  243. Handle_GetCameraInfos(ctx);
  244. }
  245. break;
  246. case MediaService_Method_ManipulateCameras:
  247. {
  248. SpReqAnsContext<MediaService_ManipulateCameras_Req,MediaService_ManipulateCameras_Ans>::Pointer ctx;
  249. ctx.Attach(new SpReqAnsContext<MediaService_ManipulateCameras_Req,MediaService_ManipulateCameras_Ans>(pTransactionContext));
  250. SpBuffer2Object(Buf, ctx->Req);
  251. pTransactionContext->GetLinkContext(ctx->link);
  252. EntityResource::setLink(ctx->link);
  253. Handle_ManipulateCameras(ctx);
  254. }
  255. break;
  256. case MediaService_Method_GetEnvCameraVideoCaptureInfo:
  257. {
  258. SpReqAnsContext<MediaService_GetEnvCameraVideoCaptureInfo_Req,MediaService_GetEnvCameraVideoCaptureInfo_Ans>::Pointer ctx;
  259. ctx.Attach(new SpReqAnsContext<MediaService_GetEnvCameraVideoCaptureInfo_Req,MediaService_GetEnvCameraVideoCaptureInfo_Ans>(pTransactionContext));
  260. SpBuffer2Object(Buf, ctx->Req);
  261. pTransactionContext->GetLinkContext(ctx->link);
  262. EntityResource::setLink(ctx->link);
  263. Handle_GetEnvCameraVideoCaptureInfo(ctx);
  264. }
  265. break;
  266. case MediaService_Method_GetEnvCamRawBrightnessInfo:
  267. {
  268. SpReqAnsContext<MediaService_GetEnvCamRawBrightnessInfo_Req,MediaService_GetEnvCamRawBrightnessInfo_Ans>::Pointer ctx;
  269. ctx.Attach(new SpReqAnsContext<MediaService_GetEnvCamRawBrightnessInfo_Req,MediaService_GetEnvCamRawBrightnessInfo_Ans>(pTransactionContext));
  270. SpBuffer2Object(Buf, ctx->Req);
  271. pTransactionContext->GetLinkContext(ctx->link);
  272. EntityResource::setLink(ctx->link);
  273. Handle_GetEnvCamRawBrightnessInfo(ctx);
  274. }
  275. break;
  276. case MediaService_Method_SetEnvCamRawBrightness:
  277. {
  278. SpReqAnsContext<MediaService_SetEnvCamRawBrightness_Req,MediaService_SetEnvCamRawBrightness_Ans>::Pointer ctx;
  279. ctx.Attach(new SpReqAnsContext<MediaService_SetEnvCamRawBrightness_Req,MediaService_SetEnvCamRawBrightness_Ans>(pTransactionContext));
  280. SpBuffer2Object(Buf, ctx->Req);
  281. pTransactionContext->GetLinkContext(ctx->link);
  282. EntityResource::setLink(ctx->link);
  283. Handle_SetEnvCamRawBrightness(ctx);
  284. }
  285. break;
  286. case MediaService_Method_TurnOnCamera:
  287. {
  288. SpReqAnsContext<MediaService_TurnOnCamera_Req,MediaService_TurnOnCamera_Ans>::Pointer ctx;
  289. ctx.Attach(new SpReqAnsContext<MediaService_TurnOnCamera_Req,MediaService_TurnOnCamera_Ans>(pTransactionContext));
  290. SpBuffer2Object(Buf, ctx->Req);
  291. pTransactionContext->GetLinkContext(ctx->link);
  292. EntityResource::setLink(ctx->link);
  293. Handle_TurnOnCamera(ctx);
  294. }
  295. break;
  296. case MediaService_Method_TurnOffCamera:
  297. {
  298. SpReqAnsContext<MediaService_TurnOffCamera_Req,MediaService_TurnOffCamera_Ans>::Pointer ctx;
  299. ctx.Attach(new SpReqAnsContext<MediaService_TurnOffCamera_Req,MediaService_TurnOffCamera_Ans>(pTransactionContext));
  300. SpBuffer2Object(Buf, ctx->Req);
  301. pTransactionContext->GetLinkContext(ctx->link);
  302. EntityResource::setLink(ctx->link);
  303. Handle_TurnOffCamera(ctx);
  304. }
  305. break;
  306. case MediaService_Method_IsCameraOnStatus:
  307. {
  308. SpReqAnsContext<MediaService_IsCameraOnStatus_Req,MediaService_IsCameraOnStatus_Ans>::Pointer ctx;
  309. ctx.Attach(new SpReqAnsContext<MediaService_IsCameraOnStatus_Req,MediaService_IsCameraOnStatus_Ans>(pTransactionContext));
  310. SpBuffer2Object(Buf, ctx->Req);
  311. pTransactionContext->GetLinkContext(ctx->link);
  312. EntityResource::setLink(ctx->link);
  313. Handle_IsCameraOnStatus(ctx);
  314. }
  315. break;
  316. default:
  317. assert(0);
  318. break;
  319. }
  320. } else {
  321. pTransactionContext->SendAnswer(Error);
  322. }
  323. }
  324. };
  325. ///////////////////////////
  326. } // namespace MediaController
  327. #endif // __MEDIACONTROLLER_SERVER_G_H