Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wx-school-app-public
Project
Overview
Details
Activity
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
姜雷
wx-school-app-public
Commits
49cc78c0
Commit
49cc78c0
authored
Mar 30, 2020
by
姜雷
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改设备交互问题
parent
8fcc8624
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
7 deletions
+15
-7
connect.tsx
src/pages/connect/connect.tsx
+15
-7
No files found.
src/pages/connect/connect.tsx
View file @
49cc78c0
...
...
@@ -223,10 +223,10 @@ class Connect extends Component {
index
++
)
{
let
str
=
msgObj
.
data
.
substring
(
index
*
20
,
(
index
+
1
)
*
20
);
t
his
.
sendMessageToDevice
(
str
);
currentThis
&&
currentT
his
.
sendMessageToDevice
(
str
);
}
}
else
{
t
his
.
sendMessageToDevice
(
msgObj
.
data
);
currentThis
&&
currentT
his
.
sendMessageToDevice
(
msgObj
.
data
);
}
}
else
if
(
msgObj
.
type
===
0
)
{
if
(
msgObj
.
contorlCode
===
ContorlCode
.
using
)
{
...
...
@@ -402,9 +402,9 @@ class Connect extends Component {
Taro
.
onBluetoothAdapterStateChange
(
res
=>
{
console
.
log
(
'adapterState changed, now is'
,
res
);
if
(
res
.
available
)
{
this
.
setState
({
bluetoothState
:
true
,
});
//
this.setState({
//
bluetoothState: true,
//
});
}
});
});
...
...
@@ -639,7 +639,15 @@ class Connect extends Component {
serviceId
:
deviceInfo
.
serviceId
,
characteristicId
:
deviceInfo
.
writeId
,
value
:
str2ab
(
msg
),
});
})
.
then
(
res
=>
{
console
.
log
(
'蓝牙发送结果'
,
res
);
})
.
catch
(
err
=>
{
console
.
log
(
'蓝牙发送结果'
,
err
);
});
}
else
{
console
.
log
(
'无蓝牙设备writeId'
);
}
}
...
...
@@ -694,7 +702,7 @@ class Connect extends Component {
}
openNotify
({
notifyId
,
writeId
,
readId
})
{
console
.
log
(
notifyId
,
writeId
,
readId
);
console
.
log
(
'==============='
,
notifyId
,
writeId
,
readId
);
this
.
setState
(({
deviceInfo
}:
PageState
)
=>
({
deviceInfo
:
{
...
deviceInfo
,
...
...
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