Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
colorfulSchoolReconsitution
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
2
Merge Requests
2
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
刘卓鑫
colorfulSchoolReconsitution
Commits
be11be68
Commit
be11be68
authored
Sep 29, 2019
by
刘卓鑫
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ad广告修改
parent
64eb0052
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
92 additions
and
45 deletions
+92
-45
ColorfulSchool.xcscheme
....xcodeproj/xcshareddata/xcschemes/ColorfulSchool.xcscheme
+11
-15
UserInterfaceState.xcuserstate
...ata/liuzhuoxin.xcuserdatad/UserInterfaceState.xcuserstate
+0
-0
AppDelegate.m
ColorfulSchool/ColorfulSchool/AppDelegate.m
+1
-1
ZXAdViewAdTool.m
...l/ColorfulSchool/Classes/AD(广告)/ADViewAd/ZXAdViewAdTool.m
+2
-3
ZXAdViewService.m
.../ColorfulSchool/Classes/AD(广告)/ADViewAd/ZXAdViewService.m
+3
-3
ZXHomePageViewController.m
...ge(首页)/0801HomePage/Controller/ZXHomePageViewController.m
+26
-8
ZXBathViewController.m
...ePage(首页)/Operation(自助服务)/bath(洗浴)/ZXBathViewController.m
+49
-15
No files found.
ColorfulSchool/ColorfulSchool.xcodeproj/xcshareddata/xcschemes/ColorfulSchool.xcscheme
View file @
be11be68
...
...
@@ -27,6 +27,15 @@
selectedDebuggerIdentifier =
"Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier =
"Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv =
"YES"
>
<MacroExpansion>
<BuildableReference
BuildableIdentifier =
"primary"
BlueprintIdentifier =
"9142D2B61F35C84E004F90CF"
BuildableName =
"ColorfulSchool.app"
BlueprintName =
"ColorfulSchool"
ReferencedContainer =
"container:ColorfulSchool.xcodeproj"
>
</BuildableReference>
</MacroExpansion>
<Testables>
<TestableReference
skipped =
"NO"
>
...
...
@@ -49,17 +58,6 @@
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier =
"primary"
BlueprintIdentifier =
"9142D2B61F35C84E004F90CF"
BuildableName =
"ColorfulSchool.app"
BlueprintName =
"ColorfulSchool"
ReferencedContainer =
"container:ColorfulSchool.xcodeproj"
>
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration =
"Debug"
...
...
@@ -81,11 +79,9 @@
ReferencedContainer =
"container:ColorfulSchool.xcodeproj"
>
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration =
"
Release
"
buildConfiguration =
"
Debug
"
shouldUseLaunchSchemeArgsEnv =
"YES"
savedToolIdentifier =
""
useCustomWorkingDirectory =
"NO"
...
...
@@ -105,7 +101,7 @@
buildConfiguration =
"Debug"
>
</AnalyzeAction>
<ArchiveAction
buildConfiguration =
"
Release
"
buildConfiguration =
"
Debug
"
revealArchiveInOrganizer =
"YES"
>
</ArchiveAction>
</Scheme>
ColorfulSchool/ColorfulSchool.xcworkspace/xcuserdata/liuzhuoxin.xcuserdatad/UserInterfaceState.xcuserstate
View file @
be11be68
No preview for this file type
ColorfulSchool/ColorfulSchool/AppDelegate.m
View file @
be11be68
...
...
@@ -64,7 +64,7 @@
_isPlaying
=
NO
;
//启动环境
[
APIManager
sharedAPIManager
].
lauchEnvironment
=
ZXColorfulSchoolEnvironment
Produc
t
;
[
APIManager
sharedAPIManager
].
lauchEnvironment
=
ZXColorfulSchoolEnvironment
Tes
t
;
//极光推送
[
self
initPushWithOptions
:
launchOptions
isProduct
:
YES
];
...
...
ColorfulSchool/ColorfulSchool/Classes/AD(广告)/ADViewAd/ZXAdViewAdTool.m
View file @
be11be68
//
//
...
...
@@ -23,8 +23,7 @@
-
(
void
)
startLauchAd
{
NSString
*
url
=
[[
NSString
stringWithFormat
:
@"http://open.adview.cn/agent/openRequest.do?ver=2.7.0&n=1&appid=SDK20191516030954opvyhmi3khwalbw&pt=4&posId=POSIDn5ahrkelm20e&pack=com.pxkjformal.parallelcampus&w=%f&h=%f&tab=0&ip=%@&os=1&bdr=%@&tp=%@&brd=Apple&ua=%@&sw=%f&sh=%f&deny=%f&sn=%@&mac=%@&didsha1=%@&dpidsha1=%@&macsha1=%@&didmd5=%@&dpidmd5=%@&macmd5=%@&nt=%@&nop=%@&country=ISO-3166-1 Alpha-3&language=alpha-2/ISO 639- 1&tm=0&time=%@&token=%@"
,
kScreenWidth
,
kScreenHeight
,
[
BYHelp
getIPAddress
],
[[
UIDevice
currentDevice
]
systemVersion
],
[
ZXTool
getCurrentDevice
],
[
ZXTool
returnUserAgent
],
kScreenWidth
,
kScreenHeight
,
[
UIScreen
mainScreen
].
scale
,
[[[
ASIdentifierManager
sharedManager
]
advertisingIdentifier
]
UUIDString
],
[
self
macAddress
],
[
self
iemi
],[
self
sha1
:[[[
ASIdentifierManager
sharedManager
]
advertisingIdentifier
]
UUIDString
]],
[
self
sha1
:[
self
macAddress
]],
[
ZXTool
md5
:[
self
iemi
]],
[
ZXTool
md5
:[[[
ASIdentifierManager
sharedManager
]
advertisingIdentifier
]
UUIDString
]],
[
ZXTool
md5
:[
self
macAddress
]],
[
ZXTool
returnNetworkStatus
]
==
1
?
@"WIFI"
:
@"4G"
,
[
ZXTool
currentYYS
],
[
ZXTool
getCurrentTimeStamp
],
[
ZXTool
md5
:[
NSString
stringWithFormat
:
@"SDK20191516030954opvyhmi3khwalbw%@"
,
[[[
ASIdentifierManager
sharedManager
]
advertisingIdentifier
]
UUIDString
]]]]
stringByAddingPercentEscapesUsingEncoding
:
NSUTF8StringEncoding
];
NSString
*
url
=
[[
NSString
stringWithFormat
:
@"http://open.adview.cn/agent/openRequest.do?ver=2.7.0&n=1&appid=SDK20191516030954opvyhmi3khwalbw&pt=4&posId=POSIDn5ahrkelm20e&pack=com.pxkjformal.parallelcampus&w=640&h=960&tab=0&ip=%@&os=1&bdr=%@&tp=%@&brd=Apple&ua=%@&sw=%f&sh=%f&deny=%f&sn=%@&mac=%@&didsha1=%@&dpidsha1=%@&macsha1=%@&didmd5=%@&dpidmd5=%@&macmd5=%@&nt=%@&nop=%@&country=ISO-3166-1 Alpha-3&language=alpha-2/ISO 639- 1&tm=0&time=%@&token=%@&html5=2"
,
[
BYHelp
getIPAddress
],
[[
UIDevice
currentDevice
]
systemVersion
],
[
ZXTool
getCurrentDevice
],
[
ZXTool
returnUserAgent
],
kScreenWidth
,
kScreenHeight
,
[
UIScreen
mainScreen
].
scale
,
[[[
ASIdentifierManager
sharedManager
]
advertisingIdentifier
]
UUIDString
],
[
self
macAddress
],
[
self
iemi
],[
self
sha1
:[[[
ASIdentifierManager
sharedManager
]
advertisingIdentifier
]
UUIDString
]],
[
self
sha1
:[
self
macAddress
]],
[
ZXTool
md5
:[
self
iemi
]],
[
ZXTool
md5
:[[[
ASIdentifierManager
sharedManager
]
advertisingIdentifier
]
UUIDString
]],
[
ZXTool
md5
:[
self
macAddress
]],
[
ZXTool
returnNetworkStatus
]
==
1
?
@"WIFI"
:
@"4G"
,
[
ZXTool
currentYYS
],
[
ZXTool
getCurrentTimeStamp
],
[
ZXTool
md5
:[
NSString
stringWithFormat
:
@"SDK20191516030954opvyhmi3khwalbw%@"
,
[[[
ASIdentifierManager
sharedManager
]
advertisingIdentifier
]
UUIDString
]]]]
stringByAddingPercentEscapesUsingEncoding
:
NSUTF8StringEncoding
];
// NSDictionary *dic = @{@"ver":@"4.0.1",@"n":@"1", @"appid":@"SDK20191516030954opvyhmi3khwalbw",@"pt":@"4", @"posId":@"POSIDn5ahrkelm20e", @"pack":@"com.pxkjformal.parallelcampus", @"w":@(kScreenWidth), @"h":@(kScreenHeight), @"tab":@"0", @"ip":[BYHelp getIPAddress], @"bdr":[[UIDevice currentDevice] systemVersion], @"tp":@"", @"brd":@"Apple", @"ua":[ZXTool getCurrentDevice], @"sw":@(kScreenWidth), @"sh":@(kScreenHeight), @"deny":@([UIScreen mainScreen].scale), @"sn":@"867FD2E0-F1FB-4D05-B3AE-383951FEE6EA", @"mac":[self macAddress], @"didsha1":[self iemi], @"dpidsha1":[self sha1:[[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString]], @"macsha1":[self sha1:[self macAddress]], @"didmd5":[ZXTool md5:[self iemi]], @"dpidmd5":[ZXTool md5:[[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString]], @"macmd5":[ZXTool md5:[self macAddress]], @"nt":([ZXTool returnNetworkStatus]==1?@"WIFI":@"4G"), @"nop":[ZXTool currentYYS], @"country":@"ISO-3166-1 Alpha-3", @"language":@"alpha-2/ISO639- 1", @"tm":@"0", @"time":[ZXTool getCurrentTimeStamp], @"token":[ZXTool md5:[NSString stringWithFormat:@"SDK20191516030954opvyhmi3khwalbw%@", [[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString]]]};
[[
ZXAdViewService
sharedManager
]
POST
:
url
parameters
:
nil
success
:^
(
NSURLSessionDataTask
*
_Nonnull
task
,
id
_Nonnull
responseObject
)
{
dispatch_async
(
dispatch_get_main_queue
(),
^
{
...
...
ColorfulSchool/ColorfulSchool/Classes/AD(广告)/ADViewAd/ZXAdViewService.m
View file @
be11be68
//
//
...
...
@@ -61,7 +61,7 @@
}
for
(
NSArray
*
arr
in
[
dic
allValues
])
{
for
(
NSString
*
url
in
arr
)
{
[[
self
sharedManager
]
GET
:
url
parameters
:
nil
success
:^
(
NSURLSessionDataTask
*
_Nonnull
task
,
id
_Nonnull
responseObject
)
{
[[
self
sharedManager
]
GET
:
[
url
stringByAddingPercentEscapesUsingEncoding
:
NSUTF8StringEncoding
]
parameters
:
nil
success
:^
(
NSURLSessionDataTask
*
_Nonnull
task
,
id
_Nonnull
responseObject
)
{
NSLog
(
@"xx"
);
}
failure
:^
(
NSURLSessionDataTask
*
_Nullable
task
,
NSError
*
_Nonnull
error
)
{
NSLog
(
@"xx"
);
...
...
@@ -75,7 +75,7 @@
return
;
}
for
(
NSString
*
url
in
arr
)
{
[[
self
sharedManager
]
GET
:
url
parameters
:
nil
success
:^
(
NSURLSessionDataTask
*
_Nonnull
task
,
id
_Nonnull
responseObject
)
{}
failure
:^
(
NSURLSessionDataTask
*
_Nullable
task
,
NSError
*
_Nonnull
error
)
{}];
[[
self
sharedManager
]
GET
:
[
url
stringByAddingPercentEscapesUsingEncoding
:
NSUTF8StringEncoding
]
parameters
:
nil
success
:^
(
NSURLSessionDataTask
*
_Nonnull
task
,
id
_Nonnull
responseObject
)
{}
failure
:^
(
NSURLSessionDataTask
*
_Nullable
task
,
NSError
*
_Nonnull
error
)
{}];
}
}
+
(
AFHTTPSessionManager
*
)
sharedManager
...
...
ColorfulSchool/ColorfulSchool/Classes/HomePage(首页)/0801HomePage/Controller/ZXHomePageViewController.m
View file @
be11be68
//
//
...
...
@@ -35,6 +35,9 @@
#import "enlargeClickRegionBtn.h"
#import "CropImageController.h"
#import "ZXAdViewService.h"
#import "ZXBannerJumpViewController.h"
@interface
ZXHomePageViewController
()
<
UITableViewDelegate
,
UITableViewDataSource
,
UINavigationControllerDelegate
,
UIImagePickerControllerDelegate
,
CropImageDelegate
>
/** tableview */
@property
(
nonatomic
,
strong
)
UITableView
*
myTableView
;
...
...
@@ -92,14 +95,28 @@
[[
NSNotificationCenter
defaultCenter
]
addObserver
:
self
selector
:
@selector
(
changeUserNameAction
:
)
name
:
@"changeUserNameNotification"
object
:
nil
];
//测试按钮
// UIButton *btn = [[UIButton alloc] initWithFrame:CGRectMake(100, kScreenHeight - 150, 80, 80)];
// [self.view addSubview:btn];
// btn.backgroundColor = [UIColor orangeColor];
// [[btn rac_signalForControlEvents:UIControlEventTouchDown] subscribeNext:^(id x) {
// UIViewController *vc = [[NSClassFromString(@"DC_ZXWashTabbarViewController") alloc] init];
// vc.hidesBottomBarWhenPushed = YES;
UIButton
*
btn
=
[[
UIButton
alloc
]
initWithFrame
:
CGRectMake
(
100
,
kScreenHeight
-
150
,
80
,
80
)];
[
self
.
view
addSubview
:
btn
];
btn
.
backgroundColor
=
[
UIColor
orangeColor
];
[[
btn
rac_signalForControlEvents
:
UIControlEventTouchDown
]
subscribeNext
:
^
(
id
x
)
{
[[
ZXAdViewService
sharedManager
]
GET
:
@"http://192.168.1.145:8081/alimama/taobao/tbk/dg/optimus/material"
parameters
:
nil
success
:^
(
NSURLSessionDataTask
*
_Nonnull
task
,
id
_Nonnull
responseObject
)
{
NSString
*
ss
=
responseObject
[
@"data"
][
@"tbk_uatm_favorites_item_get_response"
][
@"results"
][
@"uatm_tbk_item"
][
0
][
@"item_url"
];
NSLog
(
@"%@"
,
ss
);
UIPasteboard
*
pasteboard
=
[
UIPasteboard
generalPasteboard
];
pasteboard
.
string
=
@"¥20s6YM1uv7v¥"
;
[[
UIApplication
sharedApplication
]
openURL
:[
NSURL
URLWithString
:
@"taobao://item.taobao.com"
]];
// ZXBannerJumpViewController *vc = [[ZXBannerJumpViewController alloc] init];
// vc.jumpUrl = ss;
// [self.navigationController pushViewController:vc animated:YES];
// }];
}
failure
:^
(
NSURLSessionDataTask
*
_Nullable
task
,
NSError
*
_Nonnull
error
)
{
NSLog
(
@"%@"
,
error
);
}];
}];
}
-
(
void
)
viewWillLayoutSubviews
{
[
super
viewWillLayoutSubviews
];
...
...
@@ -167,6 +184,7 @@
bottomH
=
34
;
}
_myTableView
=
[[
UITableView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
kTopHeight
+
13
*
k6Scale
,
kScreenWidth
,
kScreenHeight
-
bottomH
-
49
-
kTopHeight
-
13
*
k6Scale
)
style
:
UITableViewStyleGrouped
];
// _myTableView.contentInset = UIEdgeInsetsMake(6 * k6Scale, 0, 0, 0);
_myTableView
.
delegate
=
self
;
_myTableView
.
dataSource
=
self
;
...
...
ColorfulSchool/ColorfulSchool/Classes/HomePage(首页)/Operation(自助服务)/bath(洗浴)/ZXBathViewController.m
View file @
be11be68
//
//
...
...
@@ -63,7 +63,8 @@
@property
(
nonatomic
,
strong
)
NSArray
*
balances
;
/** 蓝牙未连接成功的情况下 保存socket发送的消息 */
@property
(
nonatomic
,
strong
)
NSMutableArray
*
tempData
;
@end
...
...
@@ -92,8 +93,8 @@
//初始化socket
self
.
clientSocket
=
[[
GCDAsyncSocket
alloc
]
initWithDelegate
:
self
delegateQueue
:
dispatch_get_main_queue
()];
//开始建立连接
[
self
.
clientSocket
connectToHost
:[
kUserDefaults
objectForKey
:
@"BATHSocketUrl"
]
onPort
:[[
kUserDefaults
objectForKey
:
@"BATHSocketPort"
]
integerValue
]
viaInterface
:
nil
withTimeout
:-
1
error
:
nil
];
NSLog
(
@"😇😇😇😇😇😇 socket开始连接---%@"
,
[
ZXTool
getTimeNow
]);
//
[self.clientSocket connectToHost:[kUserDefaults objectForKey:@"BATHSocketUrl"] onPort:[[kUserDefaults objectForKey:@"BATHSocketPort"] integerValue] viaInterface:nil withTimeout:-1 error:nil];
//
NSLog(@"😇😇😇😇😇😇 socket开始连接---%@", [ZXTool getTimeNow]);
@weakify
(
self
);
[[[
NSNotificationCenter
defaultCenter
]
rac_addObserverForName
:
kSelf_help_start_timer
object
:
nil
]
subscribeNext
:^
(
id
x
)
{
...
...
@@ -129,7 +130,12 @@
}
return
_balances
;
}
-
(
NSMutableArray
*
)
tempData
{
if
(
_tempData
==
nil
)
{
_tempData
=
[
NSMutableArray
new
];
}
return
_tempData
;
}
-
(
void
)
setDefaultModel
:
(
NSInteger
)
defaultModel
{
_defaultModel
=
defaultModel
;
if
(
_defaultModel
==
1
||
_defaultModel
==
2
)
{
...
...
@@ -380,6 +386,9 @@
return
;
}
NSLog
(
@"😇😇😇😇😇😇 开始搜索蓝牙---%@"
,
[
ZXTool
getTimeNow
]);
[
self
.
tempData
removeAllObjects
];
[
self
.
clientSocket
connectToHost
:[
kUserDefaults
objectForKey
:
@"BATHSocketUrl"
]
onPort
:[[
kUserDefaults
objectForKey
:
@"BATHSocketPort"
]
integerValue
]
viaInterface
:
nil
withTimeout
:-
1
error
:
nil
];
dispatch_after
(
dispatch_time
(
DISPATCH_TIME_NOW
,
(
int64_t
)(
0
.
5
*
NSEC_PER_SEC
)),
dispatch_get_main_queue
(),
^
{
[
self
sendMessage
:[
NSString
stringWithFormat
:
@"{<%@>}"
,
self
.
currentPeripheralName
]];
self
.
isServiceCut
=
NO
;
//标记为开始
self
.
startDrink
.
enabled
=
NO
;
//按钮不可点击
...
...
@@ -387,15 +396,21 @@
//开始搜索设备的时候触发
[
self
checkBluetoothConectStatus
];
[
SVProgressHUD
showWithStatus
:
@"蓝牙连接中..."
];
});
}
#pragma mark - ==========点击了开始按钮 5s后检测蓝牙连接状态==========
-
(
void
)
checkBluetoothConectStatus
{
// [ZXTool showLoadingAnimation];
NSInteger
times
=
5
;
NSInteger
times
=
0
.
2
;
if
(
self
.
clientSocket
.
isConnected
==
NO
)
{
times
+=
0
.
5
;
[
self
.
clientSocket
connectToHost
:[
kUserDefaults
objectForKey
:
@"BATHSocketUrl"
]
onPort
:[[
kUserDefaults
objectForKey
:
@"BATHSocketPort"
]
integerValue
]
viaInterface
:
nil
withTimeout
:-
1
error
:
nil
];
}
if
(
self
.
currentBluetooth
.
isOnlyBluetooth
)
{
times
=
10
;
times
=
5
;
}
//5s之后查询蓝牙连接状态
dispatch_after
(
dispatch_time
(
DISPATCH_TIME_NOW
,
(
int64_t
)(
times
*
NSEC_PER_SEC
)),
dispatch_get_main_queue
(),
^
{
...
...
@@ -484,6 +499,8 @@
dispatch_async
(
dispatch_get_main_queue
(),
^
{
ZXBluetoothModel
*
m
=
[
ZXBluetoothModel
mj_objectWithKeyValues
:
common
.
data
];
[
ZXBluetoothModel
clearTable
];
self
.
currentPeripheralName
=
m
.
code
;
[
self
sendDeviceInfoToSocketByTimes
:
3
];
[
m
save
];
self
.
numberLabel
.
text
=
[
NSString
stringWithFormat
:
@"设备名称:%@"
,
m
.
code
];
self
.
addressLabel
.
text
=
[
NSString
stringWithFormat
:
@"设备地址:%@"
,
m
.
position
];
...
...
@@ -768,7 +785,7 @@
//初始化socket
self
.
clientSocket
=
[[
GCDAsyncSocket
alloc
]
initWithDelegate
:
self
delegateQueue
:
dispatch_get_main_queue
()];
}
if
(
self
.
isSocketConnected
==
NO
)
{
if
(
self
.
isSocketConnected
==
NO
||
self
.
clientSocket
.
isConnected
==
NO
)
{
//开始建立连接
[
self
.
clientSocket
connectToHost
:[
kUserDefaults
objectForKey
:
@"BATHSocketUrl"
]
onPort
:[[
kUserDefaults
objectForKey
:
@"BATHSocketPort"
]
integerValue
]
viaInterface
:
nil
withTimeout
:-
1
error
:
nil
];
}
...
...
@@ -831,6 +848,8 @@
#pragma mark - ==========scoket==========
// 发送空消息
-
(
void
)
sendMessage
:
(
NSString
*
)
msg
{
NSData
*
data
=
[
msg
dataUsingEncoding
:
NSUTF8StringEncoding
];
// withTimeout -1 : 无穷大,一直等
// tag : 消息标记
...
...
@@ -850,9 +869,10 @@
self
.
isSocketConnected
=
YES
;
NSLog
(
@"😇😇😇😇😇😇 socket连接成功---%@"
,
[
ZXTool
getTimeNow
]);
//断开重连的时候发送一下设备信息(预防一种场景是蓝牙连接成功了 但是socket没连接成功的情况)
if
(
self
.
currentPeripheralName
&&
(
self
.
selectedPeripheral
&&
self
.
selectedPeripheral
.
state
==
CBPeripheralStateConnected
))
{
[
self
sendMessage
:[
NSString
stringWithFormat
:
@"{<%@>}"
,
self
.
currentPeripheralName
]];
}
// if (self.currentPeripheralName && (self.selectedPeripheral && self.selectedPeripheral.state == CBPeripheralStateConnected)) {
// [self sendMessage:[NSString stringWithFormat:@"{<%@>}", self.currentPeripheralName]];
// }
[
self
.
clientSocket
readDataWithTimeout
:
-
1
tag
:
0
];
}
...
...
@@ -872,11 +892,25 @@
NSLog
(
@"=============收到服务器返回的设备号"
);
}
else
{
//发送给蓝牙
if
(
self
.
currentCharacteristic
)
{
if
(
data
.
length
>
100
)
{
//超出100 过滤 发送空消息保持连接
[
self
.
selectedPeripheral
writeValue
:[
@"[]"
dataUsingEncoding
:
NSUTF8StringEncoding
]
forCharacteristic
:
self
.
currentCharacteristic
type
:
CBCharacteristicWriteWithResponse
];
}
else
if
(
data
.
length
>
20
)
{
return
;
}
[
self
.
tempData
addObject
:
data
];
[
self
sendSocketMsgToBluetooth
];
}
}
#pragma mark - 发送消息给蓝牙
-
(
void
)
sendSocketMsgToBluetooth
{
if
(
self
.
tempData
.
count
==
0
)
{
return
;
}
if
(
self
.
currentCharacteristic
)
{
NSData
*
data
=
self
.
tempData
[
0
];
//去第一个
if
(
data
.
length
>
20
)
{
NSInteger
temp
=
data
.
length
%
20
;
NSInteger
count
=
0
;
...
...
@@ -898,7 +932,7 @@
}
else
{
[
self
.
selectedPeripheral
writeValue
:
data
forCharacteristic
:
self
.
currentCharacteristic
type
:
CBCharacteristicWriteWithResponse
];
}
}
[
self
.
tempData
removeObject
:
data
];
}
}
...
...
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