Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
J
jensen
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Skye Yu
jensen
Commits
d16340ea
Commit
d16340ea
authored
Jun 19, 2025
by
martin hou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 增加错误日志输出/增加对reconnect的兼容处理
parent
314ed70e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
17 deletions
+26
-17
index.css
src/index.css
+5
-0
index.tsx
src/index.tsx
+21
-17
No files found.
src/index.css
View file @
d16340ea
...
@@ -2,3 +2,8 @@
...
@@ -2,3 +2,8 @@
margin
:
0
;
margin
:
0
;
padding
:
0
;
padding
:
0
;
}
}
button
{
height
:
50px
;
font-size
:
14px
;
padding
:
0px
30px
;
}
\ No newline at end of file
src/index.tsx
View file @
d16340ea
...
@@ -10,7 +10,6 @@ export function Home() {
...
@@ -10,7 +10,6 @@ export function Home() {
const
[
devices
,
setDevices
]
=
useState
<
Jensen
.
BluetoothDevice
[]
>
([]);
const
[
devices
,
setDevices
]
=
useState
<
Jensen
.
BluetoothDevice
[]
>
([]);
const
[
greeting
,
setGreeting
]
=
useState
<
string
|
null
>
(
null
);
const
[
greeting
,
setGreeting
]
=
useState
<
string
|
null
>
(
null
);
/*
useEffect
(()
=>
{
useEffect
(()
=>
{
jensen
.
connect
();
jensen
.
connect
();
jensen
.
onconnect
=
()
=>
{
jensen
.
onconnect
=
()
=>
{
...
@@ -20,7 +19,6 @@ export function Home() {
...
@@ -20,7 +19,6 @@ export function Home() {
});
});
};
};
},
[]);
},
[]);
*/
const
getFilePart
=
()
=>
{
const
getFilePart
=
()
=>
{
const
file
=
files
[
4
];
const
file
=
files
[
4
];
...
@@ -192,7 +190,6 @@ export function Home() {
...
@@ -192,7 +190,6 @@ export function Home() {
usb
.
onconnect
=
(
evt
:
any
)
=>
{
usb
.
onconnect
=
(
evt
:
any
)
=>
{
console
.
log
(
evt
);
console
.
log
(
evt
);
}
}
/*
usb
.
getDevices
().
then
(
async
(
devices
:
any
[])
=>
{
usb
.
getDevices
().
then
(
async
(
devices
:
any
[])
=>
{
for
(
let
i
=
0
;
i
<
devices
.
length
;
i
++
)
for
(
let
i
=
0
;
i
<
devices
.
length
;
i
++
)
{
{
...
@@ -204,24 +201,31 @@ export function Home() {
...
@@ -204,24 +201,31 @@ export function Home() {
console
.
log
(
rst
);
console
.
log
(
rst
);
}
}
});
});
*/
}
const
test
=
async
()
=>
{
await
jensen
.
reconnect
();
let
rst
=
await
jensen
.
getDeviceInfo
();
if
(
rst
)
alert
(
rst
.
sn
+
' reconnected...'
);
else
alert
(
'what the fuck????'
);
}
}
return
(
return
(
<>
<>
<
div
style=
{
{
display
:
'flex'
,
flexDirection
:
'row'
,
gap
:
'16px'
,
padding
:
'16px'
,
alignItems
:
'center'
}
}
>
<
div
style=
{
{
display
:
'flex'
,
flexDirection
:
'row'
,
gap
:
'16px'
,
padding
:
'16px'
,
alignItems
:
'center'
,
flexWrap
:
'wrap'
}
}
>
<
button
style=
{
{
width
:
'200px'
,
height
:
'50px'
}
}
onClick=
{
connectx
}
>
连接
</
button
>
<
button
onClick=
{
connectx
}
>
连接
</
button
>
<
button
style=
{
{
width
:
'200px'
,
height
:
'50px'
}
}
onClick=
{
getFilePart
}
>
获取文件
</
button
>
<
button
onClick=
{
getFilePart
}
>
获取文件
</
button
>
<
button
style=
{
{
width
:
'200px'
,
height
:
'50px'
}
}
onClick=
{
writeSN
}
>
SN写号
</
button
>
<
button
onClick=
{
writeSN
}
>
SN写号
</
button
>
<
button
style=
{
{
width
:
'200px'
,
height
:
'50px'
}
}
onClick=
{
getTime
}
>
获取时间
</
button
>
<
button
onClick=
{
getTime
}
>
获取时间
</
button
>
<
button
style=
{
{
width
:
'200px'
,
height
:
'50px'
}
}
onClick=
{
listFiles
}
>
文件列表
</
button
>
<
button
onClick=
{
listFiles
}
>
文件列表
</
button
>
<
button
style=
{
{
width
:
'200px'
,
height
:
'50px'
}
}
onClick=
{
transferFile
}
>
传输文件
</
button
>
<
button
onClick=
{
transferFile
}
>
传输文件
</
button
>
<
button
style=
{
{
width
:
'200px'
,
height
:
'50px'
}
}
onClick=
{
getBluetoothStatus
}
>
蓝牙连接状态
</
button
>
<
button
onClick=
{
getBluetoothStatus
}
>
蓝牙连接状态
</
button
>
<
button
style=
{
{
width
:
'200px'
,
height
:
'50px'
}
}
onClick=
{
bluetoothScan
}
>
蓝牙扫描
</
button
>
<
button
onClick=
{
bluetoothScan
}
>
蓝牙扫描
</
button
>
<
button
style=
{
{
width
:
'200px'
,
height
:
'50px'
}
}
onClick=
{
disconnectBTDevice
}
>
蓝牙断开
</
button
>
<
button
onClick=
{
disconnectBTDevice
}
>
蓝牙断开
</
button
>
<
button
style=
{
{
width
:
'200px'
,
height
:
'50px'
}
}
onClick=
{
readFilePartial
}
>
Read File Partial
</
button
>
<
button
onClick=
{
readFilePartial
}
>
Read File Partial
</
button
>
<
button
style=
{
{
width
:
'200px'
,
height
:
'50px'
}
}
onClick=
{
updateDeviceTone
}
>
更新提示音
</
button
>
<
button
onClick=
{
updateDeviceTone
}
>
更新提示音
</
button
>
<
button
style=
{
{
width
:
'200px'
,
height
:
'50px'
}
}
onClick=
{
updateUAC
}
>
更新UAC
</
button
>
<
button
onClick=
{
updateUAC
}
>
更新UAC
</
button
>
<
button
onClick=
{
test
}
>
测试重连
</
button
>
</
div
>
</
div
>
<
div
id=
"files"
style=
{
{
padding
:
'0px 0px 0px 30px'
,
marginBottom
:
'20px'
}
}
>
<
div
id=
"files"
style=
{
{
padding
:
'0px 0px 0px 30px'
,
marginBottom
:
'20px'
}
}
>
<
h3
>
Files:
</
h3
>
<
h3
>
Files:
</
h3
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment