IUserLinkPlayer.h 3.5 KB

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