Skip to content

Commit

Permalink
Show file tree
Hide file tree
Showing 9 changed files with 185 additions and 5 deletions.
76 changes: 72 additions & 4 deletions Source/LinkSDKDemo/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,14 +1,77 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="17506" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="y8H-OK-A7C">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="19158" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="y8H-OK-A7C">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17505"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="19141"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--显示所有设备-->
<scene sceneID="iPc-G8-UL8">
<objects>
<viewController id="MPm-JF-Z42" customClass="TIoTAllDevicesVC" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="2xt-tK-U6d">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="AccessToken" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="rIJ-KM-7a5">
<rect key="frame" x="20" y="108" width="374" height="34"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
</textField>
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="platformId" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="eRM-jE-uTO">
<rect key="frame" x="20" y="150" width="374" height="34"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
</textField>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="DGk-mY-evA">
<rect key="frame" x="20" y="192" width="110" height="31"/>
<state key="normal" title="Button"/>
<buttonConfiguration key="configuration" style="plain" title="显示所有设备"/>
<connections>
<action selector="showAllDevices:" destination="MPm-JF-Z42" eventType="touchUpInside" id="i82-el-R1e"/>
</connections>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="PK7-GK-96b">
<rect key="frame" x="20" y="231" width="374" height="100"/>
<constraints>
<constraint firstAttribute="height" constant="100" id="IvC-Q3-NKP"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<viewLayoutGuide key="safeArea" id="Olt-a1-ZEP"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstItem="rIJ-KM-7a5" firstAttribute="top" secondItem="Olt-a1-ZEP" secondAttribute="top" constant="20" id="4c6-ij-j0j"/>
<constraint firstItem="Olt-a1-ZEP" firstAttribute="trailing" secondItem="eRM-jE-uTO" secondAttribute="trailing" constant="20" id="E1j-UJ-Fg5"/>
<constraint firstItem="PK7-GK-96b" firstAttribute="top" secondItem="DGk-mY-evA" secondAttribute="bottom" constant="8" symbolic="YES" id="G31-RI-Tsc"/>
<constraint firstItem="Olt-a1-ZEP" firstAttribute="trailing" secondItem="rIJ-KM-7a5" secondAttribute="trailing" constant="20" id="SY6-G8-ay5"/>
<constraint firstItem="eRM-jE-uTO" firstAttribute="leading" secondItem="Olt-a1-ZEP" secondAttribute="leading" constant="20" id="Ws5-Ak-0Iw"/>
<constraint firstItem="eRM-jE-uTO" firstAttribute="top" secondItem="rIJ-KM-7a5" secondAttribute="bottom" constant="8" symbolic="YES" id="bGU-Hz-S5w"/>
<constraint firstItem="rIJ-KM-7a5" firstAttribute="leading" secondItem="Olt-a1-ZEP" secondAttribute="leading" constant="20" id="bhX-Vz-AJD"/>
<constraint firstItem="DGk-mY-evA" firstAttribute="leading" secondItem="Olt-a1-ZEP" secondAttribute="leading" constant="20" id="iQg-u7-Le9"/>
<constraint firstItem="DGk-mY-evA" firstAttribute="top" secondItem="eRM-jE-uTO" secondAttribute="bottom" constant="8" symbolic="YES" id="p84-0o-c5l"/>
<constraint firstItem="Olt-a1-ZEP" firstAttribute="trailing" secondItem="PK7-GK-96b" secondAttribute="trailing" constant="20" id="z7J-57-4BZ"/>
<constraint firstItem="PK7-GK-96b" firstAttribute="leading" secondItem="Olt-a1-ZEP" secondAttribute="leading" constant="20" id="zFN-4F-153"/>
</constraints>
</view>
<navigationItem key="navigationItem" title="显示所有设备" id="RhH-1t-3eE"/>
<connections>
<outlet property="accessTokenTextField" destination="rIJ-KM-7a5" id="JMi-Ml-2cO"/>
<outlet property="devicesLabel" destination="PK7-GK-96b" id="WNq-fV-X9u"/>
<outlet property="platformIdTextField" destination="eRM-jE-uTO" id="MtJ-Ux-fUO"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="xLe-q2-Bxi" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="2719" y="-575"/>
</scene>
<!--HomeVC-->
<scene sceneID="tne-QT-ifu">
<objects>
Expand Down Expand Up @@ -62,6 +125,11 @@
</constraints>
</view>
<navigationItem key="navigationItem" id="rNG-xC-J5Q">
<barButtonItem key="leftBarButtonItem" title="显示所有设备" id="Ogv-Rk-i0H">
<connections>
<segue destination="MPm-JF-Z42" kind="push" id="B7E-ca-K63"/>
</connections>
</barButtonItem>
<barButtonItem key="rightBarButtonItem" title="添加" id="XXa-Cp-TKq">
<connections>
<segue destination="6ts-Uc-m2S" kind="push" id="nki-hN-WlU"/>
Expand Down Expand Up @@ -453,10 +521,10 @@
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>
<systemColor name="systemBrownColor">
<color red="0.63529411759999999" green="0.51764705879999995" blue="0.36862745099999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color red="0.63529411764705879" green="0.51764705882352946" blue="0.36862745098039218" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor>
<systemColor name="systemTealColor">
<color red="0.35294117647058826" green="0.78431372549019607" blue="0.98039215686274506" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color red="0.18823529411764706" green="0.69019607843137254" blue="0.7803921568627451" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor>
<systemColor name="systemYellowColor">
<color red="1" green="0.80000000000000004" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
Expand Down
17 changes: 17 additions & 0 deletions Source/LinkSDKDemo/Core/Controller/Device/TIoTAllDevicesVC.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//
// TIoTAllDevicesVC.h
// TIoTAllDevicesVC
//
// Created by whalensun on 2021/9/14.
// Copyright © 2021 Tencent. All rights reserved.
//

