HarmonyOS platform packages for MoonOHOS native modules: HiLog, RawFile, task cancellation, XComponent surfaces with Native Drawing and OpenGL ES, and 16 sys/* packages generated from SDK headers (617 functions: display, sensors, drawing, GLES, battery, HiTrace, ...).
| Package | Purpose | NDK library |
|---|---|---|
| shop1111/moonohos_ohos/hilog | Logger::new(domain, tag) with debug/info/warn/error/fatal; messages are passed as a %{public}s argument, never as the format string | libhilog_ndk.z.so |
| shop1111/moonohos_ohos/rawfile | read, read_text, list for packaged resources/rawfile files through a borrowed Manager (adapted from ArkTS resourceManager) | librawfile.z.so |
| shop1111/moonohos_ohos/task | cancelled() / check() observe the CancelToken of the running MoonOHOS async task | — |
| shop1111/moonohos_ohos/deviceinfo | get(field), snapshot(), sdk_api_version(): device type, brand, model, OS name and version (deviceinfo.h) | libdeviceinfo_ndk.z.so |
| shop1111/moonohos_ohos/netconn | has_default_network(), is_metered(); needs ohos.permission.GET_NETWORK_INFO | libnet_connection.so |
| shop1111/moonohos_ohos/vibrator | vibrate(ms, usage=Touch), cancel(); needs ohos.permission.VIBRATE | libohvibrator.z.so |
| shop1111/moonohos_ohos/surface | Surface::open(surface_id) for an ArkUI XComponent, present/present_canvas of RGBA 8888 pixels, draw(canvas => ...) with a sys/drawing canvas bound to the window buffer, VSync::request_frame(callback) on the VSync thread (through the MoonOHOS gate), and a host-testable Canvas (0.9, docs/XCOMPONENT.md) | libnative_window.so, libnative_vsync.so, libnative_drawing.so |
| shop1111/moonohos_ohos/gl | GlSurface::open(surface_id) creates an EGL window surface and an OpenGL ES 3 context; frame((w, h) => ...) makes it current on the calling thread, sets the viewport, swaps and releases it. Helpers for the GL calls that take pointers (shader_source, link_program, gen_buffer, buffer_data_floats, vertex_attrib_pointer, uniform_matrix, read_pixels, get_integers) and common GL_* constants (0.9, docs/XCOMPONENT.md) | libnative_window.so, libEGL.so, libGLESv3.so |
let (x, y) = @display.get_display_position(@display.get_default_display_id())
let zone = @timeservice.get_time_zone()
let listener = @display.register_display_change_listener(id => println(id))/// Counts packaged documents on a worker thread, logging progress.
pub fn count_documents(resources : @rawfile.Manager, dir : String) -> Int raise {
let log = @hilog.Logger::new(0x4d4f, "MySearch")
let mut characters = 0
for name in @rawfile.list(resources, dir) {
@task.check()
characters += @rawfile.read_text(resources, dir + "/" + name).length()
}
log.info("indexed " + dir + ": " + characters.to_string() + " characters")
characters
}Install
Download zipHarmonyOS platform packages for MoonOHOS native modules: HiLog, RawFile, task cancellation, XComponent surfaces with Native Drawing and OpenGL ES, and 16 sys/* packages generated from SDK headers (617 functions: display, sensors, drawing, GLES, battery, HiTrace, ...).