TuyaOS
mix_method.h
浏览该文件的文档.
1
10#ifndef _MIX_METHOD_H
11#define _MIX_METHOD_H
12
13#include "tuya_cloud_types.h"
14
15#ifdef __cplusplus
16 extern "C" {
17#endif
18
19#define BITMASK(bit) (1 << (bit))
20// 获取某bit位数据
21#define GETBIT(val,bit) (((val) & BITMASK(bit)) > 0)
22// 设置某bit位数据为1
23#define SETBIT(val,bit) ((val) |= BITMASK(bit))
24// 设置某bit位数据为0
25#define RESETBIT(val,bit) ((val) &= ~BITMASK(bit))
26
36int tuya_strncasecmp(const char *s1, const char *s2, size_t n);
37
44unsigned char asc2hex(char asccode);
45
53void ascs2hex(unsigned char *hex,unsigned char *ascs,int srclen);
54
64void hex2str(unsigned char *pbDest, unsigned char *pbSrc, int nLen);
65void byte2str(unsigned char *pbDest, unsigned char *pbSrc, int nLen, bool_t upper);
66
75int str_revr_find_ch(const char *str,const int revr_index,const char ch);
76
84void byte_sort(unsigned char is_ascend, unsigned char *buf, int buf_cnt);
85
92char *mm_strdup(const char *str);
93
100int is_valid_version(char *ver);
101
111int string2mac(const char *str, char mac[6]);
112
122int versionString2int(const char* versionString);
123
124int tuya_isalpha(int c);
125int tuya_tolower(int c);
126int tuya_toupper(int c);
127
128
129#ifdef __cplusplus
130}
131#endif
132#endif
133
int string2mac(const char *str, char mac[6])
convert mac address string to mac address array
void hex2str(unsigned char *pbDest, unsigned char *pbSrc, int nLen)
convert the input hex array to string array
int tuya_strncasecmp(const char *s1, const char *s2, size_t n)
compare the first n characters of two string
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 versionString2int(const char *versionString)
convert version string to integer
void ascs2hex(unsigned char *hex, unsigned char *ascs, int srclen)
convert the character array to hex array
unsigned char asc2hex(char asccode)
convert character to hex, if '0'-'f'/'F' -> 0-15, else 0
int is_valid_version(char *ver)
check the version input is valid
void byte_sort(unsigned char is_ascend, unsigned char *buf, int buf_cnt)
sort the char in the buf according ascii value