Skip to content

Commit

Permalink
优化UDP的使用场景
Browse files Browse the repository at this point in the history
  • Loading branch information
神奇海螺 committed May 22, 2019
1 parent 89476be commit 04fb6be
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 78 deletions.
2 changes: 1 addition & 1 deletion Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ SPEC CHECKSUMS:

PODFILE CHECKSUM: e74c7a9538c5d8d2407598ab95f3904f318dd378

COCOAPODS: 1.6.0
COCOAPODS: 1.5.3
4 changes: 2 additions & 2 deletions TC1-NG.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@
files = (
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-TC1-NG/Pods-TC1-NG-frameworks.sh",
"${SRCROOT}/Pods/Target Support Files/Pods-TC1-NG/Pods-TC1-NG-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/Bitter/Bitter.framework",
"${BUILT_PRODUCTS_DIR}/CocoaAsyncSocket/CocoaAsyncSocket.framework",
"${BUILT_PRODUCTS_DIR}/FMDB/FMDB.framework",
Expand All @@ -339,7 +339,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-TC1-NG/Pods-TC1-NG-frameworks.sh\"\n";
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-TC1-NG/Pods-TC1-NG-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
8B535F4303A9A33CF13C3851 /* [CP] Check Pods Manifest.lock */ = {
Expand Down
61 changes: 44 additions & 17 deletions TC1-NG/Base.lproj/TCDeviceMain.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,7 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<view key="tableFooterView" contentMode="scaleToFill" id="2l3-GO-Hbf">
<rect key="frame" x="0.0" y="308" width="375" height="0.0"/>
<rect key="frame" x="0.0" y="352" width="375" height="0.0"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</view>
Expand Down Expand Up @@ -867,50 +867,47 @@
</tableViewCellContentView>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="none" accessoryType="disclosureIndicator" indentationWidth="10" textLabel="yxn-fJ-OJg" detailTextLabel="sB1-Se-ZoN" style="IBUITableViewCellStyleValue1" id="uDs-pP-R0I">
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="none" indentationWidth="10" textLabel="fnA-Dj-MHR" detailTextLabel="8Kx-Dc-S3m" style="IBUITableViewCellStyleValue1" id="Ohe-6p-2cI">
<rect key="frame" x="0.0" y="176" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="uDs-pP-R0I" id="JeO-Co-BOC">
<rect key="frame" x="0.0" y="0.0" width="341" height="43.5"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="Ohe-6p-2cI" id="muV-uu-jsC">
<rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" insetsLayoutMarginsFromSafeArea="NO" text="MQTT设置" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="yxn-fJ-OJg">
<rect key="frame" x="16" y="12" width="82.5" height="20.5"/>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" insetsLayoutMarginsFromSafeArea="NO" text="运行时间" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="fnA-Dj-MHR">
<rect key="frame" x="16" y="12" width="69.5" height="20.5"/>
<autoresizingMask key="autoresizingMask"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" insetsLayoutMarginsFromSafeArea="NO" text="-----" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="sB1-Se-ZoN">
<rect key="frame" x="301.5" y="12" width="38.5" height="20.5"/>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" insetsLayoutMarginsFromSafeArea="NO" text="-----" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="8Kx-Dc-S3m">
<rect key="frame" x="320.5" y="12" width="38.5" height="20.5"/>
<autoresizingMask key="autoresizingMask"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" white="0.66666666666666663" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<color key="textColor" white="0.66666666669999997" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="1" alpha="0.5" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</tableViewCellContentView>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<connections>
<segue destination="M27-p8-ddx" kind="show" id="r6N-Np-659"/>
</connections>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="none" accessoryType="disclosureIndicator" indentationWidth="10" textLabel="b6H-HF-WZm" detailTextLabel="A1W-sl-khb" style="IBUITableViewCellStyleValue1" id="xjT-1I-fly">
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="none" accessoryType="disclosureIndicator" indentationWidth="10" textLabel="yxn-fJ-OJg" detailTextLabel="sB1-Se-ZoN" style="IBUITableViewCellStyleValue1" id="uDs-pP-R0I">
<rect key="frame" x="0.0" y="220" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="xjT-1I-fly" id="SLs-bq-oys">
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="uDs-pP-R0I" id="JeO-Co-BOC">
<rect key="frame" x="0.0" y="0.0" width="341" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" insetsLayoutMarginsFromSafeArea="NO" text="版本号" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="b6H-HF-WZm">
<rect key="frame" x="16" y="12" width="52" height="20.5"/>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" insetsLayoutMarginsFromSafeArea="NO" text="MQTT设置" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="yxn-fJ-OJg">
<rect key="frame" x="16" y="12" width="82.5" height="20.5"/>
<autoresizingMask key="autoresizingMask"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" insetsLayoutMarginsFromSafeArea="NO" text="-----" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="A1W-sl-khb">
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" insetsLayoutMarginsFromSafeArea="NO" text="-----" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="sB1-Se-ZoN">
<rect key="frame" x="301.5" y="12" width="38.5" height="20.5"/>
<autoresizingMask key="autoresizingMask"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
Expand All @@ -921,6 +918,9 @@
<color key="backgroundColor" white="1" alpha="0.5" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</tableViewCellContentView>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<connections>
<segue destination="M27-p8-ddx" kind="show" id="r6N-Np-659"/>
</connections>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="none" indentationWidth="10" id="Ugs-hg-JeE">
<rect key="frame" x="0.0" y="264" width="375" height="44"/>
Expand Down Expand Up @@ -952,6 +952,32 @@
</tableViewCellContentView>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="none" accessoryType="disclosureIndicator" indentationWidth="10" textLabel="b6H-HF-WZm" detailTextLabel="A1W-sl-khb" style="IBUITableViewCellStyleValue1" id="xjT-1I-fly">
<rect key="frame" x="0.0" y="308" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="xjT-1I-fly" id="SLs-bq-oys">
<rect key="frame" x="0.0" y="0.0" width="341" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" insetsLayoutMarginsFromSafeArea="NO" text="版本号" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="b6H-HF-WZm">
<rect key="frame" x="16" y="12" width="52" height="20.5"/>
<autoresizingMask key="autoresizingMask"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" insetsLayoutMarginsFromSafeArea="NO" text="-----" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="A1W-sl-khb">
<rect key="frame" x="301.5" y="12" width="38.5" height="20.5"/>
<autoresizingMask key="autoresizingMask"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" white="0.66666666666666663" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="1" alpha="0.5" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</tableViewCellContentView>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</tableViewCell>
</cells>
</tableViewSection>
</sections>
Expand Down Expand Up @@ -980,6 +1006,7 @@
<outlet property="isMQTT" destination="w9d-Jv-VPK" id="Wft-cj-c8X"/>
<outlet property="macAddress" destination="qzo-hR-5yz" id="Cqj-TK-NPz"/>
<outlet property="mqttAddress" destination="sB1-Se-ZoN" id="VLd-6a-maN"/>
<outlet property="runTimerLabel" destination="8Kx-Dc-S3m" id="1T4-4x-Sof"/>
<outlet property="version" destination="A1W-sl-khb" id="0xD-iQ-ZPg"/>
</connections>
</tableViewController>
Expand Down
11 changes: 10 additions & 1 deletion TC1-NG/Controller/Device/TCDeviceInfoTableViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class TCDeviceInfoTableViewController: UITableViewController {
@IBOutlet weak var version: UILabel!
@IBOutlet weak var deviceName: UILabel!
@IBOutlet weak var connectLabel: UILabel!
@IBOutlet weak var runTimerLabel: UILabel!
@IBOutlet weak var isMQTT: UISwitch!

var deviceModel = TCDeviceModel()
Expand Down Expand Up @@ -91,7 +92,7 @@ class TCDeviceInfoTableViewController: UITableViewController {
})
alert.addAction(reNameAction)
self.present(alert, animated: true, completion: nil)
}else if indexPath.row == 5{
}else if indexPath.row == 7{
self.checkForUpdates()
}else if indexPath.row == 1 || indexPath.row == 2{
if let cell = tableView.cellForRow(at: indexPath),let content = cell.textLabel?.text{
Expand Down Expand Up @@ -140,6 +141,14 @@ extension TCDeviceInfoTableViewController:TC1ServiceReceiveDelegate{

func TC1ServiceReceivedMessage(message: Data) {
let messageJSON = try! JSON(data: message)
let totalTimer = messageJSON["total_time"].int32Value
if totalTimer > 0 {
let days = totalTimer / (3600 * 24);
let hours = (totalTimer / 3600) % 24;
let minutes = (totalTimer / 60) % 60;
let seconds = totalTimer % 60;
self.runTimerLabel.text = String(format: "%02d天%02d时%02d分%02d秒", days,hours,minutes,seconds)
}
let otaProgress = messageJSON["ota_progress"].floatValue
if otaProgress > 0{
print("OTA 进度 ---> \(otaProgress)")
Expand Down
2 changes: 1 addition & 1 deletion TC1-NG/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>2</string>
<string>4</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
Expand Down
Loading

0 comments on commit 04fb6be

Please sign in to comment.