TuyaOS
宏定义 | 函数
mix_method.h 文件参考

tuya common api module 更多...

#include "tuya_cloud_types.h"
mix_method.h 的引用(Include)关系图:
此图展示该文件直接或间接的被哪些文件引用了:

浏览源代码.

宏定义

#define BITMASK(bit)   (1 << (bit))
 
#define GETBIT(val, bit)   (((val) & BITMASK(bit)) > 0)
 
#define RESETBIT(val, bit)   ((val) &= ~BITMASK(bit))
 
#define SETBIT(val, bit)   ((val) |= BITMASK(bit))
 

函数

unsigned char asc2hex (char asccode)
 convert character to hex, if '0'-'f'/'F' -> 0-15, else 0 更多...
 
void ascs2hex (unsigned char *hex, unsigned char *ascs, int srclen)
 convert the character array to hex array 更多...
 
void byte2str (unsigned char *pbDest, unsigned char *pbSrc, int nLen, bool_t upper)
 
void byte_sort (unsigned char is_ascend, unsigned char *buf, int buf_cnt)
 sort the char in the buf according ascii value 更多...
 
void hex2str (unsigned char *pbDest, unsigned char *pbSrc, int nLen)
 convert the input hex array to string array 更多...
 
int is_valid_version (char *ver)
 check the version input is valid 更多...
 
char * mm_strdup (const char *str)
 duplicate input string, will malloc a new block of memory 更多...
 
int str_revr_find_ch (const char *str, const int revr_index, const char ch)
 find <ch> in <str>, start find in index <revr_index>, find in reverse order. 更多...
 
int string2mac (const char *str, char mac[6])
 convert mac address string to mac address array 更多...
 
int tuya_isalpha (int c)
 
int tuya_strncasecmp (const char *s1, const char *s2, size_t n)
 compare the first n characters of two string 更多...
 
int tuya_tolower (int c)
 
int tuya_toupper (int c)
 
int versionString2int (const char *versionString)
 convert version string to integer 更多...
 

详细描述

tuya common api module

版本
1.0
日期
2019-10-30

函数说明

◆ asc2hex()

unsigned char asc2hex ( char  asccode)

convert character to hex, if '0'-'f'/'F' -> 0-15, else 0

参数
[in]asccodethe input character
返回
the hex value

◆ ascs2hex()

void ascs2hex ( unsigned char *  hex,
unsigned char *  ascs,
int  srclen 
)

convert the character array to hex array

参数
[out]hexthe out hex array
[in]ascsthe input character array
[in]srclenthe length of input character array

◆ byte_sort()

void byte_sort ( unsigned char  is_ascend,
unsigned char *  buf,
int  buf_cnt 
)

sort the char in the buf according ascii value

参数
[in]is_ascendsort in sacend order
[in]bufthe buffer need to sort
[in]buf_cntthe character counts in buffer

◆ hex2str()

void hex2str ( unsigned char *  pbDest,
unsigned char *  pbSrc,
int  nLen 
)

convert the input hex array to string array

参数
[out]pbDestthe out string array
[in]pbSrcthe input hex array
[in]nLenthe length of input hex array
注解
the size of <pbDest> must >= nLen * 2, convert example 00-ff -> "00"-"FF"

◆ is_valid_version()

int is_valid_version ( char *  ver)

check the version input is valid

参数
[in]verthe version string
返回
1 on valid, 0 on invalid

◆ mm_strdup()

char * mm_strdup ( const char *  str)

duplicate input string, will malloc a new block of memory

参数
[in]strthe input string need to duplicate
返回
new string

◆ str_revr_find_ch()

int str_revr_find_ch ( const char *  str,
const int  revr_index,
const char  ch 
)

find <ch> in <str>, start find in index <revr_index>, find in reverse order.

参数
[in]strthe string for find
[in]revr_indexthe start index to find
[in]chthe character to find
返回
-2 on not found, -1 on invalid parameter, >=0 on the position of the character to find

◆ string2mac()

int string2mac ( const char *  str,
char  mac[6] 
)

convert mac address string to mac address array

参数
[in]strthe input mac address string
[out]macthe mac address array
返回
0 on success, others on failed.
警告
now only support valid mac address string: xxxxxxxxxxxx / xx-xx-xx-xx-xx-xx

◆ tuya_strncasecmp()

int tuya_strncasecmp ( const char *  s1,
const char *  s2,
size_t  n 
)

compare the first n characters of two string

参数
[in]s1the string 1
[in]s2the string 2
[in]nthe first n characters
返回
0 one equal, 1 on s1 longer than s2, -1 on s2 longer than s1

◆ versionString2int()

int versionString2int ( const char *  versionString)

convert version string to integer

参数
[in]versionStringthe input version string
返回
a integer version
注解
can support version string format x.y.z or x.y, for example: "1.0.1" to 0x010001 and "40.00" t0 0x2800