IUserLinkPlayer.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. #ifndef IUSERLINKPLAYER_H
  2. #define IUSERLINKPLAYER_H
  3. #ifdef __cplusplus
  4. #include "VideoDecoder.h"
  5. #include "Thread.h"
  6. #include "LinkBase.h"
  7. #include <functional>
  8. using namespace std;
  9. typedef std::function<void (ConnectedStatus, PhoneType)> FUNCCONNECTCALLBACK;
  10. typedef std::function<void (AppStatusMessage, void*)> FUNCAPPSTATUSCALLBACK;
  11. typedef std::function<void (CallType, char*, char*)> FUNCBLUETOOTHPHONECALLBACK;
  12. class CarlifeLink;
  13. class CarplayLink;
  14. class AutoLink;
  15. class EasyConnectLink;
  16. class MirrorLink;
  17. class HiCarLink;
  18. class UsbHostService;
  19. class AudioDecoder;
  20. class LinkAssist;
  21. class IUserLinkPlayer : public LinkBase
  22. {
  23. public:
  24. IUserLinkPlayer();
  25. virtual ~IUserLinkPlayer();
  26. static IUserLinkPlayer *getInstance();
  27. public:
  28. //init link player
  29. bool Initialize(LinkMode linkMode, PhoneType phoneType);
  30. void Release(); //release link player
  31. bool Start();
  32. bool Stop(); //stop link
  33. bool StartMirror();
  34. bool StopMirror();
  35. bool SetBackground(); //set link background run
  36. bool SetForeground(); //set link foreground run
  37. void SetInserted(bool inserted, PhoneType phoneType);
  38. void SendScreenSize(int width, int height);
  39. void SendTouch(int x, int y, TouchCode touchCode);
  40. void SendMultiTouch(int x1, int y1, TouchCode touchCode1,int x2, int y2, TouchCode touchCode2);
  41. void SendKey(KeyCode keyCode);
  42. void SendWheel(WheelCode wheelCode, bool bFoucs);
  43. bool SendNightMode(bool night);
  44. bool SendRightHandDriver(bool right);
  45. void GetIniConfig(LinkAssist *pLinkAssist);
  46. void RegisterConnectCallback(FUNCCONNECTCALLBACK funcConnectCallback);
  47. void RegisterAppStatusCallback(FUNCAPPSTATUSCALLBACK funcAppStatusCallback);
  48. void RegisterBlueToothPhoneCallback(FUNCBLUETOOTHPHONECALLBACK funcBlueToothPhoneCallback);
  49. bool RequestStatus(RequestAppStatus requestAppStatus, void *reserved = nullptr);
  50. void onSdkConnectStatus(ConnectedStatus status, PhoneType type);
  51. bool OpenPage(AppPage appPage);
  52. void SendCarBluetooth(const string& name, const string& address, const string& pin);
  53. void SendPhoneBluetooth(const string& address);
  54. bool SendIphoneMacAddress(string address);
  55. void SendCarWifi(WifiInfo& info);
  56. void SendLisenceCode(const string& license);
  57. void SendInputText(const string& text);
  58. void SendInputSelection(int start, int stop);
  59. void SendInputAction(int action, int keyCode);
  60. void SendBlueToothCmd(const string& cmd);
  61. void SendBroadcast(bool enable);
  62. void SendDelayRecord(int millisecond);
  63. void SendWifiStateChanged(WifiStateAction action, WifiState state, const string& phoneIp, const string& carIp);
  64. protected:
  65. virtual void set_mac(string mac){}
  66. void video_play(const void *data, int32_t len);
  67. void video_start(int offset_x, int offset_y, int width, int height);
  68. void video_stop();
  69. void audio_play(AudioType audioType, const void* data, uint32_t len);
  70. bool audio_start(AudioType audioType, int rate, int bit, int channel);
  71. bool audio_stop(AudioType audioType);
  72. //init recorder devices
  73. void record_start(AudioInfo & audioInfo);
  74. //uninit recorder devices
  75. void record_stop();
  76. //pause or resume record
  77. void record_pause(bool pause);
  78. bool app_status(AppStatusMessage appStatusMessage, void *reserved = nullptr);
  79. bool bt_call_action(CallType callType, const char *name, const char* number);
  80. protected:
  81. FUNCCONNECTCALLBACK mFuncConnectCallback;
  82. FUNCAPPSTATUSCALLBACK mFuncAppStatusCallback;
  83. FUNCBLUETOOTHPHONECALLBACK mFuncBlueToothPhoneCallback;
  84. VideoFrame mVideoFrame;
  85. LinkConfig mLinkConfig;
  86. CarplayConfig mCarplayConfig;
  87. CarlifeConfig mCarlifeConfig;
  88. Mutex mMutexVideo;
  89. bool mConnected;
  90. bool mVideoStart;
  91. private:
  92. IUserLinkPlayer *mpIULPlayer;
  93. AudioDecoder *mpMusicDecoder;
  94. AudioDecoder *mpTTSDecoder;
  95. AudioDecoder *mpVRDecoder;
  96. AudioDecoder *mpCallDecoder;
  97. };
  98. #endif
  99. #endif // IUSERLINKPLAYER_H