modulecomm_shm.cpp 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #include "modulecomm_shm.h"
  2. #include "procsm_if.h"
  3. #include "procsm.h"
  4. #include <iostream>
  5. namespace iv {
  6. modulecomm_shm::modulecomm_shm()
  7. {
  8. }
  9. void modulecomm_shm::RegisterSend(const char *strcommname, const unsigned int nBufSize, const unsigned int nMsgBufCount)
  10. {
  11. procsm_if * pif = new procsm_if(strcommname,nBufSize,nMsgBufCount,procsm::ModeWrite);
  12. mpif = pif;
  13. }
  14. void modulecomm_shm::RegisterRecv(const char *strcommname, SMCallBack pCall)
  15. {
  16. procsm_if * pif = new procsm_if(strcommname,0,0,procsm::ModeRead);
  17. pif->listenmsg(pCall);
  18. mpif = pif;
  19. }
  20. void modulecomm_shm::RegisterRecvPlus(const char *strcommname, ModuleFun xFun)
  21. {
  22. procsm_if * pif = new procsm_if(strcommname,0,0,procsm::ModeRead);
  23. pif->listenmsg(xFun);
  24. mpif = (void *)pif;
  25. }
  26. void modulecomm_shm::ModuleSendMsg(const char *strdata, const unsigned int nDataLen)
  27. {
  28. procsm_if * pif = (procsm_if *)mpif;
  29. pif->writemsg(strdata,nDataLen);
  30. }
  31. void modulecomm_shm::PauseComm()
  32. {
  33. procsm_if * pif = (procsm_if *)mpif;
  34. pif->pausecomm();
  35. }
  36. void modulecomm_shm::ContintuComm()
  37. {
  38. procsm_if * pif = (procsm_if *)mpif;
  39. pif->continuecomm();
  40. }
  41. void modulecomm_shm::Unregister()
  42. {
  43. procsm_if * pif = (procsm_if *)mpif;
  44. delete pif;
  45. mpif =0;
  46. }
  47. }