You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
1.3 KiB

/*
* Copyright (c) Hisilicon Technologies Co., Ltd.. 2012-2019. All rights reserved.
* Description:
* Author:
* Create:
*/
#ifndef TVCLIENT_H
#define TVCLIENT_H
#include <binder/IMemory.h>
#include <utils/KeyedVector.h>
#include <android/native_window.h>
#include <utils/String8.h>
#include <hwbinder/Parcel.h>
#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<ANativeWindow> &surface);
private:
sp<ITVClientCallback> mCallback;
Mutex mNotifyLock;
Mutex mSetLock;
sp<HwTVListener> mHwListener;
};
inline void TVClient::unregistCallback(ITVClientCallback *const callback)
{
if (mCallback.get() == callback) {
mCallback = nullptr;
}
}
}; // namespace android
#endif // __TVCLIENT_H__