This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface NetConfigStep { | |
/* 配网引导内容 */ | |
content: { | |
[key: string]: string | |
} | |
/* 文件地址URL */ | |
file_url: string | |
id?: number | |
/* 配网类型,支持 BLE、AP、EZ、ZB、ZBN */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function strToUtf8Bytes(str = '') { | |
const utf8: number[] = []; | |
for (let i = 0; i < str.length; i++) { | |
let charCode = str.charCodeAt(i); | |
if (charCode < 0x80) utf8.push(charCode); | |
else if (charCode < 0x800) { | |
utf8.push(0xc0 | (charCode >> 6), 0x80 | (charCode & 0x3f)); | |
} else if (charCode < 0xd800 || charCode >= 0xe000) { | |
utf8.push(0xe0 | (charCode >> 12), 0x80 | ((charCode >> 6) & 0x3f), 0x80 | (charCode & 0x3f)); | |
} else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static byte[] encrypt(byte[] plain, String key) throws Exception { | |
if (plain == null) { | |
throw new Exception("plain cannot be null"); | |
} | |
if (key == null) { | |
throw new Exception("key cannot be null"); | |
} | |