feat: wire HarmonyOS entry module to native napi skeleton
This commit is contained in:
1 parent
6c99ae75f6
commit
06f4a95020
3 files changed
+65
No files matched your search
@@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"apiType": "stageMode",
|
||||||
|
"buildOption": {
|
||||||
|
"externalNativeOptions": {
|
||||||
|
"path": "src/main/cpp/CMakeLists.txt",
|
||||||
|
"arguments": "",
|
||||||
|
"cppFlags": "-std=c++17"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
import nativeMrp from 'libmrp_napi.so';
|
||||||
|
|
||||||
|
export function smokeTestNativeInit(): boolean {
|
||||||
|
const result = nativeMrp.init({
|
||||||
|
workDir: '/data/storage/el2/base/files/mrp',
|
||||||
|
width: 240,
|
||||||
|
height: 320,
|
||||||
|
debug: true,
|
||||||
|
});
|
||||||
|
return !!result?.ok;
|
||||||
|
}
|
||||||
Vendored
+44
@@ -0,0 +1,44 @@
|
|||||||
|
declare module 'libmrp_napi.so' {
|
||||||
|
export function init(options: {
|
||||||
|
workDir: string;
|
||||||
|
width: number;
|
||||||
|
height: number;
|
||||||
|
debug?: boolean;
|
||||||
|
}): {
|
||||||
|
ok: boolean;
|
||||||
|
errorCode?: number;
|
||||||
|
errorMessage?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export function loadPackage(packagePath: string): {
|
||||||
|
ok: boolean;
|
||||||
|
errorCode?: number;
|
||||||
|
errorMessage?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export function start(): { ok: boolean; errorCode?: number; errorMessage?: string };
|
||||||
|
export function pause(): { ok: boolean; errorCode?: number; errorMessage?: string };
|
||||||
|
export function resume(): { ok: boolean; errorCode?: number; errorMessage?: string };
|
||||||
|
export function sendInput(event: {
|
||||||
|
type: 'key' | 'touch';
|
||||||
|
action: 'down' | 'up' | 'move';
|
||||||
|
keyCode?: number;
|
||||||
|
x?: number;
|
||||||
|
y?: number;
|
||||||
|
timestamp?: number;
|
||||||
|
}): { ok: boolean; errorCode?: number; errorMessage?: string };
|
||||||
|
|
||||||
|
export function pullFrame(): {
|
||||||
|
ok: boolean;
|
||||||
|
hasNewFrame: boolean;
|
||||||
|
width: number;
|
||||||
|
height: number;
|
||||||
|
pixelFormat: 'RGBA_8888';
|
||||||
|
buffer?: ArrayBuffer;
|
||||||
|
frameId?: number;
|
||||||
|
errorCode?: number;
|
||||||
|
errorMessage?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export function release(): { ok: boolean; errorCode?: number; errorMessage?: string };
|
||||||
|
}
|
||||||
Reference in new issue
Block a user