AliOS Things API ALINK Guide - Shaofa/AliOS-Things-Certification-Manual GitHub Wiki

API INDEX


1-alink_set_loglevel

void alink_set_loglevel(enum ALINK_LOG_LEVEL loglevel)
  • Description

    Log level control

  • Parameters

    IN/OUT NAME DESC
    [in] loglevel ALINK_LOG_LEVEL
  • Returns

    None.

2-alink_enable_sandbox_mode

int alink_enable_sandbox_mode(void)
  • Description

    Enable sandbox mode, for debug

  • Parameters

    None.

  • Returns

    0 on success, otherwise -1 will return

3-alink_enable_daily_mode

int alink_enable_daily_mode(const char *server_ip, int port)
  • Description

    Enable daily mode, for debug

  • Parameters

    IN/OUT NAME DESC
    [in] server_ip IP Addr
    [in] port server port
  • Returns

    0 on success, otherwise -1 will return

4-alink_start

int alink_start(void)
  • Description

    Entry function. start alink gateway service.

  • Parameters

    None.

  • Returns

    0 on success, otherwise -1 will return

5-alink_wait_connect

int alink_wait_connect(int timeout_ms)
  • Description

    Waiting alink connect to aliyun server

  • Parameters

    IN/OUT NAME DESC
    [in] timeout_ms time in milliseconds, use ALINK_WAIT_FOREVER to wait until server is connected
  • Returns

    0 when connect to server successfully, otherwise -1 will return

6-alink_end

int alink_end(void)
  • Description

    Destroy alink service and free resources

  • Parameters

    None.

  • Returns

    0 on success, otherwise -1 will return

7-alink_factory_reset

int alink_factory_reset(void)
  • Description

    Reset user account binding.

  • Parameters

    None.

  • Returns

    0 on success, -1 when params invalid

8-alink_report

int alink_report(const char *method, char *json_buffer)
  • Description

    Report alink message, it is a fundamental func.

  • Parameters

    IN/OUT NAME DESC
    [in] method alink protocol method, i.e. "postDeviceRawData", "retrieveDeviceData".
    [in] json_buffer json format buffer, like {"OnOff":"1", "Light":"80"}.
  • Returns

    0 when successfully got response from cloud,

  •      otherwise this func will block until timeout and -1 will return
    

9-alink_register_callback

int alink_register_callback(unsigned char cb_type, void *cb_func)
  • Description

    Register misc callback

  • Parameters

    IN/OUT NAME DESC
    [in] cb_type callback type.
    [in] cb_func callback func pointer, func declaration see related comments.
  • Returns

    0 on success, otherwise -1 will return

10-awss_start

int awss_start(void)
  • Description

    Start awss service, block method, block until awss succeed, or timeout(see Note).

  • Parameters

    None.

  • Returns

    0 on success, otherwise non-zero value will return = 0: connect AP & DHCP success = -1: get ssid & passwd fail = -2: connect AP / DHCP fail

11-awss_stop

int awss_stop(void)
  • Description

    Calling this func force awss_start exit.

  • Parameters

    None.

  • Returns

    0 on success, otherwise -1 will return

⚠️ **GitHub.com Fallback** ⚠️