#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

@interface TIoTAllDevicesVC : UIViewController

@end

NS_ASSUME_NONNULL_END
50 changes: 50 additions & 0 deletions Source/LinkSDKDemo/Core/Controller/Device/TIoTAllDevicesVC.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
//
// TIoTAllDevicesVC.m
// TIoTAllDevicesVC
//
// Created by whalensun on 2021/9/14.
// Copyright © 2021 Tencent. All rights reserved.
//

#import "TIoTAllDevicesVC.h"

@interface TIoTAllDevicesVC ()

@property (weak, nonatomic) IBOutlet UITextField *accessTokenTextField;
@property (weak, nonatomic) IBOutlet UITextField *platformIdTextField;
@property (weak, nonatomic) IBOutlet UILabel *devicesLabel;

@end

@implementation TIoTAllDevicesVC

- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
}

- (IBAction)showAllDevices:(UIButton *)sender {
[self.view endEditing:YES];
[[TIoTCoreDeviceSet shared] getVirtualBindDeviceListWithAccessToken:self.accessTokenTextField.text platformId:self.platformIdTextField.text offset:0 limit:0 success:^(id _Nonnull responseObject) {

DDLogVerbose(@"getVirtualBindDeviceList==%@",responseObject);
NSArray *devicesArr = [responseObject objectForKey:@"VirtualBindDeviceList"];
if (devicesArr) {
NSString *content = @"";
for (NSDictionary *device in devicesArr) {
content = [content stringByAppendingString:[NSString stringWithFormat:@"%@\n", [device objectForKey:@"DeviceName"]]];
}
self.devicesLabel.text = content;
} else {
[MBProgressHUD showError:@"没有设备"];
}

} failure:^(NSString * _Nullable reason, NSError * _Nullable error,NSDictionary *dic) {
if (dic) {
[MBProgressHUD showError:[NSString stringWithFormat:@"code: %@, msg: %@", [dic objectForKey:@"code"], [dic objectForKey:@"msg"]]];
}
}];
}


