更新记录
1.0.2(2025-08-16)
安卓支持网络(TCP/UDP)、蓝牙(SPP/BLE)、USB、串口等接口通讯。
能及时获知对端断开(TCP/SPP/BLE/USB)。
提供接口获取设备列表,可获取已配对蓝牙设备,当前接入的USB设备、串口设备。
提供统一的读、写、关闭接口,不同的端口使用不同的接口和参数打开。
自动缓存收取到的数据,应用程序可无阻塞直接读取数据。支持探查数据。
写入是独立线程自动发送的,提供接口获取发送缓冲区剩余数据,可等待发送缓冲区数据发送完成。
写数据可传递字节数组,base64字符串,hex字符串,也可以把字符串按指定编码下发。
全系列接口都可在一个函数里顺序执行,无需繁琐回调。
串口支持全部参数设置,比如波特率流控制等。
串口支持RTS CTS DTR DSR DCD RI等信号状态显示。可手动输出RTS和DTR信号,可当做GPIO使用。
USB打开时,自动判断并请求权限。USB可指定名称或vid和pid打开。
蓝牙BLE自动设置mtu,支持选择读写属性,支持大包发送,内部自动分包。
各项功能都经过长时间大量测试非常稳定。
平台兼容性
uni-app(4.07)
Vue2 | Vue3 | Chrome | Safari | app-vue | app-nvue | Android | iOS | 鸿蒙 |
---|---|---|---|---|---|---|---|---|
- | - | - | - | - | - | 5.0 | - | - |
微信小程序 | 支付宝小程序 | 抖音小程序 | 百度小程序 | 快手小程序 | 京东小程序 | 鸿蒙元服务 | QQ小程序 | 飞书小程序 | 快应用-华为 | 快应用-联盟 |
---|---|---|---|---|---|---|---|---|---|---|
- | - | - | - | - | - | - | - | - | - | - |
uni-app x(4.07)
Chrome | Safari | Android | iOS | 鸿蒙 | 微信小程序 |
---|---|---|---|---|---|
- | - | 5.0 | - | - | - |
wyj-ssioapi
开发文档
UTS 语法 UTS API插件 UTS uni-app兼容模式组件 UTS 标准模式组件 Hello UTS
插件概览
安卓支持网络(TCP/UDP)、蓝牙(SPP/BLE)、USB、串口等接口通讯。
能及时获知对端断开(TCP/SPP/BLE/USB)。
提供接口获取设备列表,可获取已配对蓝牙设备,当前接入的USB设备、串口设备。
提供统一的读、写、关闭接口,不同的端口使用不同的接口和参数打开。
自动缓存收取到的数据,应用程序可无阻塞直接读取数据。支持探查数据。
写入是独立线程自动发送的,提供接口获取发送缓冲区剩余数据,可等待发送缓冲区数据发送完成。
写数据可传递字节数组,base64字符串,hex字符串,也可以把字符串按指定编码下发。
全系列接口都可在一个函数里顺序执行,无需繁琐回调。
串口支持全部参数设置,比如波特率流控制等。
串口支持RTS CTS DTR DSR DCD RI等信号状态显示。可手动输出RTS和DTR信号,可当做GPIO使用。
USB打开时,自动判断并请求权限。USB可指定名称或vid和pid打开。
蓝牙BLE自动设置mtu,支持选择读写属性,支持大包发送,内部自动分包。
各项功能都经过长时间大量测试非常稳定。
插件调用流程
1 导入插件接口:
import * as SSIOAPI from "@/uni_modules/wyj-ssioapi";
2 声明端口句柄:
//打开端口之后会返回一个端口句柄,后续操作都基于这个句柄。
//可以通过SSIO_Port_GetPortHandleList这个接口获取未Close的端口。
//但最好是把这个句柄保存为全局变量,uniappx里面可以用模块导出这种方式组织和管理全局变量。
export let sppHandle = 0;
export let bleHandle = 0;
export let usbHandle = 0;
export let serHandle = 0;
export let tcpHandle = 0;
export let udpHandle = 0;
export const setSppHandle = (handle: number) => {
sppHandle = handle;
}
export const setBleHandle = (handle: number) => {
bleHandle = handle;
}
export const setUsbHandle = (handle: number) => {
usbHandle = handle;
}
export const setSerHandle = (handle: number) => {
serHandle = handle;
}
export const setTcpHandle = (handle: number) => {
tcpHandle = handle;
}
export const setUdpHandle = (handle: number) => {
udpHandle = handle;
}
3 打开端口:
判断端口是否已打开,如果没有打开才需要打开,如果已经打开了则跳过这一步
//如果端口未打开,则打开端口。
if (!SSIOAPI.SSIO_Port_IsOpened(handle)) {
if (this.usbProductName.length == 0) {
this.message = "请先选择USB设备";
uni.showToast({
title:"请先选择USB设备",
})
return;
}
this.message = "正在打开端口...";
let newHandle = SSIOAPI.SSIO_Port_OpenUsbWithProductName(this.usbProductName);
setUsbHandle(newHandle);
if (SSIOAPI.SSIO_Port_IsOpened(handle)) {
this.message = "端口打开成功";
var portInfoMap = SSIOAPI.SSIO_Port_GetPortInfoMap(handle);
console.log(portInfoMap);
} else {
this.message = "端口打开失败";
}
}
4 写数据
提供了多种接口,可接收各种参数
//写数据接口比较多,统一放到这里测试
export function Test_SSIO_Port_Write(handle:number) : boolean {
let arr = Uint8Array.of(0x30, 0x31, 0x32, 0x0D, 0x0A);
let written = SSIOAPI.SSIO_Port_WriteBytes(handle, arr);
console.log("written:" + written);
if (written <= 0) {
return false;
}
written = SSIOAPI.SSIO_Port_WriteBytesOfRange(handle, arr, 1, 4);
console.log("written:" + written);
if (written <= 0) {
return false;
}
let arr1 = Uint8Array.of(0x31, 0x31, 0x31, 0x0D, 0x0A);
let arr2 = Uint8Array.of(0x32, 0x32, 0x32, 0x0D, 0x0A);
let arrs:Array<Uint8Array> = [arr, arr1];
arrs.add(arr2);
written = SSIOAPI.SSIO_Port_WriteBytesList(handle, arrs);
console.log("written:" + written);
if (written <= 0) {
return false;
}
const arraybuffer = new ArrayBuffer(3)
const uint8array = new Uint8Array(arraybuffer)
uint8array.set([0x33, 0x34, 0x35])
const base64str = uni.arrayBufferToBase64(arraybuffer)
written = SSIOAPI.SSIO_Port_WriteBytesFromBase64String(handle, base64str);
console.log("written:" + written);
if (written <= 0) {
return false;
}
let hexstr = "36 37" + "38390d0a";
written = SSIOAPI.SSIO_Port_WriteBytesFromHexString(handle, hexstr);
console.log("written:" + written);
if (written <= 0) {
return false;
}
let hellostr = "hello\r\n";
written = SSIOAPI.SSIO_Port_WriteStringUsingEncoding(handle, hellostr, "UTF-8");
console.log("written:" + written);
if (written <= 0) {
return false;
}
written = SSIOAPI.SSIO_Port_WriteStringUsingUTF8Encoding(handle, hellostr);
console.log("written:" + written);
if (written <= 0) {
return false;
}
written = SSIOAPI.SSIO_Port_WriteStringUsingGBKEncoding(handle, hellostr);
console.log("written:" + written);
if (written <= 0) {
return false;
}
return true;
}
5 读数据
收到的数据是自动放到接收缓冲区的,提供了一系列接口处理收到的数据。
可获取当前接收缓冲区的数据长度,可探查已收取数据,也可以直接读取已收取数据
//周期性探查数据
setInterval(() => {
//周期执行 (100毫秒)
if (SSIOAPI.SSIO_Port_IsOpened(handle)) {
let receivedBytesCount = SSIOAPI.SSIO_Port_ReceivedBytesCount(handle);
let receivedBytes = "";
if (receivedBytesCount > 0) {
const arraybuffer = new ArrayBuffer(100)
const uint8array = new Uint8Array(arraybuffer)
let peekedCount = SSIOAPI.SSIO_Port_PeekReceivedBytes(handle, uint8array, 0, uint8array.length);
for (let i = 0; i < peekedCount; ++i) {
if (i < 3) {
receivedBytes += " " + uint8array[i].toString(16);
} else {
receivedBytes += " ...";
break;
}
}
//注意,Peek只是探查数据,并不会从接收缓冲区去除数据
//只有Read才会读取数据,并从接收缓冲区去除数据
}
this.received = "接收缓冲区当前数据(" + receivedBytesCount + ")" + receivedBytes;
} else {
this.received = " ";
}
}, 100);
//直接读取数据
let receivedBytesCount = SSIOAPI.SSIO_Port_ReceivedBytesCount(handle);
let receivedBytes = "";
if (receivedBytesCount > 0) {
const arraybuffer = new ArrayBuffer(receivedBytesCount)
const uint8array = new Uint8Array(arraybuffer)
let readedCount = SSIOAPI.SSIO_Port_ReadReceivedBytes(handle, uint8array, 0, uint8array.length);
for (let i = 0; i < readedCount; ++i) {
receivedBytes += uint8array[i].toString(16) + " ";
}
console.log(receivedBytes);
} else {
receivedBytes = "无数据可读";
}
this.message = receivedBytes;
6 关闭端口
除了usb和串口外,不建议写完数据马上关闭端口。
有些接口写完数据马上关闭端口,会导致系统缓冲区未发送完成的数据丢失
if (SSIOAPI.SSIO_Port_IsOpened(handle)) {
this.message = "正在关闭端口...";
SSIOAPI.SSIO_Port_Close(handle);
this.message = "端口已关闭";
}
7 列举当前已打开端口,获取相关信息
SSIO_Port_GetPortHandleList
SSIO_Port_GetPortInfoMap
8 权限配置和工程配置
权限依赖蓝牙权限和网络权限,库里面已经配置了,工程配置要把abiFilters勾上
具体参考例子的manifest.json文件,如下是部分关键片段
"app-android": {
"distribute": {
"modules": {},
"icons": {
"hdpi": "",
"xhdpi": "",
"xxhdpi": "",
"xxxhdpi": ""
},
"splashScreens": {
"default": {}
},
"abiFilters": [
"armeabi-v7a",
"arm64-v8a",
"x86",
"x86_64"
]
}
},
接口列表及说明
下列接口声明中,把后缀_FuncionType去掉就是接口名称
SSIO_API_Version
export type SSIO_API_Version_FuncionType = () => string;
获取插件版本
可用于验证插件是否正确加载,如果能取得版本号,证明插件配置成功。
SSIO_Port_OpenTcp
export type SSIO_Port_OpenTcp_FuncionType = (dest_ip:string, dest_port:number, local_ip:string, local_port:number, timeout_ms:number) => number;
打开TCP连接
dest_ip:目标IP
dest_port:目标端口
local_ip:是否绑定到特定本地IP,可不填
local_port:是否绑定到特定本地端口,可填0表示自动选择本地可用端口
timeout_ms:连接超时毫秒时间
返回端口句柄
SSIO_Port_OpenUdp
export type SSIO_Port_OpenUdp_FuncionType = (dest_ip:string, dest_port:number, local_ip:string, local_port:number) => number;
打开UDP连接
dest_ip:目标IP
dest_port:目标端口
local_ip:是否绑定到特定本地IP,可不填
local_port:是否绑定到特定本地端口,可填0表示自动选择本地可用端口
返回端口句柄
SSIO_Port_OpenBtSpp
export type SSIO_Port_OpenBtSpp_FuncionType = (address:string, secure:boolean, timeout_ms:number) => number;
打开蓝牙SPP连接
address:蓝牙地址,需要全大写
secure:是否是安全连接,true表示安全,false表示不安全。当服务器和客户端都使用不安全连接时,SPP连接无需密码即可通讯。
timeout_ms:连接超时毫秒时间
返回端口句柄
SSIO_Port_OpenBtBle
export type SSIO_Port_OpenBtBle_FuncionType = (address:string, timeout_ms:number) => number;
打开蓝牙BLE连接
address:蓝牙地址,可以通过搜索得到蓝牙设备信息
timeout_ms:连接超时毫秒时间
返回端口句柄
SSIO_Port_OpenUsb
export type SSIO_Port_OpenUsb_FuncionType = (matchingInfoMap:Map<string, string>) => number;
export type SSIO_Port_OpenUsbWithVidPid_FuncionType = (vid:number, pid:number) => number;
export type SSIO_Port_OpenUsbWithProductName_FuncionType = (productName:string) => number;
打开USB设备连接
matchingInfoMap:设备匹配信息。可任意指定一个或多个信息,匹配成功则打开对应的USB设备连接。
支持匹配的字段有:DeviceName、VendorId、ProductId、ManufacturerName、ProductName、SerialNumber、InterfaceClass、InterfaceSubclass、InterfaceProtocol。
如果无权限会自动申请权限,取得权限后会继续后续打开动作,使用方便。
返回端口句柄
SSIO_Port_OpenSerialPort
export type SSIO_Port_OpenSerialPort_FuncionType = (device:string, baudrate:number, databits:number, parity:number, stopbits:number, flowcontrol:number) => number;
打开串口设备连接
device:串口设备路径,比如/dev/ttyS0、/dev/ttyUSB0等。
baudrate:波特率
databits:数据位
parity:校验,支持0-无校验 1-奇校验 2-偶校验 3-标记校验 4-空白校验
stopbits:停止位 支持0-一位停止位 2-两位停止位
flowcontrol:流控制 支持0-无流控 1-XonXoff 2-RTS/CTS
返回端口句柄
SSIO_Port_IsOpened
export type SSIO_Port_IsOpened_FuncionType = (handle:number) => boolean;
端口是否已打开
handle:端口句柄
备注:TCP/SPP/BLE/USB这几个端口能识别到对端断开。串口和UDP识别不到。
SSIO_Port_Close
export type SSIO_Port_Close_FuncionType = (handle:number) => void;
关闭端口
handle:端口句柄
备注:如果端口不用了,要记得关闭端口。如果不关闭端口,并且也不保存句柄handle。
那么那个端口就相当于内部已经打开了,但是外面无法访问到,会有问题的。
提供了SSIO_Port_GetPortHandleList接口,可获取已Open未Close的端口列表。
SSIO_Port_GetPortHandleList
export type SSIO_Port_GetPortHandleList_FuncionType = () => Array<number>;
获取端口句柄列表
SSIO_Port_GetPortInfoMap
export type SSIO_Port_GetPortInfoMap_FuncionType = (handle:number) => Map<string, string>;
获取端口信息
handle:端口句柄
返回端口信息,console.log调试出来即可看到
SSIO_Port_TransmitBufferRemainingCount
export type SSIO_Port_TransmitBufferRemainingCount_FuncionType = (handle:number) => number;
获取发送缓冲区剩余数量
写数据是先写入到内部缓冲区,再由专门线程送出
handle:端口句柄
返回发送缓冲区剩余数量
SSIO_Port_WaitTransmitBufferEmpty
export type SSIO_Port_WaitTransmitBufferEmpty_FunctionType = (handle:number, timeout_ms:number) => number;
等待发送缓冲区空
handle:端口句柄
timeout_ms:等待超时ms时间
返回发送缓冲区剩余数量
SSIO_Port_WriteBytes
export type SSIO_Port_WriteBytes_FuncionType = (handle:number, arr:Uint8Array) => number;
写字节数组
handle:端口句柄
arr:字节数组
返回写入的字节数,返回-1表示写入失败。
SSIO_Port_WriteBytesOfRange
export type SSIO_Port_WriteBytesOfRange_FuncionType = (handle:number, arr:Uint8Array, offset:number, count:number) => number;
写字节数组,指定偏移和数量
handle:端口句柄
arr:字节数组
offset:偏移
count:数量
返回写入的字节数,返回-1表示写入失败。
SSIO_Port_WriteBytesList
export type SSIO_Port_WriteBytesList_FuncionType = (handle:number, arrs:Array<Uint8Array>) => number;
写字节数组列表
handle:端口句柄
arrs:字节数组列表
返回写入的字节数,返回-1表示写入失败。
SSIO_Port_WriteBytesFromBase64String
export type SSIO_Port_WriteBytesFromBase64String_FuncionType = (handle:number, str:string) => number;
写字节数组,由base64字符串解码然后下发
handle:端口句柄
str:字节数组的base64编码字符串
返回写入的字节数,返回-1表示写入失败。
SSIO_Port_WriteBytesFromHexString
export type SSIO_Port_WriteBytesFromHexString_FuncionType = (handle:number, str:string) => number;
写字节数组,由16进制字符串转成字节数组然后下发
handle:端口句柄
str:字节数组的16进制字符串
返回写入的字节数,返回-1表示写入失败。
SSIO_Port_WriteStringUsingEncoding
export type SSIO_Port_WriteStringUsingEncoding_FuncionType = (handle:number, str:string, encoding:string) => number;
将字符串按照指定编码发送
handle:端口句柄
str:要发送的字符串
encoding:指定的编码,比如"UTF-8","GBK"等
返回写入的字节数,返回-1表示写入失败。
备注:可通过SSIO_Encoding_GetAvailableEncodingList接口获取编码列表
SSIO_Port_WriteStringUsingUTF8Encoding
export type SSIO_Port_WriteStringUsingUTF8Encoding_FuncionType = (handle:number, str:string) => number;
将字符串按照UTF8编码发送
SSIO_Port_WriteStringUsingGBKEncoding
export type SSIO_Port_WriteStringUsingGBKEncoding_FuncionType = (handle:number, str:string) => number;
将字符串按照GBK编码发送
SSIO_Port_ReceivedBytesCount
export type SSIO_Port_ReceivedBytesCount_FuncionType = (handle:number) => number;
已接收字节数
handle:端口句柄
返回已接收字节数,调用Read接口会减小已接收字节数,调用Peek接口不会改变已接收字节数
SSIO_Port_SkipReceivedBytes
export type SSIO_Port_SkipReceivedBytes_FuncionType = (handle:number, count:number) => number;
忽略接收缓冲区已收取字节数
handle:端口句柄
count:要忽略的数量
返回实际忽略的字节数
SSIO_Port_ClearReceivedBytes
export type SSIO_Port_ClearReceivedBytes_FuncionType = (handle:number) => void;
清空接收缓冲区
handle:端口句柄
SSIO_Port_PeekReceivedBytes
export type SSIO_Port_PeekReceivedBytes_FuncionType = (handle:number, buffer:Uint8Array, offset:number, count:number) => number;
探查收取到的数据,仅查看接收缓冲区数据,而不改变接收缓冲区内容
handle:端口句柄
buffer:存放数据的缓冲区
offset:存放的起始偏移位置
count:欲接收的数据长度
返回探查到的数据长度
SSIO_Port_ReadReceivedBytes
export type SSIO_Port_ReadReceivedBytes_FuncionType = (handle:number, buffer:Uint8Array, offset:number, count:number) => number;
读取数据,会从接收缓冲区移除已读取的数据
如果一直不读取数据,接收缓冲区满之后,将不再收到新的数据
handle:端口句柄
buffer:存放数据的缓冲区
offset:存放的起始偏移位置
count:欲接收的数据长度
返回读取到的数据长度
SSIO_Port_BtBle_SetWriteCharacteristic
export type SSIO_Port_BtBle_SetWriteCharacteristic_FuncionType = (handle:number, characteristicUUIDString:string) => boolean;
指定BLE写属性
handle:端口句柄
characteristicUUIDString:属性UUID
SSIO_Port_BtBle_EnableCharacteristicNotification
export type SSIO_Port_BtBle_EnableCharacteristicNotification_FuncionType = (handle:number, characteristicUUIDString:string) => boolean;
启用BLE属性通知,只有启用了属性通知,才能自动收到对端传来的数据。
handle:端口句柄
characteristicUUIDString:属性UUID
SSIO_Port_BtBle_GetCharacteristicListWithWriteProperty
export type SSIO_Port_BtBle_GetCharacteristicListWithWriteProperty_FuncionType = (handle:number) => Array<string>;
获取BLE写属性列表
handle:端口句柄
SSIO_Port_BtBle_GetCharacteristicListWithNotifyProperty
export type SSIO_Port_BtBle_GetCharacteristicListWithNotifyProperty_FuncionType = (handle:number) => Array<string>;
获取BLE通知属性列表
handle:端口句柄
SSIO_BluetoothAdapter_HasBluetoothPermissions
export type SSIO_BluetoothAdapter_HasBluetoothPermissions_FuncionType = () => boolean;
检查是否有蓝牙权限,如果没有蓝牙权限,则搜不到蓝牙并且连不上蓝牙设备
SSIO_BluetoothAdapter_RequestBluetoothPermissions
export type SSIO_BluetoothAdapter_RequestBluetoothPermissions_FuncionType = (requestCode:number) => void;
请求蓝牙权限
requestCode:activity回调用的,可以随便填。比如11111。
SSIO_BluetoothAdapter_GetBondedDevices
export type SSIO_BluetoothAdapter_GetBondedDevices_FuncionType = () => Array<Map<string, string>>;
获得蓝牙已配对设备列表
SSIO_Port_SerialPort_GetModemStatus
export type SSIO_Port_SerialPort_GetModemStatus_FuncionType = (handle:number) => Map<string, string>;
获取串口Modem状态
handle:端口句柄
返回串口Modem状态
SSIO_Port_SerialPort_GetModemStatusRTS
export type SSIO_Port_SerialPort_GetModemStatusRTS_FuncionType = (handle:number) => number;
获取串口RTS状态
handle:端口句柄
返回信号是否有效,1表示信号处于有效电平,0表示信号处于无效电平,-1表示获取失败。
SSIO_Port_SerialPort_GetModemStatusCTS
export type SSIO_Port_SerialPort_GetModemStatusCTS_FuncionType = (handle:number) => number;
获取串口CTS状态
handle:端口句柄
返回信号是否有效,1表示信号处于有效电平,0表示信号处于无效电平,-1表示获取失败。
SSIO_Port_SerialPort_GetModemStatusDTR
export type SSIO_Port_SerialPort_GetModemStatusDTR_FuncionType = (handle:number) => number;
获取串口DTR状态
handle:端口句柄
返回信号是否有效,1表示信号处于有效电平,0表示信号处于无效电平,-1表示获取失败。
SSIO_Port_SerialPort_GetModemStatusDSR
export type SSIO_Port_SerialPort_GetModemStatusDSR_FuncionType = (handle:number) => number;
获取串口DSR状态
handle:端口句柄
返回信号是否有效,1表示信号处于有效电平,0表示信号处于无效电平,-1表示获取失败。
SSIO_Port_SerialPort_GetModemStatusDCD
export type SSIO_Port_SerialPort_GetModemStatusDCD_FuncionType = (handle:number) => number;
获取串口DCD状态
handle:端口句柄
返回信号是否有效,1表示信号处于有效电平,0表示信号处于无效电平,-1表示获取失败。
SSIO_Port_SerialPort_GetModemStatusRI
export type SSIO_Port_SerialPort_GetModemStatusRI_FuncionType = (handle:number) => number;
获取串口RI状态
handle:端口句柄
返回信号是否有效,1表示信号处于有效电平,0表示信号处于无效电平,-1表示获取失败。
SSIO_Port_SerialPort_SetModemStatusRTS
export type SSIO_Port_SerialPort_SetModemStatusRTS_FuncionType = (handle:number, status:number) => boolean;
设置串口RTS信号,可作为GPIO功能使用。如果打开端口时选了硬件流控,则不要控制这个信号。
handle:端口句柄
status:1表示设置信号为有效电平,0表示设置信号为无效电平
返回设置是否成功
SSIO_Port_SerialPort_SetModemStatusDTR
export type SSIO_Port_SerialPort_SetModemStatusDTR_FuncionType = (handle:number, status:number) => boolean;
设置串口DTR信号,可作为GPIO功能使用。如果打开端口时选了硬件流控,则不要控制这个信号。
handle:端口句柄
status:1表示设置信号为有效电平,0表示设置信号为无效电平
返回设置是否成功
SSIO_SerialPortFinder_GetDeviceList
export type SSIO_SerialPortFinder_GetDeviceList_FuncionType = () => Array<string>;
获取串口设备列表
SSIO_UsbManager_GetUsbDevices
export type SSIO_UsbManager_GetUsbDevices_FuncionType = () => Array<Map<string, string>>;
获取USB设备列表
SSIO_Encoding_GetAvailableEncodingList
export type SSIO_Encoding_GetAvailableEncodingList_FuncionType = () => Array<string>;
获取可用字符编码列表
SSIO_Encoding_GetStringFromBytesUsingEncoding
export type SSIO_Encoding_GetStringFromBytesUsingEncoding_FuncionType = (buffer:Uint8Array, encoding:string) => string;
将字节数组转为字符串
buffer:字节数组
encoding:代码页
返回转换后的字符串
SSIO_Encoding_GetBytesFromStringUsingEncoding
export type SSIO_Encoding_GetBytesFromStringUsingEncoding_FuncionType = (str:string, encoding:string) => Uint8Array;
将字符串转为字节数组
str:字符串
encoding:代码页
返回转换后的字节数组
SSIO_Thread_SleepMs
export type SSIO_Thread_SleepMs_FunctionType = (ms:number) => void;
延时一段时间