Copied!
Private Cloud
  • Application Development Services
    • Quick Start
    • API Gateway
      • API Request
        • Request Structure
        • Authorization Method
        • Sign Requests
        • Global Error Codes
      • Best Practice
        • Set Postman Environment and Call API Operations
      • API List
        • Basic API
          • Authorization Token Management
            • Refresh Token
            • Get a Token
        • IoT Core
          • Device Management
            • Query Devices in Space
            • Get Status Reporting Log
            • Get Update Progress
            • Query Device Details in Bulk
            • Delete Device
            • Get Update Information
            • Query Device Details
            • Confirm Start of Update
            • Get Device State
            • Get Operation Log
            • Modify Basic Properties
            • Freeze/Unfreeze Device
            • Transfer Device
            • Restore Factory Defaults
            • Query Pairing Result
          • Device Control
            • Send Property
            • Query Properties
            • Modify Properties
            • Set Desired Property
            • Query Desired Properties
            • Query Things Data Model
            • Device Control (Standard Instruction Set)
              • Get Status Set
              • Send Commands
              • Get Specifications and Properties of the Device
              • Get Instruction Set of the Device
              • Get Instruction Set of the Category
              • Get Status of a Single Device
              • Get Latest Status of Multiple Devices
          • Device Group
            • Create Group
            • Delete Group
            • Query Group
            • Rename Group
            • Get Group in Space
            • Add Device
            • Delete Devices
            • Get Device Group
            • Query Group Properties
            • Send Group Properties
            • Query Group Devices
    • Message Gateway
      • Preparations
      • Development Guide
        • Integrate with Message Service
        • Data Signature
        • Message Types
      • Best Practices
        • Get Push Messages by Pulsar (Java SDK)
        • Get Push Messages by Pulsar (Python SDK)
        • Get Push Messages by Pulsar (Go SDK)
        • Get Push Messages by Pulsar (Node.js SDK)
        • Get Push Messages by Pulsar (C# SDK)
  • App Development
    • Preparation
    • Developer Guide for iOS
      • Fast Integration with Cube App SDK for iOS
      • Upgrade Guide
      • Quick Start with Cube App SDK for iOS
      • iOS App: Implement User Account Features
      • User Account Management (iOS)
        • Register and Login with Phone Number
        • Register and Login with Email Address
        • Login with UID
        • Login with Third-Party Account
        • Register and Login with Anonymous Account
        • QR Code-Based Login Authorization
        • Manage User Accounts
      • Home Management
        • Home Information Management
        • Room Information Management
        • Member Information Management
      • Device Pairing (iOS)
        • Wi-Fi EZ Mode
        • AP Mode
        • Wired Mode
        • Sub-Device Pairing
        • NB-IoT Device Pairing
        • HomeKit Device Pairing
        • Pegasus Pairing
        • CPPLUS Link-Based Device Binding
        • Matter Devices
          • Prepare for Integration with Matter Device
          • Pair Matter Device
        • Pair with QR Code on Device
      • Bluetooth Devices
        • Bluetooth Mesh
        • CPPLUS Mesh
      • Device Management
        • Firmware Update
        • Query Reported DP Logs
        • Device Sharing
        • Backup Wi-Fi Networks
        • Offline Device Alerts
        • CPPLUS Link-Based Devices
        • Manage Matter Devices
      • Device Control
        • Multi-Control Linkage
        • Scheduled Tasks
        • Group Management
        • All Category Control Panel
        • Air Conditioning Category Control Panel
        • Switch Control Panel
        • Device DP Parser
      • Smart Scenes
        • Scene Recommendation
      • Common API Methods
      • Integrate with Push Notifications
      • Message Management
        • Configure Push Notifications
        • Message Capabilities
      • Configure Widget Project
      • Error Codes
      • FAQ
      • Extension SDK
        • IPC SDK
          • SDK Architecture
          • Fast Integration with IPC SDK for iOS
          • Quick Start with IPC SDK for iOS
          • IPCs
          • Device Pairing
          • IPC Control (iOS)
          • Live Video Streaming
          • Playback of Video Stored on SD Card
          • SD Card Management
          • Audio and Video Features
          • Low Power Doorbell
          • PTZ Control
          • Doorbell Call Service
          • Cloud Storage
          • Cloud Storage Debugging Tool
          • Detection Alerts
          • Encrypted Images
          • Timeline View
          • Offline Log
          • Migrate IPC UI BizBundles
          • P2P Capabilities
          • IPC SDK Automated Test Tool
          • IPC SDK Test Cases (Reference)
          • FAQ
          • Error Codes
        • Sweeper SDK
          • P2P Download from Robot Vacuums
          • Gyroscope and Visual Robot Vacuums
          • Laser Robot Vacuum
          • Voice Package Download
          • Error Codes
          • Sample Code
        • Smart Lock SDK
          • Wi-Fi Lock
          • Bluetooth Lock
          • Wi-Fi Lock Audio and Video Capability
          • Smart Lock Basic API
      • What is UI BizBundle SDK for iOS?
        • Preparation
        • Integrate with Framework
        • Home Management UI BizBundle
        • Device Pairing UI BizBundle
        • Scene UI BizBundle
        • Multi-Control Linkage UI BizBundle
        • Device Control UI BizBundle
        • OTA UI BizBundle
        • Group Management UI BizBundle
        • Device Details UI BizBundle
        • Panel Multilingual BizBundle
        • IPC UI BizBundles
        • Cloud Storage UI BizBundle
        • FAQ UI BizBundle
        • Message Center UI BizBundle
        • Voice Skills Account Linking UI BizBundle
        • Theme Color Configuration BizBundle
        • Sharing UI BizBundle
      • Changelog
    • Developer Guide for Android
      • Fast Integration with Cube App SDK for Android
      • Upgrade Guide
      • User Account Management
        • Register and Login with Phone Number
        • Register and Login with Email Address
        • Login with UID
        • Login with Third-Party Account
        • Register and Login with Anonymous Account
        • QR Code-Based Login Authorization
        • Manage User Accounts
      • Home Management
        • Home Information Management
        • Room Information Management
        • Member Information Management
      • Device Pairing (iOS)
        • Wi-Fi EZ Mode
        • AP Mode
        • Wired Mode
        • Pair with QR Code on Device
        • Pegasus Pairing
        • Sub-Device Pairing
        • NB-IoT Device Pairing
        • CPPLUS Link-Based Device Binding
        • Matter Devices
          • Prepare for Integration with Matter Device
          • Pair Matter Device
        • Pair with QR Code on Device
      • Bluetooth Devices
        • Bluetooth LE Devices
        • Bluetooth Mesh
        • CPPLUS Mesh
      • Device Management
        • Firmware Update
        • Query Reported DP Logs
        • Device Sharing
        • Backup Wi-Fi Networks
        • Notifications of Devices Getting Offline
        • CPPLUS Link-Based Devices
        • Manage Matter Devices
      • Device Control
        • Sub-Device Control Through Zigbee Gateway
        • Multi-Control Linkage
        • Scheduled Tasks
        • Group Management
        • Device DP Parser
      • Smart Scenes
        • Scene Recommendation
      • Common API Methods
      • Integrate with Push Notifications
        • Integrate with FCM Push
        • Integrate with Xiaomi Push Notifications
        • Integrate with Huawei Push Notifications
      • Message Management
        • Configure Push Notifications
        • Message Capabilities
      • Error Codes
      • FAQ
      • Extension SDK
        • IPC SDK
          • IPC SDK Architecture
          • Fast Integration with IPC SDK for Android
          • IPCs
          • Device Pairing
          • Live Video Streaming
          • SD Card-Stored Video Playback
          • SD Card Management
          • Audio and Video Features
          • Cloud Storage
          • Cloud Storage Debugging Tool
          • Alert List
          • Video Alerts
          • Low Power Doorbell
          • Encrypted Images
          • Timeline View
          • P2P Capabilities
          • IPC SDK Automated Test Tool
          • IPC SDK Test Cases (Reference)
          • Error Codes
          • SDK Log
          • Changelog
        • Sweeper SDK
          • P2P Download from Robot Vacuums
          • Gyroscope and Visual Robot Vacuums
          • Laser Robot Vacuum
          • Voice Package Download
          • Changelog
          • Error Codes
          • Sample Code
        • Smart Lock SDK
          • Wi-Fi Smart Lock
          • Bluetooth Smart Lock
          • Wi-Fi Smart Lock Audio and Video Capabilities
          • Zigbee Lock
          • Smart Lock Basic API
          • Changelog
      • What is UI BizBundle SDK for iOS?
        • Preparation
        • Integrate with Framework
        • Home Management UI BizBundle
        • Device Pairing UI BizBundle
        • Generic Pairing BizBundle
        • Device Control UI BizBundle
        • Multi-Control Linkage UI BizBundle
        • Scene UI BizBundle
        • Group Management UI BizBundle
        • Device Details UI BizBundle
        • OTA UI BizBundle
        • IPC UI BizBundles
        • Cloud Storage UI BizBundle
        • Message Center UI BizBundle
        • FAQ UI BizBundle
        • Maps Service UI BizBundle
        • Voice Skills Account Linking UI BizBundle
        • Panel Multilingual BizBundle
        • Theme Color Configuration BizBundle
        • Sharing UI BizBundle
        • FAQ
      • Changelog
  1. Home
  2. App Development
  3. I OS
  4. Room Information Management

Room Information Management

Last Updated on: 2024-03-04 12:54:32

Functional description

ThingSmartHome must be initialized with the correct value of roomId to implement information management for a single room in a home. An incorrect room ID might cause failed initialization. In this case, nil will be returned.

Class name (protocol name) Description
ThingSmartRoom Manage information about rooms and devices in the rooms.

Add a room

API description

- (void)addHomeRoomWithName:(NSString *)name
                    success:(ThingSuccessHandler)success
                    failure:(ThingFailureError)failure;

Parameters

Parameter Description
name The name of a room.
success The success callback.
failure The failure callback.

Example

ObjC:

- (void)addHomeRoom {
    [self.home addHomeRoomWithName:@"room_name" success:^{
        NSLog(@"add room success");
    } failure:^(NSError *error) {
        NSLog(@"add room failure: %@", error);
    }];
}

Swift:

func addHomeRoom() {
    home?.addRoom(withName: "room_name", success: {
        print("add room success")
    }, failure: { (error) in
        if let e = error {
            print("add room failure: (e)")
        }
    })
}

Remove a room

API description

- (void)removeHomeRoomWithRoomId:(long long)roomId
                         success:(ThingSuccessHandler)success
                         failure:(ThingFailureError)failure;

Parameters

Parameter Description
roomId The room ID.
success The success callback.
failure The failure callback.

Example

ObjC:

- (void)removeHomeRoom {
    [self.home removeHomeRoomWithRoomId:roomId success:^{
        NSLog(@"remove room success");
    } failure:^(NSError *error) {
        NSLog(@"remove room failure: %@", error);
    }];
}

Swift:

func removeHomeRoom() {
    home?.removeRoom(withRoomId: roomId, success: {
        print("remove room success")
    }, failure: { (error) in
        if let e = error {
            print("remove room failure: (e)")
        }
    })
}

Sort a list of rooms

API description

- (void)sortRoomList:(NSArray <ThingSmartRoomModel *> *)roomList
             success:(ThingSuccessHandler)success
             failure:(ThingFailureError)failure;

Parameters

Parameter Description
roomList The list of rooms.
success The success callback.
failure The failure callback.

Example

ObjC:

- (void)sortHomeRoom {
    [self.home sortRoomList:(NSArray<ThingSmartRoomModel *> *) success:^{
        NSLog(@"sort room success");
    } failure:^(NSError *error) {
        NSLog(@"sort room failure: %@", error);
    }];
}

Swift:

func sortHomeRoom() {
    home?.sortRoomList([ThingSmartRoomModel]!, success: {
        print("sort room success")
    }, failure: { (error) in
        if let e = error {
            print("sort room failure: (e)")
        }
    })
}

Add a group to a room

API description

- (void)addGroupWithGroupId:(NSString *)groupId success:(ThingSuccessHandler)success failure:(ThingFailureError)failure;

Parameters

Parameter Description
groupId The group ID.
success The success callback.
failure The failure callback.

Example

ObjC:

- (void)addGroup {
    [self.room addGroupWithGroupId:@"groupId" success:^{
        NSLog(@"add group to room success");
    } failure:^(NSError *error) {
        NSLog(@"add group to room failure: %@", error);
    }];
}

Swift:

func addGroup() {
    room?.addGroup(withGroupId: "your_groupId", success: {
        print("add group to room success")
    }, failure: { (error) in
        if let e = error {
            print("add group to room failure: (e)")
        }
    })
}

Remove a group from a room

API description

- (void)removeGroupWithGroupId:(NSString *)groupId success:(ThingSuccessHandler)success failure:(ThingFailureError)failure;

Parameters

Parameter Description
groupId The group ID.
success The success callback.
failure The failure callback.

Example

ObjC:

- (void)removeGroup {
    [self.room removeGroupWithGroupId:@"groupId" success:^{
        NSLog(@"remove group from room success");
    } failure:^(NSError *error) {
        NSLog(@"remove group from room failure: %@", error);
    }];
}

Swift:

func removeGroup() {
    room?.removeGroup(withDeviceId: "your_devId", success: {
        print("remove device from room success")
    }, failure: { (error) in
        if let e = error {
            print("remove device from room failure: (e)")
        }
    })
}

Add a device to a room

API description

- (void)addDeviceWithDeviceId:(NSString *)deviceId success:(ThingSuccessHandler)success failure:(ThingFailureError)failure;

Parameters

Parameter Description
deviceId The device ID.
success The success callback.
failure The failure callback.

Example

ObjC:

- (void)addDevice {
    [self.room addDeviceWithDeviceId:@"devId" success:^{
        NSLog(@"add device to room success");
    } failure:^(NSError *error) {
        NSLog(@"add device to room failure: %@", error);
    }];
}

Swift:

func addDevice() {
    room?.addDevice(withDeviceId: "your_devId", success: {
        print("add device to room success")
    }, failure: { (error) in
        if let e = error {
            print("add device to room failure: (e)")
        }
    })
}

Remove a device from a room

API description

- (void)removeDeviceWithDeviceId:(NSString *)deviceId success:(ThingSuccessHandler)success failure:(ThingFailureError)failure;

Parameters

Parameter Description
deviceId The device ID.
success The success callback.
failure The failure callback.

Example

ObjC:

- (void)removeDevice {
    [self.room removeDeviceWithDeviceId:@"devId" success:^{
        NSLog(@"remove device from room success");
    } failure:^(NSError *error) {
        NSLog(@"remove device from room failure: %@", error);
    }];
}

Swift:

func removeDevice() {
    room?.removeDevice(withDeviceId: "your_devId", success: {
        print("remove device from room success")
    }, failure: { (error) in
        if let e = error {
            print("remove device from room failure: (e)")
        }
    })
}

Update a room name

API description

- (void)updateRoomName:(NSString *)roomName success:(ThingSuccessHandler)success failure:(ThingFailureError)failure;

Parameters

Parameter Description
roomName The name of a room.
success The success callback.
failure The failure callback.

Example

ObjC:

- (void)updateRoomName {
    [self.room updateRoomName:@"new_room_name" success:^{
        NSLog(@"update room name success");
    } failure:^(NSError *error) {
        NSLog(@"update room name failure: %@", error);
    }];
}

Swift:

func updateRoomName() {
    room?.updateName("new_room_name", success: {
        print("update room name success")
    }, failure: { (error) in
        if let e = error {
            print("update room name failure: (e)")
        }
    })
}

Customize a room image

Customizes an image for a room. You call ThingSmartRoomModel.iconUrl to get the URL of the image.

API description

- (void)updateIcon:(UIImage *)icon success:(nullable ThingSuccessHandler)success failure:(nullable ThingFailureError)failure;

Parameters

Parameter Description
icon The image of the room.
success The success callback.
failure The failure callback.

Example

ObjC:

- (void)updateIcon {
    [self.room updateIcon:[UIImage imageNamed:@"xxx.JPG"] success:^{
      NSLog(@"room image update success %@", room.roomModel.iconUrl);
    } failure:^(NSError *error) {
      NSLog(@"room image update failure: %@", error);
    }];
}

Swift:

func updateIcon() {

    room?.updateIcon(UIImage(named: "xxx.jpg") success: {
        print("room image update success")
    }, failure: { (error) in
        if let e = error {
            print("room image update failure: (e)")
        }
    })
}

Modify mappings between rooms and devices or groups in bulk

API description

- (void)saveBatchRoomRelationWithDeviceGroupList:(NSArray <NSString *> *)deviceGroupList
                                         success:(ThingSuccessHandler)success
                                         failure:(ThingFailureError)failure;

Parameters

Parameter Description
deviceGroupList The list of device IDs or group IDs.
success The success callback.
failure The failure callback.

Example

ObjC:

- (void)saveBatchRoomRelation {
    [self.room saveBatchRoomRelationWithDeviceGroupList:(NSArray <NSString *> *)deviceGroupList success:^{
        NSLog(@"save batch room relation success");
    } failure:^(NSError *error) {
        NSLog(@"save batch room relation failure: %@", error);
    }];
}

Swift:

func saveBatchRoomRelation() {
    room?.saveBatchRoomRelation(withDeviceGroupList: [String]!, success: {
        print("save batch room relation success")
    }, failure: { (error) in
        if let e = error {
            print("save batch room relation failure: (e)")
        }
    })
}
  • Prev Doc Home Information Management
  • Next Doc Member Information Management
This page contains content