modulecomm_inter.cpp 1.3 KB

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