Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
GeliBusinessPlatform
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ljy
GeliBusinessPlatform
Commits
68cf9135
Commit
68cf9135
authored
Feb 27, 2021
by
lujunye
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
读取状态
parent
c61c367e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
0 deletions
+22
-0
GeliBusinessPlatform.xcworkspace/xcuserdata/junyelu.xcuserdatad/UserInterfaceState.xcuserstate
...erdata/junyelu.xcuserdatad/UserInterfaceState.xcuserstate
+0
-0
GeliBusinessPlatform/Define/Bridge_Header.h
GeliBusinessPlatform/Define/Bridge_Header.h
+3
-0
GeliBusinessPlatform/ViewController/蓝牙连接/BtViewController.m
GeliBusinessPlatform/ViewController/蓝牙连接/BtViewController.m
+19
-0
No files found.
GeliBusinessPlatform.xcworkspace/xcuserdata/junyelu.xcuserdatad/UserInterfaceState.xcuserstate
View file @
68cf9135
No preview for this file type
GeliBusinessPlatform/Define/Bridge_Header.h
View file @
68cf9135
...
...
@@ -30,4 +30,7 @@
#import "HLBLEManager.h"
#import "SVProgressHUD.h"
#import "BtViewController.h"
#import "HLPrinter.h"
#import "UIWebView+UIImage.h"
#endif
/* Bridge_Header_h */
GeliBusinessPlatform/ViewController/蓝牙连接/BtViewController.m
View file @
68cf9135
...
...
@@ -12,6 +12,8 @@
#import "HLPrinter.h"
#import "UIWebView+UIImage.h"
#import "Bt_Cell.h"
@interface
BtViewController
()
<
UITableViewDelegate
,
UITableViewDataSource
>
@property
(
weak
,
nonatomic
)
IBOutlet
UITableView
*
tableView
;
@property
(
strong
,
nonatomic
)
NSMutableArray
*
deviceArray
;
/**< 蓝牙设备个数 */
...
...
@@ -26,6 +28,20 @@
[
self
.
navigationController
popViewControllerAnimated
:
YES
];
}
/** 接收到数据回调 */
-
(
void
)
peripheral
:(
CBPeripheral
*
)
peripheral
didUpdateValueForCharacteristic
:(
CBCharacteristic
*
)
characteristic
error
:(
NSError
*
)
error
{
NSData
*
data
=
characteristic
.
value
;
//获取到的数据
NSLog
(
@"bbb-----%@----"
,
data
);
//打印出来应该是<01a5>这样的数据,可以通过下面的方式去判断一些自己想要的逻辑
Byte
*
resultByte
=
(
Byte
*
)[
data
bytes
];
if
(
data
.
length
>=
1
){
if
(
resultByte
[
0
]
==
16
){
//16代表前两位的值
NSLog
(
@"---打印机打开---"
);
}
else
if
(
resultByte
[
0
]
==
1
){
//01
NSLog
(
@"----打印机缺纸-----"
);
}
}
//下面的处理方式我没处理过,大家可以试试
}
-
(
void
)
viewDidLoad
{
[
super
viewDidLoad
];
// Do any additional setup after loading the view from its nib.
...
...
@@ -128,8 +144,10 @@
CBPeripheral
*
peripheral
=
dict
[
@"peripheral"
];
[
self
.
selectArray
addObject
:
peripheral
];
[
self
loadBLEInfo
];
[
tableView
reloadData
];
}
else
{
[
_manager
cancelPeripheralConnection
];
}
...
...
@@ -218,6 +236,7 @@
CBPeripheral
*
perpheral
=
_selectArray
.
firstObject
;
HLBLEManager
*
manager
=
[
HLBLEManager
sharedInstance
];
_manager
=
manager
;
[
manager
connectPeripheral
:
perpheral
connectOptions:
@{
CBConnectPeripheralOptionNotifyOnDisconnectionKey
:
@
(
YES
)}
stopScanAfterConnected:
YES
...
...
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