auto static method
Implementation
static WitsystemError auto(PlatformException e) {
var length = e.code.length;
if (length == 1 && e.code == "0") {
return NetError.error(0);
}
//判断小于是指令的异常
if (length < 5) {
return CommandError.error(e.code);
}
//等于5代表是网络异常
if (length == 5) {
return NetError.error(int.parse(e.code));
}
//等于6代表是蓝牙的异常
if (length == 6) {
return BleError.error(int.parse(e.code));
}
return NetError.unknown;
}