-
Notifications
You must be signed in to change notification settings - Fork 1.1k
AliOS Things API YLOOP Guide
- 1 aos_register_event_filter
- 2 aos_unregister_event_filter
- 3 aos_post_event
- 4 aos_poll_read_fd
- 5 aos_cancel_poll_read_fd
- 6 aos_post_delayed_action
- 7 aos_cancel_delayed_action
- 8 aos_schedule_call
- 9 aos_loop_init
- 10 aos_current_loop
- 11 aos_loop_run
- 12 aos_loop_exit
- 13 aos_loop_destroy
- 14 aos_loop_schedule_call
- 15 aos_loop_schedule_work
- 16 aos_cancel_work
int aos_register_event_filter(uint16_t type, aos_event_cb cb, void *priv)
-
Description
Register system event filter callback.
-
Parameters
IN/OUT NAME DESC [in] type event type interested. [in] cb system event callback. [in] priv private data past to cb. -
Returns
the operation status, 0 is OK, others is error.
int aos_unregister_event_filter(uint16_t type, aos_event_cb cb, void *priv)
-
Description
Unregister native event callback.
-
Parameters
IN/OUT NAME DESC [in] type event type interested. [in] cb system event callback. [in] priv private data past to cb. -
Returns
the operation status, 0 is OK, others is error.
int aos_post_event(uint16_t type, uint16_t code, unsigned long value)
-
Description
Post local event.
-
Parameters
IN/OUT NAME DESC [in] type event type. [in] code event code. [in] value event value. -
Returns
the operation status, 0 is OK,others is error.
int aos_poll_read_fd(int fd, aos_poll_call_t action, void *param)
-
Description
Register a poll event in main loop.
-
Parameters
IN/OUT NAME DESC [in] fd poll fd. [in] action action to be executed. [in] param private data past to action. -
Returns
the operation status, 0 is OK,others is error.
void aos_cancel_poll_read_fd(int fd, aos_poll_call_t action, void *param)
-
Description
Cancel a poll event to be executed in main loop.
-
Parameters
IN/OUT NAME DESC [in] fd poll fd. [in] action action to be executed. [in] param private data past to action. -
Returns
None.
int aos_post_delayed_action(int ms, aos_call_t action, void *arg)
-
Description
Post a delayed action to be executed in main loop.
-
Parameters
IN/OUT NAME DESC [in] ms milliseconds to wait. [in] action action to be executed. [in] arg private data past to action. -
Returns
the operation status, 0 is OK,others is error.
void aos_cancel_delayed_action(int ms, aos_call_t action, void *arg)
-
Description
Cancel a delayed action to be executed in main loop.
-
Parameters
IN/OUT NAME DESC [in] ms milliseconds to wait, -1 means don't care. [in] action action to be executed. [in] arg private data past to action. -
Returns
None.
int aos_schedule_call(aos_call_t action, void *arg)
-
Description
Schedule a callback in next event loop. Unlike aos_post_delayed_action, this function can be called from non-aos-main-loop context.
-
Parameters
IN/OUT NAME DESC [in] action action to be executed. [in] arg private data past to action. -
Returns
the operation status, <0 is error,others is OK.
aos_loop_t aos_loop_init(void)
-
Description
Init a per-task event loop.
-
Parameters
None.
-
Returns
the handler of aos_loop_t,NULL failure,others success.
aos_loop_t aos_current_loop(void)
-
Description
Get current event loop.
-
Parameters
None.
-
Returns
default event loop.
void aos_loop_run(void)
-
Description
Start event loop.
-
Parameters
None.
-
Returns
None.
void aos_loop_exit(void)
-
Description
Exit event loop, aos_loop_run() will return.
-
Parameters
None.
-
Returns
None.
void aos_loop_destroy(void)
-
Description
Free event loop resources.
-
Parameters
None.
-
Returns
None.
int aos_loop_schedule_call(aos_loop_t *loop, aos_call_t action, void *arg)
-
Description
Schedule a callback specified event loop.
-
Parameters
IN/OUT NAME DESC [in] loop event loop to be scheduled, NULL for default main loop. [in] action action to be executed. [in] arg private data past to action. -
Returns
the operation status, <0 is error,others is OK.
void *aos_loop_schedule_work(int ms, aos_call_t action, void *arg1,
aos_call_t fini_cb, void *arg2)
-
Description
Schedule a work to be executed in workqueue.
-
Parameters
IN/OUT NAME DESC [in] ms milliseconds to delay before execution, 0 means immediately. [in] action action to be executed. [in] arg1 private data past to action. [in] fini_cb finish callback to be executed after action is done in current event loop. [in] arg2 data past to fini_cb. -
Returns
work handle,NULL failure,others is OK.
void aos_cancel_work(void *work, aos_call_t action, void *arg1)
-
Description
Cancel a work.
-
Parameters
IN/OUT NAME DESC [in] work work to be cancelled. [in] action action to be executed. [in] arg1 private data past to action. -
Returns
None.
| Home | Tutorial | Hardware | Porting Guide | Utilities | API Reference | Technical Docs | Certification |
Crafted with ❤️ by AliOS Things Team.