mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-03-12 00:45:28 +00:00
rename the api header files
This commit is contained in:
parent
d886f1a4d0
commit
983209854c
|
@ -34,100 +34,6 @@
|
|||
|
||||
/*char *wa_strdup(const char *);*/
|
||||
|
||||
/*
|
||||
* request/response interfaces
|
||||
*/
|
||||
|
||||
bool
|
||||
wasm_response_send(wasm_exec_env_t exec_env,
|
||||
int32 buffer_offset, int size);
|
||||
void
|
||||
wasm_register_resource(wasm_exec_env_t exec_env,
|
||||
int32 url_offset);
|
||||
void
|
||||
wasm_post_request(wasm_exec_env_t exec_env,
|
||||
int32 buffer_offset, int size);
|
||||
void
|
||||
wasm_sub_event(wasm_exec_env_t exec_env,
|
||||
int32 url_offset);
|
||||
|
||||
/*
|
||||
* sensor interfaces
|
||||
*/
|
||||
|
||||
bool
|
||||
wasm_sensor_config(wasm_exec_env_t exec_env,
|
||||
uint32 sensor, int interval, int bit_cfg, int delay);
|
||||
uint32
|
||||
wasm_sensor_open(wasm_exec_env_t exec_env,
|
||||
int32 name_offset, int instance);
|
||||
bool
|
||||
wasm_sensor_config_with_attr_container(wasm_exec_env_t exec_env,
|
||||
uint32 sensor,
|
||||
int32 buffer_offset, int len);
|
||||
bool
|
||||
wasm_sensor_close(wasm_exec_env_t exec_env,
|
||||
uint32 sensor);
|
||||
|
||||
/*
|
||||
* timer interfaces
|
||||
*/
|
||||
|
||||
typedef unsigned int timer_id_t;
|
||||
|
||||
timer_id_t
|
||||
wasm_create_timer(wasm_exec_env_t exec_env,
|
||||
int interval, bool is_period, bool auto_start);
|
||||
void
|
||||
wasm_timer_destroy(wasm_exec_env_t exec_env, timer_id_t timer_id);
|
||||
void
|
||||
wasm_timer_cancel(wasm_exec_env_t exec_env, timer_id_t timer_id);
|
||||
void
|
||||
wasm_timer_restart(wasm_exec_env_t exec_env,
|
||||
timer_id_t timer_id, int interval);
|
||||
uint32
|
||||
wasm_get_sys_tick_ms(wasm_exec_env_t exec_env);
|
||||
|
||||
/*
|
||||
* connection interfaces
|
||||
*/
|
||||
|
||||
uint32
|
||||
wasm_open_connection(wasm_exec_env_t exec_env,
|
||||
int32 name_offset, int32 args_offset, uint32 len);
|
||||
void
|
||||
wasm_close_connection(wasm_exec_env_t exec_env,
|
||||
uint32 handle);
|
||||
int
|
||||
wasm_send_on_connection(wasm_exec_env_t exec_env,
|
||||
uint32 handle, int32 data_offset, uint32 len);
|
||||
bool
|
||||
wasm_config_connection(wasm_exec_env_t exec_env,
|
||||
uint32 handle, int32 cfg_offset, uint32 len);
|
||||
|
||||
/**
|
||||
* gui interfaces
|
||||
*/
|
||||
|
||||
void
|
||||
wasm_obj_native_call(wasm_exec_env_t exec_env,
|
||||
int32 func_id, uint32 argv_offset, uint32 argc);
|
||||
|
||||
void
|
||||
wasm_btn_native_call(wasm_exec_env_t exec_env,
|
||||
int32 func_id, uint32 argv_offset, uint32 argc);
|
||||
|
||||
void
|
||||
wasm_label_native_call(wasm_exec_env_t exec_env,
|
||||
int32 func_id, uint32 argv_offset, uint32 argc);
|
||||
|
||||
void
|
||||
wasm_cb_native_call(wasm_exec_env_t exec_env,
|
||||
int32 func_id, uint32 argv_offset, uint32 argc);
|
||||
|
||||
void
|
||||
wasm_list_native_call(wasm_exec_env_t exec_env,
|
||||
int32 func_id, uint32 argv_offset, uint32 argc);
|
||||
|
||||
#endif /* end of _NATIVE_INTERFACE_H */
|
||||
|
||||
|
|
|
@ -7,7 +7,9 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "lib_export.h"
|
||||
#include "base_lib_export.h"
|
||||
#include "req_resp_native_api.h"
|
||||
#include "timer_native_api.h"
|
||||
|
||||
|
||||
static NativeSymbol extended_native_symbol_defs[] = {
|
||||
/* TODO: use macro EXPORT_WASM_API() or EXPORT_WASM_API2() to
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
*/
|
||||
|
||||
#ifndef _BASE_LIB_EXPORT_H_
|
||||
#define _BASE_LIB_EXPORT_H_
|
||||
|
||||
#include "bi-inc/attr_container.h"
|
||||
#include "native_interface.h"
|
||||
|
||||
#endif /* end of _BASE_LIB_EXPORT_H_ */
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
*/
|
||||
|
||||
#ifndef _REQ_RESP_API_H_
|
||||
#define _REQ_RESP_API_H_
|
||||
|
||||
#include "bh_platform.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
bool
|
||||
wasm_response_send(int32 buf_offset, int size);
|
||||
|
||||
void
|
||||
wasm_register_resource(int32 url_offset);
|
||||
|
||||
void
|
||||
wasm_post_request(int32 buf_offset, int size);
|
||||
|
||||
void
|
||||
wasm_sub_event(int32 url_offset);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* end of _REQ_RESP_API_H_ */
|
||||
|
36
core/app-framework/base/native/req_resp_native_api.h
Normal file
36
core/app-framework/base/native/req_resp_native_api.h
Normal file
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
*/
|
||||
|
||||
#ifndef _REQ_RESP_API_H_
|
||||
#define _REQ_RESP_API_H_
|
||||
|
||||
#include "bh_platform.h"
|
||||
#include "wasm_export.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
bool
|
||||
wasm_response_send(wasm_exec_env_t exec_env,
|
||||
int32 buffer_offset, int size);
|
||||
void
|
||||
wasm_register_resource(wasm_exec_env_t exec_env,
|
||||
int32 url_offset);
|
||||
void
|
||||
wasm_post_request(wasm_exec_env_t exec_env,
|
||||
int32 buffer_offset, int size);
|
||||
void
|
||||
wasm_sub_event(wasm_exec_env_t exec_env,
|
||||
int32 url_offset);
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* end of _REQ_RESP_API_H_ */
|
||||
|
|
@ -1,37 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
*/
|
||||
|
||||
#ifndef _TIMER_API_H_
|
||||
#define _TIMER_API_H_
|
||||
|
||||
#include "bh_platform.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef unsigned int timer_id_t;
|
||||
|
||||
timer_id_t
|
||||
wasm_create_timer(int interval, bool is_period, bool auto_start);
|
||||
|
||||
void
|
||||
wasm_timer_destroy(timer_id_t timer_id);
|
||||
|
||||
void
|
||||
wasm_timer_cancel(timer_id_t timer_id);
|
||||
|
||||
void
|
||||
wasm_timer_restart(timer_id_t timer_id, int interval);
|
||||
|
||||
uint32
|
||||
wasm_get_sys_tick_ms(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* end of _TIMER_API_H_ */
|
||||
|
43
core/app-framework/base/native/timer_native_api.h
Normal file
43
core/app-framework/base/native/timer_native_api.h
Normal file
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
*/
|
||||
|
||||
#ifndef _TIMER_API_H_
|
||||
#define _TIMER_API_H_
|
||||
|
||||
#include "bh_platform.h"
|
||||
#include "wasm_export.h"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef unsigned int timer_id_t;
|
||||
|
||||
/*
|
||||
* timer interfaces
|
||||
*/
|
||||
|
||||
typedef unsigned int timer_id_t;
|
||||
|
||||
timer_id_t
|
||||
wasm_create_timer(wasm_exec_env_t exec_env,
|
||||
int interval, bool is_period, bool auto_start);
|
||||
void
|
||||
wasm_timer_destroy(wasm_exec_env_t exec_env, timer_id_t timer_id);
|
||||
void
|
||||
wasm_timer_cancel(wasm_exec_env_t exec_env, timer_id_t timer_id);
|
||||
void
|
||||
wasm_timer_restart(wasm_exec_env_t exec_env,
|
||||
timer_id_t timer_id, int interval);
|
||||
uint32
|
||||
wasm_get_sys_tick_ms(wasm_exec_env_t exec_env);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* end of _TIMER_API_H_ */
|
||||
|
|
@ -9,6 +9,7 @@
|
|||
#include "bh_list.h"
|
||||
#include "bh_thread.h"
|
||||
#include "bh_time.h"
|
||||
#include "timer_native_api.h"
|
||||
|
||||
static bool timer_thread_run = true;
|
||||
|
||||
|
|
|
@ -1,32 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
*/
|
||||
|
||||
#ifndef CONNECTION_API_H_
|
||||
#define CONNECTION_API_H_
|
||||
|
||||
#include "bh_platform.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
uint32
|
||||
wasm_open_connection(int32 name_offset, int32 args_buf_offset, uint32 args_buf_len);
|
||||
|
||||
void
|
||||
wasm_close_connection(uint32 handle);
|
||||
|
||||
int
|
||||
wasm_send_on_connection(uint32 handle, int32 data_offset, uint32 data_len);
|
||||
|
||||
bool
|
||||
wasm_config_connection(uint32 handle, int32 cfg_buf_offset, uint32 cfg_buf_len);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* end of CONNECTION_API_H_ */
|
41
core/app-framework/connection/native/connection_native_api.h
Normal file
41
core/app-framework/connection/native/connection_native_api.h
Normal file
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
*/
|
||||
|
||||
#ifndef CONNECTION_API_H_
|
||||
#define CONNECTION_API_H_
|
||||
|
||||
#include "bh_platform.h"
|
||||
#include "wasm_export.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* connection interfaces
|
||||
*/
|
||||
|
||||
uint32
|
||||
wasm_open_connection(wasm_exec_env_t exec_env,
|
||||
int32 name_offset, int32 args_offset, uint32 len);
|
||||
void
|
||||
wasm_close_connection(wasm_exec_env_t exec_env,
|
||||
uint32 handle);
|
||||
int
|
||||
wasm_send_on_connection(wasm_exec_env_t exec_env,
|
||||
uint32 handle, int32 data_offset, uint32 len);
|
||||
bool
|
||||
wasm_config_connection(wasm_exec_env_t exec_env,
|
||||
uint32 handle, int32 cfg_offset, uint32 len);
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* end of CONNECTION_API_H_ */
|
|
@ -6,6 +6,8 @@
|
|||
#include "connection_lib.h"
|
||||
#include "wasm_export.h"
|
||||
#include "native_interface.h"
|
||||
#include "connection_native_api.h"
|
||||
|
||||
|
||||
/* Note:
|
||||
*
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
*/
|
||||
|
||||
#include "wa-inc/sensor.h"
|
||||
|
||||
#include "sensor_api.h"
|
||||
|
||||
typedef struct _sensor {
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "bh_platform.h"
|
||||
#include "bi-inc/attr_container.h"
|
||||
#include "wasm_export.h"
|
||||
#include "sensor_native_api.h"
|
||||
|
||||
struct _sys_sensor;
|
||||
typedef struct _sys_sensor* sensor_obj_t;
|
||||
|
@ -50,20 +51,10 @@ void sensor_cleanup_callback(uint32 module_id);
|
|||
int check_sensor_timers();
|
||||
void reschedule_sensor_read();
|
||||
|
||||
uint32
|
||||
wasm_sensor_open(wasm_exec_env_t exec_env,
|
||||
int32 name_offset, int instance);
|
||||
void init_sensor_framework();
|
||||
void start_sensor_framework();
|
||||
void exit_sensor_framework();
|
||||
|
||||
bool
|
||||
wasm_sensor_config(wasm_exec_env_t exec_env,
|
||||
uint32 sensor, int interval, int bit_cfg, int delay);
|
||||
|
||||
bool
|
||||
wasm_sensor_config_with_attr_container(wasm_exec_env_t exec_env,
|
||||
uint32 sensor, int32 buffer_offset,
|
||||
int len);
|
||||
|
||||
bool
|
||||
wasm_sensor_close(wasm_exec_env_t exec_env, uint32 sensor);
|
||||
|
||||
#endif /* LIB_EXTENSION_RUNTIME_SENSOR_H_ */
|
||||
|
|
|
@ -1,32 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
*/
|
||||
|
||||
#ifndef _SENSOR_API_H_
|
||||
#define _SENSOR_API_H_
|
||||
|
||||
#include "bh_platform.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
uint32
|
||||
wasm_sensor_open(int32 name_offset, int instance);
|
||||
|
||||
bool
|
||||
wasm_sensor_config(uint32 sensor, int interval, int bit_cfg, int delay);
|
||||
|
||||
bool
|
||||
wasm_sensor_config_with_attr_container(uint32 sensor, int32 buffer_offset, int len);
|
||||
|
||||
bool
|
||||
wasm_sensor_close(uint32 sensor);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* end of _SENSOR_API_H_ */
|
||||
|
|
@ -84,21 +84,6 @@ void app_mgr_sensor_event_callback(module_data *m_data, bh_message_t msg)
|
|||
}
|
||||
}
|
||||
|
||||
static attr_container_t * read_test_sensor(void * sensor)
|
||||
{
|
||||
//luc: for test
|
||||
attr_container_t *attr_obj = attr_container_create("read test sensor data");
|
||||
if (attr_obj) {
|
||||
attr_container_set_string(&attr_obj, "name", "read test sensor");
|
||||
return attr_obj;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static bool config_test_sensor(void * s, void * config)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
static void thread_sensor_check(void * arg)
|
||||
{
|
||||
|
@ -122,13 +107,9 @@ void set_sensor_reshceduler(void (*callback)());
|
|||
void init_sensor_framework()
|
||||
{
|
||||
// init the mutext and conditions
|
||||
korp_thread tid;
|
||||
vm_cond_init(&cond);
|
||||
vm_mutex_init(&mutex);
|
||||
|
||||
// add the sys sensor objects
|
||||
add_sys_sensor("sensor_test", "This is a sensor for test", 0, 1000,
|
||||
read_test_sensor, config_test_sensor);
|
||||
|
||||
set_sensor_reshceduler(cb_wakeup_thread);
|
||||
|
||||
|
@ -137,12 +118,25 @@ void init_sensor_framework()
|
|||
|
||||
wasm_register_cleanup_callback(sensor_cleanup_callback);
|
||||
|
||||
vm_thread_create(&tid, (void *)thread_sensor_check, NULL,
|
||||
BH_APPLET_PRESERVED_STACK_SIZE);
|
||||
|
||||
}
|
||||
|
||||
void start_sensor_framework()
|
||||
{
|
||||
korp_thread tid;
|
||||
|
||||
vm_thread_create(&tid,
|
||||
(void *)thread_sensor_check,
|
||||
NULL,
|
||||
BH_APPLET_PRESERVED_STACK_SIZE);
|
||||
}
|
||||
|
||||
|
||||
void exit_sensor_framework()
|
||||
{
|
||||
sensor_check_thread_run = false;
|
||||
reschedule_sensor_read();
|
||||
|
||||
//todo: wait the sensor thread termination
|
||||
}
|
||||
|
||||
|
|
37
core/app-framework/sensor/native/sensor_native_api.h
Normal file
37
core/app-framework/sensor/native/sensor_native_api.h
Normal file
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
*/
|
||||
|
||||
#ifndef _SENSOR_NATIVE_API_H_
|
||||
#define _SENSOR_NATIVE_API_H_
|
||||
|
||||
#include "bh_platform.h"
|
||||
#include "wasm_export.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
bool
|
||||
wasm_sensor_config(wasm_exec_env_t exec_env,
|
||||
uint32 sensor, int interval,
|
||||
int bit_cfg, int delay);
|
||||
uint32
|
||||
wasm_sensor_open(wasm_exec_env_t exec_env,
|
||||
int32 name_offset, int instance);
|
||||
|
||||
bool
|
||||
wasm_sensor_config_with_attr_container(wasm_exec_env_t exec_env,
|
||||
uint32 sensor, int32 buffer_offset,
|
||||
int len);
|
||||
|
||||
bool
|
||||
wasm_sensor_close(wasm_exec_env_t exec_env, uint32 sensor);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* end of _SENSOR_NATIVE_API_H_ */
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
*/
|
||||
|
||||
#ifndef _GUI_API_H_
|
||||
#define _GUI_API_H_
|
||||
|
||||
#include "bh_platform.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void
|
||||
wasm_obj_native_call(int32 func_id, int32 argv_offset, uint32 argc);
|
||||
|
||||
void
|
||||
wasm_btn_native_call(int32 func_id, int32 argv_offset, uint32 argc);
|
||||
|
||||
void
|
||||
wasm_label_native_call(int32 func_id, int32 argv_offset, uint32 argc);
|
||||
|
||||
void
|
||||
wasm_cb_native_call(int32 func_id, int32 argv_offset, uint32 argc);
|
||||
|
||||
void
|
||||
wasm_list_native_call(int32 func_id, int32 argv_offset, uint32 argc);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* end of _GUI_API_H_ */
|
46
core/app-framework/wgl/native/gui_native_api.h
Normal file
46
core/app-framework/wgl/native/gui_native_api.h
Normal file
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
*/
|
||||
|
||||
#ifndef _GUI_API_H_
|
||||
#define _GUI_API_H_
|
||||
|
||||
#include "bh_platform.h"
|
||||
#include "wasm_export.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* gui interfaces
|
||||
*/
|
||||
|
||||
void
|
||||
wasm_obj_native_call(wasm_exec_env_t exec_env,
|
||||
int32 func_id, uint32 argv_offset, uint32 argc);
|
||||
|
||||
void
|
||||
wasm_btn_native_call(wasm_exec_env_t exec_env,
|
||||
int32 func_id, uint32 argv_offset, uint32 argc);
|
||||
|
||||
void
|
||||
wasm_label_native_call(wasm_exec_env_t exec_env,
|
||||
int32 func_id, uint32 argv_offset, uint32 argc);
|
||||
|
||||
void
|
||||
wasm_cb_native_call(wasm_exec_env_t exec_env,
|
||||
int32 func_id, uint32 argv_offset, uint32 argc);
|
||||
|
||||
void
|
||||
wasm_list_native_call(wasm_exec_env_t exec_env,
|
||||
int32 func_id, uint32 argv_offset, uint32 argc);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* end of _GUI_API_H_ */
|
|
@ -1,7 +1,7 @@
|
|||
#include "lib_export.h"
|
||||
#include "sensor_api.h"
|
||||
#include "connection_api.h"
|
||||
#include "gui_api.h"
|
||||
#include "sensor_native_api.h"
|
||||
#include "connection_native_api.h"
|
||||
#include "gui_native_api.h"
|
||||
|
||||
static NativeSymbol extended_native_symbol_defs[] = {
|
||||
#include "runtime_sensor.inl"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "lib_export.h"
|
||||
#include "sensor_api.h"
|
||||
#include "connection_api.h"
|
||||
#include "sensor_native_api.h"
|
||||
#include "connection_native_api.h"
|
||||
#include "display_indev.h"
|
||||
|
||||
static NativeSymbol extended_native_symbol_defs[] = {
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#include "lib_export.h"
|
||||
#include "sensor_api.h"
|
||||
#include "connection_api.h"
|
||||
#include "sensor_native_api.h"
|
||||
#include "timer_native_api.h"
|
||||
#include "req_resp_native_api.h"
|
||||
#include "connection_native_api.h"
|
||||
|
||||
static NativeSymbol extended_native_symbol_defs[] = {
|
||||
#include "runtime_sensor.inl"
|
||||
|
|
|
@ -354,6 +354,25 @@ static host_interface interface = { .send = uart_send, .destroy = uart_destroy }
|
|||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
static attr_container_t * read_test_sensor(void * sensor)
|
||||
{
|
||||
//luc: for test
|
||||
attr_container_t *attr_obj = attr_container_create("read test sensor data");
|
||||
if (attr_obj) {
|
||||
attr_container_set_string(&attr_obj, "name", "read test sensor");
|
||||
return attr_obj;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static bool config_test_sensor(void * s, void * config)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
static char global_heap_buf[1024 * 1024] = { 0 };
|
||||
|
||||
static void showUsage()
|
||||
|
@ -458,15 +477,34 @@ int iwasm_main(int argc, char *argv[])
|
|||
goto fail1;
|
||||
}
|
||||
|
||||
//
|
||||
// timer manager
|
||||
//
|
||||
init_wasm_timer();
|
||||
|
||||
|
||||
//
|
||||
// connection framework
|
||||
//
|
||||
if (!init_connection_framework()) {
|
||||
vm_thread_sys_destroy();
|
||||
goto fail1;
|
||||
}
|
||||
|
||||
//
|
||||
// sensor framework
|
||||
//
|
||||
init_sensor_framework();
|
||||
// add the sys sensor objects
|
||||
add_sys_sensor("sensor_test",
|
||||
"This is a sensor for test",
|
||||
0,
|
||||
1000,
|
||||
read_test_sensor,
|
||||
config_test_sensor);
|
||||
start_sensor_framework();
|
||||
|
||||
|
||||
// timer manager
|
||||
init_wasm_timer();
|
||||
|
||||
#ifndef CONNECTION_UART
|
||||
if (server_mode)
|
||||
|
|
Loading…
Reference in New Issue
Block a user