#ifndef _WRAPPERS_H_ #define _WRAPPERS_H_ #if defined(__cplusplus) extern "C" { #endif #include #include "infra_types.h" #include "infra_defs.h" #include "wrappers_defs.h" #include "infra_compat.h" #include "main.h" #include "plat_comm/plat_comm_task.h" #include "wdt_task/wdt_task.h" #define HAL_Printf Plat_Comm_LOG //printf修改打印方式 #define HAL_TASK_WDT_CLEAR() v_wdt_setFlag(TASK_ID_PlatComm) //清空看门狗计数 /**  *  * 函数 HAL_Firmware_Persistence_Start() 需要SDK的使用者针对SDK将运行的硬件平台填充实现, 供SDK调用  * ---  * Interface of HAL_Firmware_Persistence_Start() requires to be implemented by user of SDK, according to target device platform  *  * 如果需要参考如何实现函数 HAL_Firmware_Persistence_Start(), 可以查阅SDK移植到 Ubuntu Linux 上时的示例代码  * ---  * If you need guidance about how to implement HAL_Firmware_Persistence_Start, you can check its reference implementation for Ubuntu platform  *  * https://code.aliyun.com/linkkit/c-sdk/blob/v3.0.1/wrappers/HAL_OS_linux.c  *  *  * 注意! HAL_XXX() 系列的函数虽然有阿里提供的对应参考实现, 但不建议您不做任何修改/检视的应用于您的商用设备!  *   * 注意! 参考示例实现仅用于解释各个 HAL_XXX() 系列函数的语义!  *   */ void HAL_Firmware_Persistence_Start(void); /**  *  * 函数 HAL_Firmware_Persistence_Stop() 需要SDK的使用者针对SDK将运行的硬件平台填充实现, 供SDK调用  * ---  * Interface of HAL_Firmware_Persistence_Stop() requires to be implemented by user of SDK, according to target device platform  *  * 如果需要参考如何实现函数 HAL_Firmware_Persistence_Stop(), 可以查阅SDK移植到 Ubuntu Linux 上时的示例代码  * ---  * If you need guidance about how to implement HAL_Firmware_Persistence_Stop, you can check its reference implementation for Ubuntu platform  *  * https://code.aliyun.com/linkkit/c-sdk/blob/v3.0.1/wrappers/HAL_OS_linux.c  *  *  * 注意! HAL_XXX() 系列的函数虽然有阿里提供的对应参考实现, 但不建议您不做任何修改/检视的应用于您的商用设备!  *   * 注意! 参考示例实现仅用于解释各个 HAL_XXX() 系列函数的语义!  *   */ int HAL_Firmware_Persistence_Stop(void); /**  *  * 函数 HAL_Firmware_Persistence_Write() 需要SDK的使用者针对SDK将运行的硬件平台填充实现, 供SDK调用  * ---  * Interface of HAL_Firmware_Persistence_Write() requires to be implemented by user of SDK, according to target device platform  *  * 如果需要参考如何实现函数 HAL_Firmware_Persistence_Write(), 可以查阅SDK移植到 Ubuntu Linux 上时的示例代码  * ---  * If you need guidance about how to implement HAL_Firmware_Persistence_Write, you can check its reference implementation for Ubuntu platform  *  * https://code.aliyun.com/linkkit/c-sdk/blob/v3.0.1/wrappers/HAL_OS_linux.c  *  *  * 注意! HAL_XXX() 系列的函数虽然有阿里提供的对应参考实现, 但不建议您不做任何修改/检视的应用于您的商用设备!  *   * 注意! 参考示例实现仅用于解释各个 HAL_XXX() 系列函数的语义!  *   */ int HAL_Firmware_Persistence_Write(char *buffer, uint32_t length); /**  *  * 函数 HAL_Free() 需要SDK的使用者针对SDK将运行的硬件平台填充实现, 供SDK调用  * ---  * Interface of HAL_Free() requires to be implemented by user of SDK, according to target device platform  *  * 如果需要参考如何实现函数 HAL_Free(), 可以查阅SDK移植到 Ubuntu Linux 上时的示例代码  * ---  * If you need guidance about how to implement HAL_Free, you can check its reference implementation for Ubuntu platform  *  * https://code.aliyun.com/linkkit/c-sdk/blob/v3.0.1/wrappers/HAL_OS_linux.c  *  *  * 注意! HAL_XXX() 系列的函数虽然有阿里提供的对应参考实现, 但不建议您不做任何修改/检视的应用于您的商用设备!  *   * 注意! 参考示例实现仅用于解释各个 HAL_XXX() 系列函数的语义!  *   */ /** * @brief Deallocate memory block * * @param[in] ptr @n Pointer to a memory block previously allocated with platform_malloc. * @return None. * @see None. * @note None. */ void HAL_Free(void *ptr); /**  *  * 函数 HAL_GetFirmwareVersion() 需要SDK的使用者针对SDK将运行的硬件平台填充实现, 供SDK调用  * ---  * Interface of HAL_GetFirmwareVersion() requires to be implemented by user of SDK, according to target device platform  *  * 如果需要参考如何实现函数 HAL_GetFirmwareVersion(), 可以查阅SDK移植到 Ubuntu Linux 上时的示例代码  * ---  * If you need guidance about how to implement HAL_GetFirmwareVersion, you can check its reference implementation for Ubuntu platform  *  * https://code.aliyun.com/linkkit/c-sdk/blob/v3.0.1/wrappers/HAL_OS_linux.c  *  *  * 注意! HAL_XXX() 系列的函数虽然有阿里提供的对应参考实现, 但不建议您不做任何修改/检视的应用于您的商用设备!  *   * 注意! 参考示例实现仅用于解释各个 HAL_XXX() 系列函数的语义!  *   */ /** * @brief Get firmware version * * @param [ou] version: array to store firmware version, max length is IOTX_FIRMWARE_VER_LEN * @return the actual length of firmware version */ int HAL_GetFirmwareVersion(char *version); /**  *  * 函数 HAL_Kv_Get() 需要SDK的使用者针对SDK将运行的硬件平台填充实现, 供SDK调用  * ---  * Interface of HAL_Kv_Get() requires to be implemented by user of SDK, according to target device platform  *  * 如果需要参考如何实现函数 HAL_Kv_Get(), 可以查阅SDK移植到 Ubuntu Linux 上时的示例代码  * ---  * If you need guidance about how to implement HAL_Kv_Get, you can check its reference implementation for Ubuntu platform  *  * https://code.aliyun.com/linkkit/c-sdk/blob/v3.0.1/wrappers/HAL_KV_linux.c  *  *  * 注意! HAL_XXX() 系列的函数虽然有阿里提供的对应参考实现, 但不建议您不做任何修改/检视的应用于您的商用设备!  *   * 注意! 参考示例实现仅用于解释各个 HAL_XXX() 系列函数的语义!  *   */ int HAL_Kv_Get(const char *key, void *val, int *buffer_len); /**  *  * 函数 HAL_Kv_Set() 需要SDK的使用者针对SDK将运行的硬件平台填充实现, 供SDK调用  * ---  * Interface of HAL_Kv_Set() requires to be implemented by user of SDK, according to target device platform  *  * 如果需要参考如何实现函数 HAL_Kv_Set(), 可以查阅SDK移植到 Ubuntu Linux 上时的示例代码  * ---  * If you need guidance about how to implement HAL_Kv_Set, you can check its reference implementation for Ubuntu platform  *  * https://code.aliyun.com/linkkit/c-sdk/blob/v3.0.1/wrappers/HAL_KV_linux.c  *  *  * 注意! HAL_XXX() 系列的函数虽然有阿里提供的对应参考实现, 但不建议您不做任何修改/检视的应用于您的商用设备!  *   * 注意! 参考示例实现仅用于解释各个 HAL_XXX() 系列函数的语义!  *   */ int HAL_Kv_Set(const char *key, const void *val, int len, int sync); /**  *  * 函数 HAL_Malloc() 需要SDK的使用者针对SDK将运行的硬件平台填充实现, 供SDK调用  * ---  * Interface of HAL_Malloc() requires to be implemented by user of SDK, according to target device platform  *  * 如果需要参考如何实现函数 HAL_Malloc(), 可以查阅SDK移植到 Ubuntu Linux 上时的示例代码  * ---  * If you need guidance about how to implement HAL_Malloc, you can check its reference implementation for Ubuntu platform  *  * https://code.aliyun.com/linkkit/c-sdk/blob/v3.0.1/wrappers/HAL_OS_linux.c  *  *  * 注意! HAL_XXX() 系列的函数虽然有阿里提供的对应参考实现, 但不建议您不做任何修改/检视的应用于您的商用设备!  *   * 注意! 参考示例实现仅用于解释各个 HAL_XXX() 系列函数的语义!  *   */ /** * @brief Allocates a block of size bytes of memory, returning a pointer to the beginning of the block. * * @param [in] size @n specify block size in bytes. * @return A pointer to the beginning of the block. * @see None. * @note Block value is indeterminate. */ void *HAL_Malloc(uint32_t size); /**  *  * 函数 HAL_MutexCreate() 需要SDK的使用者针对SDK将运行的硬件平台填充实现, 供SDK调用  * ---  * Interface of HAL_MutexCreate() requires to be implemented by user of SDK, according to target device platform  *  * 如果需要参考如何实现函数 HAL_MutexCreate(), 可以查阅SDK移植到 Ubuntu Linux 上时的示例代码  * ---  * If you need guidance about how to implement HAL_MutexCreate, you can check its reference implementation for Ubuntu platform  *  * https://code.aliyun.com/linkkit/c-sdk/blob/v3.0.1/wrappers/HAL_OS_linux.c  *  *  * 注意! HAL_XXX() 系列的函数虽然有阿里提供的对应参考实现, 但不建议您不做任何修改/检视的应用于您的商用设备!  *   * 注意! 参考示例实现仅用于解释各个 HAL_XXX() 系列函数的语义!  *   */ /** * @brief Create a mutex. * * @retval NULL : Initialize mutex failed. * @retval NOT_NULL : The mutex handle. * @see None. * @note None. */ void *HAL_MutexCreate(void); /**  *  * 函数 HAL_MutexDestroy() 需要SDK的使用者针对SDK将运行的硬件平台填充实现, 供SDK调用  * ---  * Interface of HAL_MutexDestroy() requires to be implemented by user of SDK, according to target device platform  *  * 如果需要参考如何实现函数 HAL_MutexDestroy(), 可以查阅SDK移植到 Ubuntu Linux 上时的示例代码  * ---  * If you need guidance about how to implement HAL_MutexDestroy, you can check its reference implementation for Ubuntu platform  *  * https://code.aliyun.com/linkkit/c-sdk/blob/v3.0.1/wrappers/HAL_OS_linux.c  *  *  * 注意! HAL_XXX() 系列的函数虽然有阿里提供的对应参考实现, 但不建议您不做任何修改/检视的应用于您的商用设备!  *   * 注意! 参考示例实现仅用于解释各个 HAL_XXX() 系列函数的语义!  *   */ /** * @brief Destroy the specified mutex object, it will release related resource. * * @param [in] mutex @n The specified mutex. * @return None. * @see None. * @note None. */ void HAL_MutexDestroy(void *mutex); /**  *  * 函数 HAL_MutexLock() 需要SDK的使用者针对SDK将运行的硬件平台填充实现, 供SDK调用  * ---  * Interface of HAL_MutexLock() requires to be implemented by user of SDK, according to target device platform  *  * 如果需要参考如何实现函数 HAL_MutexLock(), 可以查阅SDK移植到 Ubuntu Linux 上时的示例代码  * ---  * If you need guidance about how to implement HAL_MutexLock, you can check its reference implementation for Ubuntu platform  *  * https://code.aliyun.com/linkkit/c-sdk/blob/v3.0.1/wrappers/HAL_OS_linux.c  *  *  * 注意! HAL_XXX() 系列的函数虽然有阿里提供的对应参考实现, 但不建议您不做任何修改/检视的应用于您的商用设备!  *   * 注意! 参考示例实现仅用于解释各个 HAL_XXX() 系列函数的语义!  *   */ /** * @brief Waits until the specified mutex is in the signaled state. * * @param [in] mutex @n the specified mutex. * @return None. * @see None. * @note None. */ void HAL_MutexLock(void *mutex); /**  *  * 函数 HAL_MutexUnlock() 需要SDK的使用者针对SDK将运行的硬件平台填充实现, 供SDK调用  * ---  * Interface of HAL_MutexUnlock() requires to be implemented by user of SDK, according to target device platform  *  * 如果需要参考如何实现函数 HAL_MutexUnlock(), 可以查阅SDK移植到 Ubuntu Linux 上时的示例代码  * ---  * If you need guidance about how to implement HAL_MutexUnlock, you can check its reference implementation for Ubuntu platform  *  * https://code.aliyun.com/linkkit/c-sdk/blob/v3.0.1/wrappers/HAL_OS_linux.c  *  *  * 注意! HAL_XXX() 系列的函数虽然有阿里提供的对应参考实现, 但不建议您不做任何修改/检视的应用于您的商用设备!  *   * 注意! 参考示例实现仅用于解释各个 HAL_XXX() 系列函数的语义!  *   */ /** * @brief Releases ownership of the specified mutex object.. * * @param [in] mutex @n the specified mutex. * @return None. * @see None. * @note None. */ void HAL_MutexUnlock(void *mutex); /**  *  * 函数 HAL_Random() 需要SDK的使用者针对SDK将运行的硬件平台填充实现, 供SDK调用  * ---  * Interface of HAL_Random() requires to be implemented by user of SDK, according to target device platform  *  * 如果需要参考如何实现函数 HAL_Random(), 可以查阅SDK移植到 Ubuntu Linux 上时的示例代码  * ---  * If you need guidance about how to implement HAL_Random, you can check its reference implementation for Ubuntu platform  *  * https://code.aliyun.com/linkkit/c-sdk/blob/v3.0.1/wrappers/HAL_OS_linux.c  *  *  * 注意! HAL_XXX() 系列的函数虽然有阿里提供的对应参考实现, 但不建议您不做任何修改/检视的应用于您的商用设备!  *   * 注意! 参考示例实现仅用于解释各个 HAL_XXX() 系列函数的语义!  *   */ uint32_t HAL_Random(uint32_t region); /**  *  * 函数 HAL_Read() 需要SDK的使用者针对SDK将运行的硬件平台填充实现, 供SDK调用  * ---  * Interface of HAL_Read() requires to be implemented by user of SDK, according to target device platform  *  * 如果需要参考如何实现函数 HAL_Read(), 可以查阅SDK移植到 Ubuntu Linux 上时的示例代码  * ---  * If you need guidance about how to implement HAL_Read, you can check its reference implementation for Ubuntu platform  *  * https://code.aliyun.com/linkkit/c-sdk/blob/v3.0.1/wrappers/HAL_OS_linux.c  *  *  * 注意! HAL_XXX() 系列的函数虽然有阿里提供的对应参考实现, 但不建议您不做任何修改/检视的应用于您的商用设备!  *   * 注意! 参考示例实现仅用于解释各个 HAL_XXX() 系列函数的语义!  *   */ /** * @brief write data to terminal * * @param[in] fd @n device descriptor. * @param[out] data pointer to the buffer which will store incoming data * @param[out] count number of bytes received * @return count number of bytes received. * @see None. * @note None. */ int HAL_Read(int fd, void *buf, int len); /**  *  * 函数 HAL_SSL_Destroy() 需要SDK的使用者针对SDK将运行的硬件平台填充实现, 供SDK调用  * ---  * Interface of HAL_SSL_Destroy() requires to be implemented by user of SDK, according to target device platform  *  * 如果需要参考如何实现函数 HAL_SSL_Destroy(), 可以查阅SDK移植到 Ubuntu Linux 上时的示例代码  * ---  * If you need guidance about how to implement HAL_SSL_Destroy, you can check its reference implementation for Ubuntu platform  *  * https://code.aliyun.com/linkkit/c-sdk/blob/v3.0.1/wrappers/  *  *  * 注意! HAL_XXX() 系列的函数虽然有阿里提供的对应参考实现, 但不建议您不做任何修改/检视的应用于您的商用设备!  *   * 注意! 参考示例实现仅用于解释各个 HAL_XXX() 系列函数的语义!  *   */ int32_t HAL_SSL_Destroy(uintptr_t handle); /**  *  * 函数 HAL_SSL_Establish() 需要SDK的使用者针对SDK将运行的硬件平台填充实现, 供SDK调用  * ---  * Interface of HAL_SSL_Establish() requires to be implemented by user of SDK, according to target device platform  *  * 如果需要参考如何实现函数 HAL_SSL_Establish(), 可以查阅SDK移植到 Ubuntu Linux 上时的示例代码  * ---  * If you need guidance about how to implement HAL_SSL_Establish, you can check its reference implementation for Ubuntu platform  *  * https://code.aliyun.com/linkkit/c-sdk/blob/v3.0.1/wrappers/  *  *  * 注意! HAL_XXX() 系列的函数虽然有阿里提供的对应参考实现, 但不建议您不做任何修改/检视的应用于您的商用设备!  *   * 注意! 参考示例实现仅用于解释各个 HAL_XXX() 系列函数的语义!  *   */ uintptr_t HAL_SSL_Establish(const char *host, uint16_t port, const char *ca_crt, uint32_t ca_crt_len); /**  *  * 函数 HAL_SSL_Read() 需要SDK的使用者针对SDK将运行的硬件平台填充实现, 供SDK调用  * ---  * Interface of HAL_SSL_Read() requires to be implemented by user of SDK, according to target device platform  *  * 如果需要参考如何实现函数 HAL_SSL_Read(), 可以查阅SDK移植到 Ubuntu Linux 上时的示例代码  * ---  * If you need guidance about how to implement HAL_SSL_Read, you can check its reference implementation for Ubuntu platform  *  * https://code.aliyun.com/linkkit/c-sdk/blob/v3.0.1/wrappers/  *  *  * 注意! HAL_XXX() 系列的函数虽然有阿里提供的对应参考实现, 但不建议您不做任何修改/检视的应用于您的商用设备!  *   * 注意! 参考示例实现仅用于解释各个 HAL_XXX() 系列函数的语义!  *   */ int HAL_SSL_Read(uintptr_t handle, char *buf, int len, int timeout_ms); /**  *  * 函数 HAL_SSL_Write() 需要SDK的使用者针对SDK将运行的硬件平台填充实现, 供SDK调用  * ---  * Interface of HAL_SSL_Write() requires to be implemented by user of SDK, according to target device platform  *  * 如果需要参考如何实现函数 HAL_SSL_Write(), 可以查阅SDK移植到 Ubuntu Linux 上时的示例代码  * ---  * If you need guidance about how to implement HAL_SSL_Write, you can check its reference implementation for Ubuntu platform  *  * https://code.aliyun.com/linkkit/c-sdk/blob/v3.0.1/wrappers/  *  *  * 注意! HAL_XXX() 系列的函数虽然有阿里提供的对应参考实现, 但不建议您不做任何修改/检视的应用于您的商用设备!  *   * 注意! 参考示例实现仅用于解释各个 HAL_XXX() 系列函数的语义!  *   */ int HAL_SSL_Write(uintptr_t handle, const char *buf, int len, int timeout_ms); /**  *  * 函数 HAL_SetFirmwareVersion() 需要SDK的使用者针对SDK将运行的硬件平台填充实现, 供SDK调用  * ---  * Interface of HAL_SetFirmwareVersion() requires to be implemented by user of SDK, according to target device platform  *  * 如果需要参考如何实现函数 HAL_SetFirmwareVersion(), 可以查阅SDK移植到 Ubuntu Linux 上时的示例代码  * ---  * If you need guidance about how to implement HAL_SetFirmwareVersion, you can check its reference implementation for Ubuntu platform  *  * https://code.aliyun.com/linkkit/c-sdk/blob/v3.0.1/wrappers/HAL_OS_linux.c  *  *  * 注意! HAL_XXX() 系列的函数虽然有阿里提供的对应参考实现, 但不建议您不做任何修改/检视的应用于您的商用设备!  *   * 注意! 参考示例实现仅用于解释各个 HAL_XXX() 系列函数的语义!  *   */ int HAL_SetFirmwareVersion(const char *version); /**  *  * 函数 HAL_SleepMs() 需要SDK的使用者针对SDK将运行的硬件平台填充实现, 供SDK调用  * ---  * Interface of HAL_SleepMs() requires to be implemented by user of SDK, according to target device platform  *  * 如果需要参考如何实现函数 HAL_SleepMs(), 可以查阅SDK移植到 Ubuntu Linux 上时的示例代码  * ---  * If you need guidance about how to implement HAL_SleepMs, you can check its reference implementation for Ubuntu platform  *  * https://code.aliyun.com/linkkit/c-sdk/blob/v3.0.1/wrappers/HAL_OS_linux.c  *  *  * 注意! HAL_XXX() 系列的函数虽然有阿里提供的对应参考实现, 但不建议您不做任何修改/检视的应用于您的商用设备!  *   * 注意! 参考示例实现仅用于解释各个 HAL_XXX() 系列函数的语义!  *   */ /** * @brief Sleep thread itself. * * @param [in] ms @n the time interval for which execution is to be suspended, in milliseconds. * @return None. * @see None. * @note None. */ void HAL_SleepMs(uint32_t ms); /**  *  * 函数 HAL_Snprintf() 需要SDK的使用者针对SDK将运行的硬件平台填充实现, 供SDK调用  * ---  * Interface of HAL_Snprintf() requires to be implemented by user of SDK, according to target device platform  *  * 如果需要参考如何实现函数 HAL_Snprintf(), 可以查阅SDK移植到 Ubuntu Linux 上时的示例代码  * ---  * If you need guidance about how to implement HAL_Snprintf, you can check its reference implementation for Ubuntu platform  *  * https://code.aliyun.com/linkkit/c-sdk/blob/v3.0.1/wrappers/HAL_OS_linux.c  *  *  * 注意! HAL_XXX() 系列的函数虽然有阿里提供的对应参考实现, 但不建议您不做任何修改/检视的应用于您的商用设备!  *   * 注意! 参考示例实现仅用于解释各个 HAL_XXX() 系列函数的语义!  *   */ /** * @brief Writes formatted data to string. * * @param [out] str: @n String that holds written text. * @param [in] len: @n Maximum length of character will be written * @param [in] fmt: @n Format that contains the text to be written, it can optionally contain embedded format specifiers that specifies how subsequent arguments are converted for output. * @param [in] ...: @n the variable argument list, for formatted and inserted in the resulting string replacing their respective specifiers. * @return bytes of character successfully written into string. * @see None. * @note None. */ int HAL_Snprintf(char *str, const int len, const char *fmt, ...); /**  *  * 函数 HAL_Srandom() 需要SDK的使用者针对SDK将运行的硬件平台填充实现, 供SDK调用  * ---  * Interface of HAL_Srandom() requires to be implemented by user of SDK, according to target device platform  *  * 如果需要参考如何实现函数 HAL_Srandom(), 可以查阅SDK移植到 Ubuntu Linux 上时的示例代码  * ---  * If you need guidance about how to implement HAL_Srandom, you can check its reference implementation for Ubuntu platform  *  * https://code.aliyun.com/linkkit/c-sdk/blob/v3.0.1/wrappers/HAL_OS_linux.c  *  *  * 注意! HAL_XXX() 系列的函数虽然有阿里提供的对应参考实现, 但不建议您不做任何修改/检视的应用于您的商用设备!  *   * 注意! 参考示例实现仅用于解释各个 HAL_XXX() 系列函数的语义!  *   */ void HAL_Srandom(uint32_t seed); /**  *  * 函数 HAL_TCP_Destroy() 需要SDK的使用者针对SDK将运行的硬件平台填充实现, 供SDK调用  * ---  * Interface of HAL_TCP_Destroy() requires to be implemented by user of SDK, according to target device platform  *  * 如果需要参考如何实现函数 HAL_TCP_Destroy(), 可以查阅SDK移植到 Ubuntu Linux 上时的示例代码  * ---  * If you need guidance about how to implement HAL_TCP_Destroy, you can check its reference implementation for Ubuntu platform  *  * https://code.aliyun.com/linkkit/c-sdk/blob/v3.0.1/wrappers/HAL_TCP_linux.c  *  *  * 注意! HAL_XXX() 系列的函数虽然有阿里提供的对应参考实现, 但不建议您不做任何修改/检视的应用于您的商用设备!  *   * 注意! 参考示例实现仅用于解释各个 HAL_XXX() 系列函数的语义!  *   */ /** * @brief Destroy the specific TCP connection. * * @param [in] fd: @n Specify the TCP connection by handle. * * @return The result of destroy TCP connection. * @retval < 0 : Fail. * @retval 0 : Success. */ int HAL_TCP_Destroy(uintptr_t fd); /**  *  * 函数 HAL_TCP_Establish() 需要SDK的使用者针对SDK将运行的硬件平台填充实现, 供SDK调用  * ---  * Interface of HAL_TCP_Establish() requires to be implemented by user of SDK, according to target device platform  *  * 如果需要参考如何实现函数 HAL_TCP_Establish(), 可以查阅SDK移植到 Ubuntu Linux 上时的示例代码  * ---  * If you need guidance about how to implement HAL_TCP_Establish, you can check its reference implementation for Ubuntu platform  *  * https://code.aliyun.com/linkkit/c-sdk/blob/v3.0.1/wrappers/HAL_TCP_linux.c  *  *  * 注意! HAL_XXX() 系列的函数虽然有阿里提供的对应参考实现, 但不建议您不做任何修改/检视的应用于您的商用设备!  *   * 注意! 参考示例实现仅用于解释各个 HAL_XXX() 系列函数的语义!  *   */ /** * @brief Establish a TCP connection. * * @param [in] host: @n Specify the hostname(IP) of the TCP server * @param [in] port: @n Specify the TCP port of TCP server * * @return The handle of TCP connection. @retval (uintptr_t)(-1): Fail. @retval All other values(0 included): Success, the value is handle of this TCP connection. */ uintptr_t HAL_TCP_Establish(const char *host, uint16_t port); /**  *  * 函数 HAL_TCP_Read() 需要SDK的使用者针对SDK将运行的硬件平台填充实现, 供SDK调用  * ---  * Interface of HAL_TCP_Read() requires to be implemented by user of SDK, according to target device platform  *  * 如果需要参考如何实现函数 HAL_TCP_Read(), 可以查阅SDK移植到 Ubuntu Linux 上时的示例代码  * ---  * If you need guidance about how to implement HAL_TCP_Read, you can check its reference implementation for Ubuntu platform  *  * https://code.aliyun.com/linkkit/c-sdk/blob/v3.0.1/wrappers/HAL_TCP_linux.c  *  *  * 注意! HAL_XXX() 系列的函数虽然有阿里提供的对应参考实现, 但不建议您不做任何修改/检视的应用于您的商用设备!  *   * 注意! 参考示例实现仅用于解释各个 HAL_XXX() 系列函数的语义!  *   */ /** * @brief Read data from the specific TCP connection with timeout parameter. * The API will return immediately if 'len' be received from the specific TCP connection. * * @param [in] fd @n A descriptor identifying a TCP connection. * @param [out] buf @n A pointer to a buffer to receive incoming data. * @param [out] len @n The length, in bytes, of the data pointed to by the 'buf' parameter. * @param [in] timeout_ms @n Specify the timeout value in millisecond. In other words, the API block 'timeout_ms' millisecond maximumly. * * @retval -2 : TCP connection error occur. * @retval -1 : TCP connection be closed by remote server. * @retval 0 : No any data be received in 'timeout_ms' timeout period. * @retval (0, len] : The total number of bytes be received in 'timeout_ms' timeout period. * @see None. */ int32_t HAL_TCP_Read(uintptr_t fd, char *buf, uint32_t len, uint32_t timeout_ms); /**  *  * 函数 HAL_TCP_Write() 需要SDK的使用者针对SDK将运行的硬件平台填充实现, 供SDK调用  * ---  * Interface of HAL_TCP_Write() requires to be implemented by user of SDK, according to target device platform  *  * 如果需要参考如何实现函数 HAL_TCP_Write(), 可以查阅SDK移植到 Ubuntu Linux 上时的示例代码  * ---  * If you need guidance about how to implement HAL_TCP_Write, you can check its reference implementation for Ubuntu platform  *  * https://code.aliyun.com/linkkit/c-sdk/blob/v3.0.1/wrappers/HAL_TCP_linux.c  *  *  * 注意! HAL_XXX() 系列的函数虽然有阿里提供的对应参考实现, 但不建议您不做任何修改/检视的应用于您的商用设备!  *   * 注意! 参考示例实现仅用于解释各个 HAL_XXX() 系列函数的语义!  *   */ /** * @brief Write data into the specific TCP connection. * The API will return immediately if 'len' be written into the specific TCP connection. * * @param [in] fd @n A descriptor identifying a connection. * @param [in] buf @n A pointer to a buffer containing the data to be transmitted. * @param [in] len @n The length, in bytes, of the data pointed to by the 'buf' parameter. * @param [in] timeout_ms @n Specify the timeout value in millisecond. In other words, the API block 'timeout_ms' millisecond maximumly. * * @retval < 0 : TCP connection error occur.. * @retval 0 : No any data be write into the TCP connection in 'timeout_ms' timeout period. * @retval (0, len] : The total number of bytes be written in 'timeout_ms' timeout period. * @see None. */ int32_t HAL_TCP_Write(uintptr_t fd, const char *buf, uint32_t len, uint32_t timeout_ms); /**  *  * 函数 HAL_UTC_Get() 需要SDK的使用者针对SDK将运行的硬件平台填充实现, 供SDK调用  * ---  * Interface of HAL_UTC_Get() requires to be implemented by user of SDK, according to target device platform  *  * 如果需要参考如何实现函数 HAL_UTC_Get(), 可以查阅SDK移植到 Ubuntu Linux 上时的示例代码  * ---  * If you need guidance about how to implement HAL_UTC_Get, you can check its reference implementation for Ubuntu platform  *  * https://code.aliyun.com/linkkit/c-sdk/blob/v3.0.1/wrappers/HAL_OS_linux.c  *  *  * 注意! HAL_XXX() 系列的函数虽然有阿里提供的对应参考实现, 但不建议您不做任何修改/检视的应用于您的商用设备!  *   * 注意! 参考示例实现仅用于解释各个 HAL_XXX() 系列函数的语义!  *   */ long HAL_UTC_Get(void); /**  *  * 函数 HAL_UTC_Set() 需要SDK的使用者针对SDK将运行的硬件平台填充实现, 供SDK调用  * ---  * Interface of HAL_UTC_Set() requires to be implemented by user of SDK, according to target device platform  *  * 如果需要参考如何实现函数 HAL_UTC_Set(), 可以查阅SDK移植到 Ubuntu Linux 上时的示例代码  * ---  * If you need guidance about how to implement HAL_UTC_Set, you can check its reference implementation for Ubuntu platform  *  * https://code.aliyun.com/linkkit/c-sdk/blob/v3.0.1/wrappers/HAL_OS_linux.c  *  *  * 注意! HAL_XXX() 系列的函数虽然有阿里提供的对应参考实现, 但不建议您不做任何修改/检视的应用于您的商用设备!  *   * 注意! 参考示例实现仅用于解释各个 HAL_XXX() 系列函数的语义!  *   */ int HAL_UTC_Set(long s); /**  *  * 函数 HAL_UptimeMs() 需要SDK的使用者针对SDK将运行的硬件平台填充实现, 供SDK调用  * ---  * Interface of HAL_UptimeMs() requires to be implemented by user of SDK, according to target device platform  *  * 如果需要参考如何实现函数 HAL_UptimeMs(), 可以查阅SDK移植到 Ubuntu Linux 上时的示例代码  * ---  * If you need guidance about how to implement HAL_UptimeMs, you can check its reference implementation for Ubuntu platform  *  * https://code.aliyun.com/linkkit/c-sdk/blob/v3.0.1/wrappers/HAL_OS_linux.c  *  *  * 注意! HAL_XXX() 系列的函数虽然有阿里提供的对应参考实现, 但不建议您不做任何修改/检视的应用于您的商用设备!  *   * 注意! 参考示例实现仅用于解释各个 HAL_XXX() 系列函数的语义!  *   */ /** * @brief Retrieves the number of milliseconds that have elapsed since the system was boot. * * @return the number of milliseconds. * @see None. * @note None. */ uint64_t HAL_UptimeMs(void); /**  *  * 函数 HAL_Vsnprintf() 需要SDK的使用者针对SDK将运行的硬件平台填充实现, 供SDK调用  * ---  * Interface of HAL_Vsnprintf() requires to be implemented by user of SDK, according to target device platform  *  * 如果需要参考如何实现函数 HAL_Vsnprintf(), 可以查阅SDK移植到 Ubuntu Linux 上时的示例代码  * ---  * If you need guidance about how to implement HAL_Vsnprintf, you can check its reference implementation for Ubuntu platform  *  * https://code.aliyun.com/linkkit/c-sdk/blob/v3.0.1/wrappers/HAL_OS_linux.c  *  *  * 注意! HAL_XXX() 系列的函数虽然有阿里提供的对应参考实现, 但不建议您不做任何修改/检视的应用于您的商用设备!  *   * 注意! 参考示例实现仅用于解释各个 HAL_XXX() 系列函数的语义!  *   */ int HAL_Vsnprintf(char *str, const int len, const char *format, va_list ap); /**  *  * 函数 HAL_Write() 需要SDK的使用者针对SDK将运行的硬件平台填充实现, 供SDK调用  * ---  * Interface of HAL_Write() requires to be implemented by user of SDK, according to target device platform  *  * 如果需要参考如何实现函数 HAL_Write(), 可以查阅SDK移植到 Ubuntu Linux 上时的示例代码  * ---  * If you need guidance about how to implement HAL_Write, you can check its reference implementation for Ubuntu platform  *  * https://code.aliyun.com/linkkit/c-sdk/blob/v3.0.1/wrappers/HAL_OS_linux.c  *  *  * 注意! HAL_XXX() 系列的函数虽然有阿里提供的对应参考实现, 但不建议您不做任何修改/检视的应用于您的商用设备!  *   * 注意! 参考示例实现仅用于解释各个 HAL_XXX() 系列函数的语义!  *   */ /** * @brief write data to terminal * * @param[in] fd @n device descriptor. * @param[in] data pointer to the start of data * @param[in] size number of bytes to transmit * @return count number of bytes received. * @see None. * @note None. */ int HAL_Write(int fd, const void *buf, int len); #if defined(__cplusplus) } #endif #endif