@end
2 changes: 2 additions & 0 deletions Source/SDK/LinkCore/QCAPISets/Other/TIoTCoreRequestAction.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ FOUNDATION_EXPORT NSString *const AppGetProductInfo;//扫一扫落地页面显
FOUNDATION_EXPORT NSString *const AppGetGatewayBindDeviceList;//网关设备列表
FOUNDATION_EXPORT NSString *const AppBindSubDeviceInFamily;//绑定子设备

FOUNDATION_EXPORT NSString *const AppGetVirtualBindDeviceList;//APP拉用户绑定设备列表

//MARK: 设备定时

FOUNDATION_EXPORT NSString *const AppGetTimerList;//获取定时任务列表
Expand Down
2 changes: 2 additions & 0 deletions Source/SDK/LinkCore/QCAPISets/Other/TIoTCoreRequestAction.m
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ @implementation TIoTCoreRequestAction
NSString *const AppGetGatewayBindDeviceList = @"AppGetGatewayBindDeviceList";
NSString *const AppBindSubDeviceInFamily = @"AppBindSubDeviceInFamily";

NSString *const AppGetVirtualBindDeviceList = @"AppGetVirtualBindDeviceList";//APP拉用户绑定设备列表

//===============设备定时

NSString *const AppGetTimerList = @"AppGetTimerList";//获取定时任务列表
Expand Down
3 changes: 3 additions & 0 deletions Source/SDK/LinkCore/QCAPISets/Public/TIoTCoreDeviceSet.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ typedef NS_ENUM(NSInteger,TIotApiHost) {
/// 更换设备绑定的房间
- (void)modifyRoomOfDeviceWithProductId:(NSString *)productId deviceName:(NSString *)deviceName familyId:(NSString *)familyId roomId:(NSString *)roomId success:(SRHandler)success failure:(FRHandler)failure;

/// APP拉用户绑定设备列表
- (void)getVirtualBindDeviceListWithAccessToken:(NSString *)accessToken platformId:(NSString *)platformId offset:(NSUInteger)offset limit:(NSUInteger)limit success:(SRHandler)success failure:(FRHandler)failure;


#pragma mark - 云端定时

Expand Down
30 changes: 30 additions & 0 deletions Source/SDK/LinkCore/QCAPISets/Public/TIoTCoreDeviceSet.m
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,36 @@ - (void)modifyRoomOfDeviceWithProductId:(NSString *)productId deviceName:(NSStri
}];
}

/// APP拉用户绑定设备列表
- (void)getVirtualBindDeviceListWithAccessToken:(NSString *)accessToken platformId:(NSString *)platformId offset:(NSUInteger)offset limit:(NSUInteger)limit success:(SRHandler)success failure:(FRHandler)failure
{

if (accessToken == nil) {
failure(@"accessToken参数为空",nil,@{});
return;
}

if (platformId == nil) {
failure(@"platformId参数为空",nil,@{});
return;
}

NSMutableDictionary *param = [NSMutableDictionary dictionary];
[param setValue:accessToken forKey:@"AccessToken"];
[param setValue:platformId forKey:@"BindPlatformId"];
if (limit > 0) {
[param setObject:@(offset) forKey:@"Offset"];
[param setObject:@(limit) forKey:@"Limit"];
}

TIoTCoreRequestBuilder *b = [[TIoTCoreRequestBuilder alloc] initWtihAction:AppGetVirtualBindDeviceList params:param useToken:YES];
[TIoTCoreRequestClient sendRequestWithBuild:b.build success:^(id _Nonnull responseObject) {
success(responseObject);
} failure:^(NSString * _Nonnull reason, NSError * _Nonnull error,NSDictionary *dic) {
failure(reason,error,dic);
}];
}


#pragma mark - 云端定时

