初始提交
This commit is contained in:
127
export/inc/io_lib/iot_io_api.h
Executable file
127
export/inc/io_lib/iot_io_api.h
Executable file
@@ -0,0 +1,127 @@
|
||||
/****************************************************************************
|
||||
|
||||
Copyright(c) 2019 by Aerospace C.Power (Chongqing) Microelectronics. ALL RIGHTS RESERVED.
|
||||
|
||||
This Information is proprietary to Aerospace C.Power (Chongqing) Microelectronics and MAY NOT
|
||||
be copied by any method or incorporated into another program without
|
||||
the express written consent of Aerospace C.Power. This Information or any portion
|
||||
thereof remains the property of Aerospace C.Power. The Information contained herein
|
||||
is believed to be accurate and Aerospace C.Power assumes no responsibility or
|
||||
liability for its use in any way and conveys no license or title under
|
||||
any patent or copyright and makes no representation or warranty that this
|
||||
Information is free from patent or copyright infringement.
|
||||
|
||||
****************************************************************************/
|
||||
#ifndef IOT_IO_API_H
|
||||
#define IOT_IO_API_H
|
||||
|
||||
/* os shim includes */
|
||||
#include "os_types_api.h"
|
||||
|
||||
/* common includes */
|
||||
#include "iot_config_api.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** \defgroup STRINGIO_APIs STRING IO APIs
|
||||
* @brief WQ30x1 STRING IO APIs
|
||||
*
|
||||
* string helper handle functions for cusotmer applications
|
||||
*
|
||||
*/
|
||||
|
||||
/** @addtogroup STRINGIO_APIs
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief iot_printf() - print content per format.
|
||||
* @param fmt: the module that creates the event.
|
||||
*
|
||||
* @return 0 -- always return 0
|
||||
*/
|
||||
#if IOT_PRINTF_DEBUG
|
||||
|
||||
int32_t iot_printf(const char *fmt, ...);
|
||||
|
||||
#else /* IOT_PRINTF_DEBUG */
|
||||
|
||||
#define iot_printf(fmt, ...) \
|
||||
do { \
|
||||
(void)fmt; \
|
||||
extern int32_t __iot_printf(uint8_t dummy, ...); \
|
||||
__iot_printf(0, ##__VA_ARGS__); \
|
||||
} while (0)
|
||||
|
||||
#endif /* IOT_PRINTF_DEBUG */
|
||||
|
||||
|
||||
/**
|
||||
* @brief iot_cus_printf() - app used print content per format.
|
||||
* @param fmt: the module that creates the event.
|
||||
*
|
||||
* @return 0 -- always return 0
|
||||
*/
|
||||
|
||||
int32_t iot_cus_printf(const char *fmt, ...);
|
||||
|
||||
/**
|
||||
* @brief iot_cus_printf_config - enable or disable iot_printf
|
||||
* this function for app to contorl iot_printf
|
||||
* @param enable: 1 - enable uart print. 0 disable
|
||||
*
|
||||
* @return none
|
||||
*/
|
||||
void iot_cus_print_config(bool_t enable);
|
||||
|
||||
/**
|
||||
* @brief iot_print_config - enable or disable iot_printf
|
||||
* this function for app to contorl plc iot_printf
|
||||
* @param enable: 1 - enable uart print. 0 disable
|
||||
*
|
||||
* @return none
|
||||
*/
|
||||
void iot_print_config(bool_t enable);
|
||||
|
||||
/**
|
||||
* @brief iot_sprintf() - print content to target str buffer per format and size.
|
||||
* @param str: target str buffer
|
||||
* @param size buffer size
|
||||
* @param fmt: string format
|
||||
*
|
||||
* @return written content length
|
||||
*/
|
||||
int32_t iot_snprintf(char *str, size_t size, const char *format, ...);
|
||||
|
||||
/**
|
||||
* @brief iot_sprintf() - print content to target str buffer per format and size.
|
||||
* @param str: target str buffer
|
||||
* @param size buffer size
|
||||
* @param fmt: string format
|
||||
* @param ap: var list used for fmt
|
||||
*
|
||||
* @return written content length
|
||||
*/
|
||||
int32_t iot_vsnprintf(char *str, size_t size, const char *format, va_list ap);
|
||||
|
||||
/**
|
||||
* @brief iot_sprintf() - print content to target str per format.
|
||||
* @param str: target str buffer
|
||||
* @param fmt: string format
|
||||
*
|
||||
* @return written content length
|
||||
*/
|
||||
int32_t iot_sprintf(char *str, const char *format, ...);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* IOT_IO_API_H */
|
115
export/inc/io_lib/iot_string_api.h
Normal file
115
export/inc/io_lib/iot_string_api.h
Normal file
@@ -0,0 +1,115 @@
|
||||
/****************************************************************************
|
||||
|
||||
Copyright(c) 2019 by Aerospace C.Power (Chongqing) Microelectronics. ALL RIGHTS RESERVED.
|
||||
|
||||
This Information is proprietary to Aerospace C.Power (Chongqing) Microelectronics and MAY NOT
|
||||
be copied by any method or incorporated into another program without
|
||||
the express written consent of Aerospace C.Power. This Information or any portion
|
||||
thereof remains the property of Aerospace C.Power. The Information contained herein
|
||||
is believed to be accurate and Aerospace C.Power assumes no responsibility or
|
||||
liability for its use in any way and conveys no license or title under
|
||||
any patent or copyright and makes no representation or warranty that this
|
||||
Information is free from patent or copyright infringement.
|
||||
|
||||
****************************************************************************/
|
||||
#ifndef IOT_STRING_API_H
|
||||
#define IOT_STRING_API_H
|
||||
|
||||
/* os shim includes */
|
||||
#include "os_types_api.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** \defgroup STRINGIO_APIs STRING IO APIs
|
||||
* @brief WQ30x1 STRING IO APIs
|
||||
*
|
||||
* string helper handle functions for cusotmer applications
|
||||
*
|
||||
*/
|
||||
|
||||
/** @addtogroup STRINGIO_APIs
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief iot_strchr() - find the first occurrence of character in the string.
|
||||
* @param s: string
|
||||
* @param c: character to be located
|
||||
*
|
||||
* @return NULL -- for cannot find case
|
||||
* @return otherwise -- a pointer to the first occurrence
|
||||
*/
|
||||
char* iot_strchr( const char *s, uint32_t c );
|
||||
|
||||
/**
|
||||
* @brief iot_strrchr() - find the last occurrence of character in the string.
|
||||
* @param s: string
|
||||
* @param c: character to be located
|
||||
*
|
||||
* @return NULL -- for cannot find case
|
||||
* @return otherwise -- a pointer to the last occurrence
|
||||
*/
|
||||
char* iot_strrchr(const char *s, uint32_t c);
|
||||
|
||||
/**
|
||||
* @brief iot_strcpy() - copy the string pointed by source into the buffer.
|
||||
* pointed by destination
|
||||
* @param s: destination buffer
|
||||
* @param t: string to be copied
|
||||
*
|
||||
* @return NULL -- for cannot find case
|
||||
* @return otherwise -- a pointer to the first occurrence
|
||||
*/
|
||||
char* iot_strcpy( char *s, const char *t);
|
||||
|
||||
/**
|
||||
* @brief iot_strcmp() - compare the str1 to the str2.
|
||||
* @param s: string
|
||||
* @param c: character to be located
|
||||
*
|
||||
* @return NULL -- for cannot find case
|
||||
* @return otherwise -- a pointer to the first occurrence
|
||||
*/
|
||||
uint16_t iot_strcmp( const char *s1, const char *s2 );
|
||||
|
||||
/**
|
||||
* @brief iot_strlen() - return the length of the str.
|
||||
* @param s: string
|
||||
*
|
||||
* @return str length
|
||||
*/
|
||||
size_t iot_strlen( const char *s );
|
||||
|
||||
/**
|
||||
* @brief iot_strcat() - append a copy of the source string to the.
|
||||
* destination string
|
||||
* @param s1: destination string
|
||||
* @param s2: source string
|
||||
*
|
||||
*
|
||||
* @return destination string
|
||||
*/
|
||||
char* iot_strcat( char *s1, const char *s2 );
|
||||
|
||||
/**
|
||||
* @brief iot_strstr() - find the first substring in a src string.
|
||||
* @param s1: The string to be searched.
|
||||
* @param s2: The string to search for.
|
||||
*
|
||||
* @return NULL -- for cannot find case
|
||||
* @return otherwise -- a pointer to the first occurrence
|
||||
*/
|
||||
char *iot_strstr(const char *s1, const char *s2);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* IOT_STRING_API_H */
|
Reference in New Issue
Block a user