modulecomm_shm.cpp 1.2 KB

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