Expand Down
4 changes: 3 additions & 1 deletion Source/SDK/LinkCore/QCFoundation/TIoTCoreRequestObject.m
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,9 @@ - (void)postRequestWithAction:(NSString *)actionStr url:(NSURL *)url isWithoutT
accessParam = [NSMutableDictionary dictionaryWithDictionary:baseAccessParam];
[accessParam setValue:actionStr forKey:@"Action"];
[accessParam setValue:[[NSUUID UUID] UUIDString] forKey:@"RequestId"];
[accessParam setValue:[TIoTCoreUserManage shared].accessToken forKey:@"AccessToken"];
if (![baseAccessParam.allKeys containsObject:@"AccessToken"]) {
[accessParam setValue:[TIoTCoreUserManage shared].accessToken forKey:@"AccessToken"];
}

}

Expand Down
6 changes: 6 additions & 0 deletions TIoTLinkKit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
objects = {

/* Begin PBXBuildFile section */
00ACEA8F26F0CC9D0055EA36 /* TIoTAllDevicesVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 00ACEA8E26F0CC9D0055EA36 /* TIoTAllDevicesVC.m */; };
6D01E86B24F8EE7400234872 /* TIoTUserConfigModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 6D01E86824F8EE7400234872 /* TIoTUserConfigModel.m */; };
6D01E86C24F8EE7400234872 /* TIoTUserRegionModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 6D01E86A24F8EE7400234872 /* TIoTUserRegionModel.m */; };
6D06B07425603C50006361B5 /* TIoTAutoCustomTimePeriodView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6D06B07325603C50006361B5 /* TIoTAutoCustomTimePeriodView.m */; };
Expand Down Expand Up @@ -497,6 +498,8 @@
/* End PBXCopyFilesBuildPhase section */

/* Begin PBXFileReference section */
00ACEA8D26F0CC9D0055EA36 /* TIoTAllDevicesVC.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TIoTAllDevicesVC.h; sourceTree = "<group>"; };
00ACEA8E26F0CC9D0055EA36 /* TIoTAllDevicesVC.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TIoTAllDevicesVC.m; sourceTree = "<group>"; };
0A58AA4A144CEE9B3B027556 /* Pods-LinkSDKDemo.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-LinkSDKDemo.release.xcconfig"; path = "Pods/Target Support Files/Pods-LinkSDKDemo/Pods-LinkSDKDemo.release.xcconfig"; sourceTree = "<group>"; };
253144D80CC8A037F5D90897 /* Pods-TIoTLinkKitDemo.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-TIoTLinkKitDemo.debug.xcconfig"; path = "Pods/Target Support Files/Pods-TIoTLinkKitDemo/Pods-TIoTLinkKitDemo.debug.xcconfig"; sourceTree = "<group>"; };
43EF7275574707E3B3D4F776 /* Pods_LinkSDKDemo.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_LinkSDKDemo.framework; sourceTree = BUILT_PRODUCTS_DIR; };
Expand Down Expand Up @@ -3139,6 +3142,8 @@
F4F3D78024938EBD005D3396 /* ControlDeviceVC.xib */,
6D50E91026B18CE300DF12A5 /* TIoTDemoWebSocketManager.h */,
6D50E91126B18CE300DF12A5 /* TIoTDemoWebSocketManager.m */,
00ACEA8D26F0CC9D0055EA36 /* TIoTAllDevicesVC.h */,
00ACEA8E26F0CC9D0055EA36 /* TIoTAllDevicesVC.m */,
);
path = Device;
sourceTree = "<group>";
Expand Down Expand Up @@ -3754,6 +3759,7 @@
6D9D97EA26857FA50085BCC2 /* TIoTDemoProductDetailModel.m in Sources */,
F4F3D7A224938EBE005D3396 /* ControlInfo.m in Sources */,
6D9D978C26846B280085BCC2 /* TIoTDemoPlayConfigVC.m in Sources */,
00ACEA8F26F0CC9D0055EA36 /* TIoTAllDevicesVC.m in Sources */,
6DCB3587259CD908003E03DF /* TIoTWiredDistributionNetVC.m in Sources */,
6D98FE1B25C2E6B200518AC7 /* TIoTCustomCalendarCell.m in Sources */,
F4F3265825919C6D00A4CAAB /* TIoTVIdeoQRScanDistributionNet.m in Sources */,
Expand Down

0 comments on commit 627f28d

Please sign in to comment.