Skip to content

AliOS Things API YLOOP Guide

librae8226 edited this page Mar 1, 2018 · 1 revision

API INDEX


1-aos_register_event_filter

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.

2-aos_unregister_event_filter

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.

3-aos_post_event

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.

4-aos_poll_read_fd

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.

5-aos_cancel_poll_read_fd

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.

6-aos_post_delayed_action

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.

7-aos_cancel_delayed_action

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.

8-aos_schedule_call

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.

9-aos_loop_init

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.

10-aos_current_loop

aos_loop_t aos_current_loop(void)
  • Description

    Get current event loop.

  • Parameters

    None.

  • Returns

    default event loop.

11-aos_loop_run

void aos_loop_run(void)
  • Description

    Start event loop.

  • Parameters

    None.

  • Returns

    None.

12-aos_loop_exit

void aos_loop_exit(void)
  • Description

    Exit event loop, aos_loop_run() will return.

  • Parameters

    None.

  • Returns

    None.

13-aos_loop_destroy

void aos_loop_destroy(void)
  • Description

    Free event loop resources.

  • Parameters

    None.

  • Returns

    None.

14-aos_loop_schedule_call

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.

15-aos_loop_schedule_work

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.

16-aos_cancel_work

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.

Clone this wiki locally