Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug报告 #8

Open
Leadrive opened this issue Apr 11, 2023 · 1 comment
Open

bug报告 #8

Leadrive opened this issue Apr 11, 2023 · 1 comment

Comments

@Leadrive
Copy link

	sequenceControl = parseInt(sequenceControl) + 1;
	if (sequenceControl>=256) sequenceControl=0;

sequenceControl>=256时,在aes加密中,会报错。好几个地方,都需要加上这句判断。

			uni.createBLEConnection({
				deviceId: options.deviceId,
				success: function(res) {
					let platform = uni.getSystemInfoSync().platform
					if (platform=="android") {
						uni.setBLEMTU({
							deviceId: options.deviceId,
							mtu: 128
						});
					}
					myself.data.deviceId = options.deviceId;
					xBlufi.notifyDeviceMsgEvent({
						type: xBlufi.XBLUFI_TYPE.TYPE_CONNECTED,
						result: true,
						data: {
							deviceId: options.deviceId,
							name: options.name
						}
					});
				},
				fail: function(res) {
					// {"type":"0","result":false,"data":{"errno":1509007,"errCode":-1,"errMsg":"createBLEConnection:fail:already connect"}}
					if (res.errno!=1509007) {
						myself.data.deviceId = null;
						xBlufi.notifyDeviceMsgEvent({
							type: xBlufi.XBLUFI_TYPE.TYPE_CONNECTED,
							result: false,
							data: res
						});
					}
				}
			});

fail有种情况是,已连成功,又报错,此时把deviceId = null,后导致判断错误。
我是在xBlufi.XBLUFI_TYPE.TYPE_INIT_ESP32_RESULT时,加了一句
myself.data.deviceId = deviceId // 可能在其它地方,被置空了,以此为准

@xuhongv
Copy link
Owner

xuhongv commented Jan 26, 2024

感谢分享

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants