LocalMediaPlay_server_g.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408
  1. #ifndef __LOCALMEDIAPLAY_SERVER_G_H
  2. #define __LOCALMEDIAPLAY_SERVER_G_H
  3. #pragma once
  4. // This code is generated by spgen tool!
  5. #include "LocalMediaPlay_def_g.h"
  6. namespace LocalMediaPlay {
  7. class PlayService_ServerSessionBase : public CServerSessionBase
  8. {
  9. public:
  10. PlayService_ServerSessionBase()
  11. {
  12. /// override by user
  13. }
  14. virtual ~PlayService_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 PlayService_Method_StartPlayVideo:
  25. if (dwSignature == PlayService_MethodSignature_StartPlayVideo) {
  26. bOverlap = true;
  27. } else {
  28. Error = Error_MethodSignatureFailed;
  29. }
  30. break;
  31. case PlayService_Method_StartPlayAudio:
  32. if (dwSignature == PlayService_MethodSignature_StartPlayAudio) {
  33. bOverlap = true;
  34. } else {
  35. Error = Error_MethodSignatureFailed;
  36. }
  37. break;
  38. case PlayService_Method_StartPlayImage:
  39. if (dwSignature == PlayService_MethodSignature_StartPlayImage) {
  40. bOverlap = true;
  41. } else {
  42. Error = Error_MethodSignatureFailed;
  43. }
  44. break;
  45. case PlayService_Method_StopPlayVideo:
  46. if (dwSignature == PlayService_MethodSignature_StopPlayVideo) {
  47. bOverlap = true;
  48. } else {
  49. Error = Error_MethodSignatureFailed;
  50. }
  51. break;
  52. case PlayService_Method_StopPlayAudio:
  53. if (dwSignature == PlayService_MethodSignature_StopPlayAudio) {
  54. bOverlap = true;
  55. } else {
  56. Error = Error_MethodSignatureFailed;
  57. }
  58. break;
  59. case PlayService_Method_StopPlayImage:
  60. if (dwSignature == PlayService_MethodSignature_StopPlayImage) {
  61. bOverlap = true;
  62. } else {
  63. Error = Error_MethodSignatureFailed;
  64. }
  65. break;
  66. case PlayService_Method_GetLocalVideoVolume:
  67. if (dwSignature == PlayService_MethodSignature_GetLocalVideoVolume) {
  68. bOverlap = true;
  69. } else {
  70. Error = Error_MethodSignatureFailed;
  71. }
  72. break;
  73. case PlayService_Method_SetLocalVideoVolume:
  74. if (dwSignature == PlayService_MethodSignature_SetLocalVideoVolume) {
  75. bOverlap = true;
  76. } else {
  77. Error = Error_MethodSignatureFailed;
  78. }
  79. break;
  80. case PlayService_Method_GetLocalAudioVolume:
  81. if (dwSignature == PlayService_MethodSignature_GetLocalAudioVolume) {
  82. bOverlap = true;
  83. } else {
  84. Error = Error_MethodSignatureFailed;
  85. }
  86. break;
  87. case PlayService_Method_SetLocalAudioVolume:
  88. if (dwSignature == PlayService_MethodSignature_SetLocalAudioVolume) {
  89. bOverlap = true;
  90. } else {
  91. Error = Error_MethodSignatureFailed;
  92. }
  93. break;
  94. case PlayService_Method_StartPlayNotice:
  95. if (dwSignature == PlayService_MethodSignature_StartPlayNotice) {
  96. bOverlap = true;
  97. } else {
  98. Error = Error_MethodSignatureFailed;
  99. }
  100. break;
  101. case PlayService_Method_StopPlayNotice:
  102. if (dwSignature == PlayService_MethodSignature_StopPlayNotice) {
  103. bOverlap = true;
  104. } else {
  105. Error = Error_MethodSignatureFailed;
  106. }
  107. break;
  108. case PlayService_Method_StopPlayAllMedias:
  109. if (dwSignature == PlayService_MethodSignature_StopPlayAllMedias) {
  110. bOverlap = true;
  111. } else {
  112. Error = Error_MethodSignatureFailed;
  113. }
  114. break;
  115. default:
  116. Error = Error_MethodNotFound;
  117. break;
  118. }
  119. return Error;
  120. }
  121. int CheckMessageSignature(DWORD dwMessageID, DWORD dwSignature)
  122. {
  123. ErrorCodeEnum Error = Error_Succeed;
  124. switch (dwMessageID) {
  125. case PlayService_Method_StartPlayVideo:
  126. if (dwSignature != PlayService_MethodSignature_StartPlayVideo) {
  127. Error = Error_MethodSignatureFailed;
  128. }
  129. break;
  130. case PlayService_Method_StartPlayAudio:
  131. if (dwSignature != PlayService_MethodSignature_StartPlayAudio) {
  132. Error = Error_MethodSignatureFailed;
  133. }
  134. break;
  135. case PlayService_Method_StartPlayImage:
  136. if (dwSignature != PlayService_MethodSignature_StartPlayImage) {
  137. Error = Error_MethodSignatureFailed;
  138. }
  139. break;
  140. case PlayService_Method_StopPlayVideo:
  141. if (dwSignature != PlayService_MethodSignature_StopPlayVideo) {
  142. Error = Error_MethodSignatureFailed;
  143. }
  144. break;
  145. case PlayService_Method_StopPlayAudio:
  146. if (dwSignature != PlayService_MethodSignature_StopPlayAudio) {
  147. Error = Error_MethodSignatureFailed;
  148. }
  149. break;
  150. case PlayService_Method_StopPlayImage:
  151. if (dwSignature != PlayService_MethodSignature_StopPlayImage) {
  152. Error = Error_MethodSignatureFailed;
  153. }
  154. break;
  155. case PlayService_Method_GetLocalVideoVolume:
  156. if (dwSignature != PlayService_MethodSignature_GetLocalVideoVolume) {
  157. Error = Error_MethodSignatureFailed;
  158. }
  159. break;
  160. case PlayService_Method_SetLocalVideoVolume:
  161. if (dwSignature != PlayService_MethodSignature_SetLocalVideoVolume) {
  162. Error = Error_MethodSignatureFailed;
  163. }
  164. break;
  165. case PlayService_Method_GetLocalAudioVolume:
  166. if (dwSignature != PlayService_MethodSignature_GetLocalAudioVolume) {
  167. Error = Error_MethodSignatureFailed;
  168. }
  169. break;
  170. case PlayService_Method_SetLocalAudioVolume:
  171. if (dwSignature != PlayService_MethodSignature_SetLocalAudioVolume) {
  172. Error = Error_MethodSignatureFailed;
  173. }
  174. break;
  175. case PlayService_Method_StartPlayNotice:
  176. if (dwSignature != PlayService_MethodSignature_StartPlayNotice) {
  177. Error = Error_MethodSignatureFailed;
  178. }
  179. break;
  180. case PlayService_Method_StopPlayNotice:
  181. if (dwSignature != PlayService_MethodSignature_StopPlayNotice) {
  182. Error = Error_MethodSignatureFailed;
  183. }
  184. break;
  185. case PlayService_Method_StopPlayAllMedias:
  186. if (dwSignature != PlayService_MethodSignature_StopPlayAllMedias) {
  187. Error = Error_MethodSignatureFailed;
  188. }
  189. break;
  190. default:
  191. Error = Error_MethodNotFound;
  192. break;
  193. }
  194. return Error;
  195. }
  196. virtual void Handle_StartPlayVideo(SpReqAnsContext<PlayService_StartPlayVideo_Req, PlayService_StartPlayVideo_Ans>::Pointer ctx)
  197. {
  198. /// override by user
  199. }
  200. virtual void Handle_StartPlayAudio(SpReqAnsContext<PlayService_StartPlayAudio_Req, PlayService_StartPlayAudio_Ans>::Pointer ctx)
  201. {
  202. /// override by user
  203. }
  204. virtual void Handle_StartPlayImage(SpReqAnsContext<PlayService_StartPlayImage_Req, PlayService_StartPlayImage_Ans>::Pointer ctx)
  205. {
  206. /// override by user
  207. }
  208. virtual void Handle_StopPlayVideo(SpReqAnsContext<PlayService_StopPlayVideo_Req, PlayService_StopPlayVideo_Ans>::Pointer ctx)
  209. {
  210. /// override by user
  211. }
  212. virtual void Handle_StopPlayAudio(SpReqAnsContext<PlayService_StopPlayAudio_Req, PlayService_StopPlayAudio_Ans>::Pointer ctx)
  213. {
  214. /// override by user
  215. }
  216. virtual void Handle_StopPlayImage(SpReqAnsContext<PlayService_StopPlayImage_Req, PlayService_StopPlayImage_Ans>::Pointer ctx)
  217. {
  218. /// override by user
  219. }
  220. virtual void Handle_GetLocalVideoVolume(SpReqAnsContext<PlayService_GetLocalVideoVolume_Req, PlayService_GetLocalVideoVolume_Ans>::Pointer ctx)
  221. {
  222. /// override by user
  223. }
  224. virtual void Handle_SetLocalVideoVolume(SpReqAnsContext<PlayService_SetLocalVideoVolume_Req, PlayService_SetLocalVideoVolume_Ans>::Pointer ctx)
  225. {
  226. /// override by user
  227. }
  228. virtual void Handle_GetLocalAudioVolume(SpReqAnsContext<PlayService_GetLocalAudioVolume_Req, PlayService_GetLocalAudioVolume_Ans>::Pointer ctx)
  229. {
  230. /// override by user
  231. }
  232. virtual void Handle_SetLocalAudioVolume(SpReqAnsContext<PlayService_SetLocalAudioVolume_Req, PlayService_SetLocalAudioVolume_Ans>::Pointer ctx)
  233. {
  234. /// override by user
  235. }
  236. virtual void Handle_StartPlayNotice(SpReqAnsContext<PlayService_StartPlayNotice_Req, PlayService_StartPlayNotice_Ans>::Pointer ctx)
  237. {
  238. /// override by user
  239. }
  240. virtual void Handle_StopPlayNotice(SpReqAnsContext<PlayService_StopPlayNotice_Req, PlayService_StopPlayNotice_Ans>::Pointer ctx)
  241. {
  242. /// override by user
  243. }
  244. virtual void Handle_StopPlayAllMedias(SpReqAnsContext<PlayService_StopPlayAllMedias_Req, PlayService_StopPlayAllMedias_Ans>::Pointer ctx)
  245. {
  246. /// override by user
  247. }
  248. virtual void OnRequest(CSmartPointer<ITransactionContext> pTransactionContext)
  249. {
  250. CAutoBuffer Buf;
  251. DWORD dwMessageID;
  252. DWORD dwMessageSignature;
  253. ErrorCodeEnum Error = pTransactionContext->GetReceiveBuffer(dwMessageID, dwMessageSignature, Buf);
  254. if (Error == Error_Succeed) {
  255. #ifdef DEBUG
  256. assert(CheckMessageSignature(dwMessageID, dwMessageSignature) == Error_Succeed);
  257. #else
  258. if (CheckMessageSignature(dwMessageID, dwMessageSignature) != Error_Succeed) {
  259. pTransactionContext->SendAnswer(Error_MethodSignatureFailed);
  260. return;
  261. }
  262. #endif
  263. switch (dwMessageID) {
  264. case PlayService_Method_StartPlayVideo:
  265. {
  266. SpReqAnsContext<PlayService_StartPlayVideo_Req,PlayService_StartPlayVideo_Ans>::Pointer ctx;
  267. ctx.Attach(new SpReqAnsContext<PlayService_StartPlayVideo_Req,PlayService_StartPlayVideo_Ans>(pTransactionContext));
  268. SpBuffer2Object(Buf, ctx->Req);
  269. Handle_StartPlayVideo(ctx);
  270. }
  271. break;
  272. case PlayService_Method_StartPlayAudio:
  273. {
  274. SpReqAnsContext<PlayService_StartPlayAudio_Req,PlayService_StartPlayAudio_Ans>::Pointer ctx;
  275. ctx.Attach(new SpReqAnsContext<PlayService_StartPlayAudio_Req,PlayService_StartPlayAudio_Ans>(pTransactionContext));
  276. SpBuffer2Object(Buf, ctx->Req);
  277. Handle_StartPlayAudio(ctx);
  278. }
  279. break;
  280. case PlayService_Method_StartPlayImage:
  281. {
  282. SpReqAnsContext<PlayService_StartPlayImage_Req,PlayService_StartPlayImage_Ans>::Pointer ctx;
  283. ctx.Attach(new SpReqAnsContext<PlayService_StartPlayImage_Req,PlayService_StartPlayImage_Ans>(pTransactionContext));
  284. SpBuffer2Object(Buf, ctx->Req);
  285. Handle_StartPlayImage(ctx);
  286. }
  287. break;
  288. case PlayService_Method_StopPlayVideo:
  289. {
  290. SpReqAnsContext<PlayService_StopPlayVideo_Req,PlayService_StopPlayVideo_Ans>::Pointer ctx;
  291. ctx.Attach(new SpReqAnsContext<PlayService_StopPlayVideo_Req,PlayService_StopPlayVideo_Ans>(pTransactionContext));
  292. SpBuffer2Object(Buf, ctx->Req);
  293. Handle_StopPlayVideo(ctx);
  294. }
  295. break;
  296. case PlayService_Method_StopPlayAudio:
  297. {
  298. SpReqAnsContext<PlayService_StopPlayAudio_Req,PlayService_StopPlayAudio_Ans>::Pointer ctx;
  299. ctx.Attach(new SpReqAnsContext<PlayService_StopPlayAudio_Req,PlayService_StopPlayAudio_Ans>(pTransactionContext));
  300. SpBuffer2Object(Buf, ctx->Req);
  301. Handle_StopPlayAudio(ctx);
  302. }
  303. break;
  304. case PlayService_Method_StopPlayImage:
  305. {
  306. SpReqAnsContext<PlayService_StopPlayImage_Req,PlayService_StopPlayImage_Ans>::Pointer ctx;
  307. ctx.Attach(new SpReqAnsContext<PlayService_StopPlayImage_Req,PlayService_StopPlayImage_Ans>(pTransactionContext));
  308. SpBuffer2Object(Buf, ctx->Req);
  309. Handle_StopPlayImage(ctx);
  310. }
  311. break;
  312. case PlayService_Method_GetLocalVideoVolume:
  313. {
  314. SpReqAnsContext<PlayService_GetLocalVideoVolume_Req,PlayService_GetLocalVideoVolume_Ans>::Pointer ctx;
  315. ctx.Attach(new SpReqAnsContext<PlayService_GetLocalVideoVolume_Req,PlayService_GetLocalVideoVolume_Ans>(pTransactionContext));
  316. SpBuffer2Object(Buf, ctx->Req);
  317. Handle_GetLocalVideoVolume(ctx);
  318. }
  319. break;
  320. case PlayService_Method_SetLocalVideoVolume:
  321. {
  322. SpReqAnsContext<PlayService_SetLocalVideoVolume_Req,PlayService_SetLocalVideoVolume_Ans>::Pointer ctx;
  323. ctx.Attach(new SpReqAnsContext<PlayService_SetLocalVideoVolume_Req,PlayService_SetLocalVideoVolume_Ans>(pTransactionContext));
  324. SpBuffer2Object(Buf, ctx->Req);
  325. Handle_SetLocalVideoVolume(ctx);
  326. }
  327. break;
  328. case PlayService_Method_GetLocalAudioVolume:
  329. {
  330. SpReqAnsContext<PlayService_GetLocalAudioVolume_Req,PlayService_GetLocalAudioVolume_Ans>::Pointer ctx;
  331. ctx.Attach(new SpReqAnsContext<PlayService_GetLocalAudioVolume_Req,PlayService_GetLocalAudioVolume_Ans>(pTransactionContext));
  332. SpBuffer2Object(Buf, ctx->Req);
  333. Handle_GetLocalAudioVolume(ctx);
  334. }
  335. break;
  336. case PlayService_Method_SetLocalAudioVolume:
  337. {
  338. SpReqAnsContext<PlayService_SetLocalAudioVolume_Req,PlayService_SetLocalAudioVolume_Ans>::Pointer ctx;
  339. ctx.Attach(new SpReqAnsContext<PlayService_SetLocalAudioVolume_Req,PlayService_SetLocalAudioVolume_Ans>(pTransactionContext));
  340. SpBuffer2Object(Buf, ctx->Req);
  341. Handle_SetLocalAudioVolume(ctx);
  342. }
  343. break;
  344. case PlayService_Method_StartPlayNotice:
  345. {
  346. SpReqAnsContext<PlayService_StartPlayNotice_Req,PlayService_StartPlayNotice_Ans>::Pointer ctx;
  347. ctx.Attach(new SpReqAnsContext<PlayService_StartPlayNotice_Req,PlayService_StartPlayNotice_Ans>(pTransactionContext));
  348. SpBuffer2Object(Buf, ctx->Req);
  349. Handle_StartPlayNotice(ctx);
  350. }
  351. break;
  352. case PlayService_Method_StopPlayNotice:
  353. {
  354. SpReqAnsContext<PlayService_StopPlayNotice_Req,PlayService_StopPlayNotice_Ans>::Pointer ctx;
  355. ctx.Attach(new SpReqAnsContext<PlayService_StopPlayNotice_Req,PlayService_StopPlayNotice_Ans>(pTransactionContext));
  356. SpBuffer2Object(Buf, ctx->Req);
  357. Handle_StopPlayNotice(ctx);
  358. }
  359. break;
  360. case PlayService_Method_StopPlayAllMedias:
  361. {
  362. SpReqAnsContext<PlayService_StopPlayAllMedias_Req,PlayService_StopPlayAllMedias_Ans>::Pointer ctx;
  363. ctx.Attach(new SpReqAnsContext<PlayService_StopPlayAllMedias_Req,PlayService_StopPlayAllMedias_Ans>(pTransactionContext));
  364. SpBuffer2Object(Buf, ctx->Req);
  365. Handle_StopPlayAllMedias(ctx);
  366. }
  367. break;
  368. default:
  369. assert(0);
  370. break;
  371. }
  372. } else {
  373. pTransactionContext->SendAnswer(Error);
  374. }
  375. }
  376. };
  377. ///////////////////////////
  378. } // namespace LocalMediaPlay
  379. #endif // __LOCALMEDIAPLAY_SERVER_G_H