/* * Copyright (c) Hisilicon Technologies Co., Ltd.. 2012-2019. All rights reserved. * Description: * Author: * Create: */ #ifndef TVCLIENT_H #define TVCLIENT_H #include #include #include #include #include #include "ITVClient.h" namespace android { class ITVClientCallback : virtual public RefBase { public: virtual void Notify(unsigned int type, const void *data, unsigned int len, const void *prev) = 0; }; class HwTVListener; class TVClient : public BnTVClient { public: TVClient(); ~TVClient() override; status_t connect() const; void registCallback(ITVClientCallback *const callback); void unregistCallback(ITVClientCallback *const callback); status_t invoke(const android::hardware::Parcel &request, android::hardware::Parcel *reply) const; void notify(unsigned int type, const void *data, unsigned int len, const void *prev) override; void SetSurface(const sp &surface); private: sp mCallback; Mutex mNotifyLock; Mutex mSetLock; sp mHwListener; }; inline void TVClient::unregistCallback(ITVClientCallback *const callback) { if (mCallback.get() == callback) { mCallback = nullptr; } } }; // namespace android #endif // __TVCLIENT_H__