CarLinkWrapper.cpp 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. #ifndef CARLINKWRAPPER_H
  2. #define CARLINKWRAPPER_H
  3. #include "CarLinkWrapper.h"
  4. #include "CarLinkPlayer.h"
  5. #include "LinkBase.h"
  6. #ifdef __cplusplus
  7. extern "C" {
  8. #endif
  9. void* GetInstance()
  10. {
  11. return new CarLinkPlayer();
  12. }
  13. void InitCarLinkPlayer(void *handle)
  14. {
  15. static_cast<CarLinkPlayer *>(handle)->initialize();
  16. }
  17. void RegisterUsbState(void *handle, void(*pUsbStateCallback)(int,int))
  18. {
  19. static_cast<CarLinkPlayer *>(handle)->registerUsbState(pUsbStateCallback);
  20. }
  21. void RegisterAppStatus(void *handle, void(*pAppStatusCallback)(int,void*))
  22. {
  23. static_cast<CarLinkPlayer *>(handle)->registerAppStatus(pAppStatusCallback);
  24. }
  25. void Start(void *handle, int linkType, int linkMode)
  26. {
  27. static_cast<CarLinkPlayer *>(handle)->Start(LinkType(linkType), (LinkMode)linkMode);
  28. }
  29. void ReleaseInstance(void *handle)
  30. {
  31. static_cast<CarLinkPlayer *>(handle)->Stop();
  32. }
  33. void SetBackground(void *handle)
  34. {
  35. static_cast<CarLinkPlayer *>(handle)->UIPlayer()->SetBackground();
  36. }
  37. void SetForeground(void *handle)
  38. {
  39. static_cast<CarLinkPlayer *>(handle)->UIPlayer()->SetForeground();
  40. }
  41. void Touch(void *handle, int x, int y, int pressed)
  42. {
  43. static_cast<CarLinkPlayer *>(handle)->UIPlayer()->SendTouch(x, y, (TouchCode)pressed);
  44. }
  45. void Key(void *handle, int key)
  46. {
  47. static_cast<CarLinkPlayer *>(handle)->UIPlayer()->SendKey((KeyCode)key);
  48. }
  49. void Wheel(void *handle, int wheelCode, bool bFoucs)
  50. {
  51. static_cast<CarLinkPlayer *>(handle)->UIPlayer()->SendWheel((WheelCode)wheelCode, bFoucs);
  52. }
  53. void OpenPage(void *handle, int appPage)
  54. {
  55. static_cast<CarLinkPlayer *>(handle)->UIPlayer()->OpenPage((AppPage)appPage);
  56. }
  57. void SendCarBluetooth(void *handle,char* name, char* address, char* pin)
  58. {
  59. static_cast<CarLinkPlayer *>(handle)->UIPlayer()->SendCarBluetooth(name, address, pin);
  60. }
  61. void SendPhoneBluetooth(void *handle, char* address)
  62. {
  63. static_cast<CarLinkPlayer *>(handle)->UIPlayer()->SendPhoneBluetooth(address);
  64. }
  65. void SendIphoneMacAddress(void *handle, char* address)
  66. {
  67. static_cast<CarLinkPlayer *>(handle)->UIPlayer()->SendIphoneMacAddress(address);
  68. }
  69. void SendCarWifi(void *handle, char* ssid, char* passphrase, char* channel_id)
  70. {
  71. WifiInfo info = {ssid, passphrase, channel_id};
  72. static_cast<CarLinkPlayer *>(handle)->UIPlayer()->SendCarWifi(info);
  73. }
  74. #ifdef __cplusplus
  75. }
  76. #endif
  77. #endif