Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
62 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#ifndef BASIC_SERVICE | ||
#define BASIC_SERVICE | ||
#include <stdio.h> | ||
#include <utils/RefBase.h> | ||
#include <binder/IInterface.h> | ||
#include <binder/Parcel.h> | ||
#include <binder/IBinder.h> | ||
#include <binder/Binder.h> | ||
#include <binder/ProcessState.h> | ||
#include <binder/IPCThreadState.h> | ||
#include <binder/IServiceManager.h> | ||
|
||
using namespace android; | ||
|
||
class IBasicService: public IInterface { | ||
public: | ||
DECLARE_META_INTERFACE(BasicService); | ||
virtual void sayHello() = 0; | ||
virtual int32_t random() = 0; | ||
}; | ||
|
||
class BnBasicService: public BnInterface<IBasicService> { | ||
public: | ||
virtual status_t onTransact(uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags = 0); | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,4 @@ | ||
#include "client.h" | ||
|
||
// PLUGIN_EXPORT 宏: 编译的时候不要隐藏该符号,暴露给调用者 | ||
#define PLUGIN_EXPORT __attribute__((visibility("default"))) | ||
|
||
#if defined(__cplusplus) | ||
extern "C" { | ||
#endif | ||
// 暴露给 dart 调用的 c 函数 | ||
PLUGIN_EXPORT void sayHello(); | ||
|
||
#if defined(__cplusplus) | ||
} // extern "C" | ||
#endif | ||
|
||
|
||
void sayHello(){ | ||
Client client = Client::getInstance(); | ||
client.sayHello(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters