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. Member Information Management

Member Information Management

Last Updated on: 2024-05-31 14:44:43

Functional description

The capabilities to manage home member information depend on ThingSmartHomeInvitation and ThingSmartHomeMember of ThingSmartHome. ThingHomeRoleType specifies a type of member role.

Class name (protocol name) Description
ThingSmartHomeMember Manage home members.

Add a home member

A home owner that is specified by ThingHomeRoleType_Owner can add an administrator and other members with lower permissions. An administrator that is specified by ThingHomeRoleType_Admin can only add common members and other members with lower permissions.

API description

The autoAccept field of the ThingSmartHomeAddMemberRequestModel object specifies whether an invitation is automatically accepted to add an invitee to the home. If the value is set to NO, you must call ThingSmartHome - joinFamilyWithAccept:success:failure:, so the invitee needs to accept the invitation before joining the home.

- (void)addHomeMemberWithAddMemeberRequestModel:(ThingSmartHomeAddMemberRequestModel *)requestModel success:(ThingSuccessDict)success failure:(ThingFailureError)failure;

Parameters

Parameter Description
requestModel The request model to add a member.
success The success callback.
failure The failure callback.

Data model of ThingSmartHomeAddMemberRequestModel

Field Type Description
name NSString The nickname of the invitee.
account NSString The account of the invitee.
countryCode NSString The country code of the invitee’s account.
role ThingHomeRoleType The role of the member.
headPic UIImage The avatar of the invitee. If the value is set to nil, the invitee’s personal avatar is used.
autoAccept BOOL Specifies whether the invitation is automatically accepted. Valid values:
  • YES: The invitation is automatically accepted.
  • NO: The invitee needs to accept the invitation before joining the home.

Example

ObjC:

- (void)addShare {
    [self.smartHome addHomeMemberWithAddMemeberRequestModel:requestModel success:^(NSDictionary *dict) {
        NSLog(@"addNewMember success");
    } failure:^(NSError *error) {
        NSLog(@"addNewMember failure");
    }];
}

Swift:

func addShare() {
    home?.addHomeMember(requestModel: requestModel, success: {
        print("addNewMember success")
    }, failure: { (error) in
        if let e = error {
            print("addNewMember failure: (e)")
        }
    })
}

Remove a member

A home owner that is specified by ThingHomeRoleType_Owner can remove an administrator and other members with lower permissions. An administrator that is specified by ThingHomeRoleType_Admin can only remove common members and other members with lower permissions.

API description

The home will be processed in varied ways, depending on different values of memberId:

  • If memberId is set to an administrator, common member, or custom role, the member to be removed will leave the home. In this case, the home will not be deleted and its devices will not be reset.
  • If memberId is set to the home owner, the home is deleted and all devices of the home will be reset. The result is the same as that of dismissHome.
- (void)removeHomeMemberWithMemberId:(long long)memberId
                            success:(ThingSuccessHandler)success
                            failure:(ThingFailureError)failure;

Parameters

Parameter Description
memberId The member ID.
success The success callback.
failure The failure callback.

Example

ObjC:

- (void)removeMember:(ThingSmartHomeMemberModel *)memberModel {
    // self.homeMember = [[ThingSmartHomeMember alloc] init];
    [self.homeMember removeHomeMemberWithMemberId:memberModel.memberId success:^{
        NSLog(@"removeMember success");
    } failure:^(NSError *error) {
        NSLog(@"removeMember failure: %@", error);
    }];
}

Swift:

func removeMember(_ memberModel: ThingSmartHomeMemberModel) {
    homeMember?.removeHomeMember(withMemberId: memberModel.memberId, success: {
        print("removeMember success")
    }, failure: { (error) in
        if let e = error {
            print("removeMember failure: (e)")
        }
    })
}

Query a list of home members

API description

- (void)getHomeMemberListWithSuccess:(void(^)(NSArray <ThingSmartHomeMemberModel *> *memberList))success failure:(ThingFailureError)failure;

Parameters

Parameter Description
success The success callback.
failure The failure callback.

Example

ObjC:

- (void)initMemberList {
 // _home = [ThingSmartHome homeWithHomeId:homeId];
    [_home getHomeMemberListWithSuccess:^(NSArray<ThingSmartHomeMemberModel *> *memberList) {
        NSLog(@"getMemberList success: %@", memberList);
    } failure:^(NSError *error) {
        NSLog(@"getMemberList failure");
    }];
}

Swift:

func initMemberList() {
    home.getHomeMemberList(withSuccess: { memberList in
        print("getMemberList success: (memberList)")
    }, failure: { (error) in
        if let e = error {
            print("getMemberList failure: (e)")
        }
    })
}

Update member information

A home owner that is specified by ThingHomeRoleType_Owner can modify an administrator and other members with lower permissions. An administrator that is specified by ThingHomeRoleType_Admin can only modify common members and other members with lower permissions.

API description

- (void)updateHomeMemberInfoWithMemberRequestModel:(ThingSmartHomeMemberRequestModel *)memberRequestModel success:(ThingSuccessHandler)success failure:(ThingFailureError)failure;

Parameters

Parameter Description
memberRequestModel The request model to modify a member.
success The success callback.
failure The failure callback.

Example

ObjC:

- (void)modifyMemberName:(ThingSmartHomeMemberModel *)memberModel name:(NSString *)name {
    // self.homeMember = [[ThingSmartHomeMember alloc] init];
ThingSmartHomeMemberRequestModel *requestModel = [[ThingSmartHomeMemberRequestModel alloc] init];
    [self.homeMember updateHomeMemberInfoWithMemberRequestModel:requestModel success:^{
        NSLog(@"modifyMemberName success");
    } failure:^(NSError *error) {
        NSLog(@"modifyMemberName failure: %@", error);
    }];
}

Swift:

func modifyMember(_ memberModel: ThingSmartHomeMemberModel, name: String) {
    homeMember?.updateHomeMemberName(withMemberRequestModel:requestModel, success: {
        print("modifyMemberName success")
    }, failure: { (error) in
        if let e = error {
            print("modifyMemberName failure: (e)")
        }
    })
}

Query the invitation code to add a member

API description

Generates an invitation code by using the instance method of ThingSmartHomeInvitation.

- (void)createInvitationWithCreateRequestModel:(ThingSmartHomeInvitationCreateRequestModel *)createRequestModel
                                    success:(void(^)(ThingSmartHomeInvitationResultModel *invitationResultModel))success
                                    failure:(ThingFailureError)failure;

The homeID field of ThingSmartHomeInvitationCreateRequestModel specifies the ID of the home that the member joins.

Parameters

Parameter Description
createRequestModel The request model to generate an invitation code.
success The success callback.
failure The failure callback.

Data model of ThingSmartHomeInvitationCreateRequestModel

Field Type Description
homeID long long The home ID.
needMsgContent BOOL Specifies whether invitation text is required.

Example

ObjC:

ThingSmartHomeInvitationCreateRequestModel *requestModel = [[ThingSmartHomeInvitationCreateRequestModel alloc] init];
requestModel.homeID = homeID;
requestModel.needMsgContent = YES;
self.smartHomeInvitation = [[ThingSmartHomeInvitation alloc] init];
[self.smartHomeInvitation createInvitationWithCreateRequestModel:requestModel success:success failure:failure];

Swift:

let requestModel = ThingSmartHomeInvitationCreateRequestModel()
requestModel.homeID = homeID
requestModel.needMsgContent = true
self.smartHomeInvitation = ThingSmartHomeInvitation()
self.smartHomeInvitation.createInvitation(with: requestModel, success: success, failure: failure)

Join a home with an invitation code

API description

Creates an invitation to join a home by using the class ThingSmartHomeInvitation.

- joinHomeWithInvitationCode:success:failure:

Parameters

Parameter Description
invitationCode The invitation code.
success The success callback.
failure The failure callback.

Example

ObjC:

- (void)joinHomeWithInvitationCode:(NSString *)invitationCode
                        success:(ThingSuccessBOOL)success
                        failure:(ThingFailureError)failure {
    [self.smartHomeInvitation joinHomeWithInvitationCode:invitationCode success:success failure:failure];
}

Swift:

func joinHome(
    withInvitationCode invitationCode: String?,
    success: @escaping (_ result: Bool) -> Void,
    failure: @escaping (_ error: Error?) -> Void
) {
    self.smartHomeInvitation.joinHome(withInvitationCode: invitationCode, success: success, failure: failure)
}

Revoke an invitation to join a home

API description

Revokes an invitation to join a home by using the class ThingSmartHomeInvitation.

- (void)cancelInvitationWithInvitationID:(NSNumber *)invitationID
                                success:(ThingSuccessBOOL)success
                                failure:(ThingFailureError)failure;

Parameters

Parameters

Parameter Description
invitationID The invitation code.
success The success callback.
failure The failure callback.

Example

ObjC:

- (void)cancelInvitationWithInvitationID:(NSNumber *)invitationID
                                success:(ThingSuccessBOOL)success
                                failure:(ThingFailureError)failure {
    [self.smartHomeInvitation cancelInvitationWithInvitationID:invitationID success:success failure:failure];
}

Swift:

func cancelInvitation(
    withInvitationID invitationID: NSNumber?,
    success: @escaping (_ result: Bool) -> Void,
    failure: @escaping (_ error: Error?) -> Void
) {
    self.smartHomeInvitation.cancelInvitation(withInvitationID: invitationID, success: success, failure: failure)
}

Accept or decline an invitation to join a home

API description

Accepts or declines an invitation to join a home. The invitation status is specified by dealStatus of ThingSmartHomeModel. Valid values: ThingHomeStatusPending, ThingHomeStatusAccept, and ThingHomeStatusReject. The member that declines the invitation can neither access devices for the target home nor query information about the home in the request of a home list.

- (void)joinFamilyWithAccept:(BOOL)accept
                    success:(ThingSuccessBOOL)success
                    failure:(ThingFailureError)failure;

Parameters

Parameter Description
accept Specifies whether to accept the invitation.
success The success callback.
failure The failure callback.

Example

ObjC:

- (void)initMemberList {
 // _home = [ThingSmartHome homeWithHomeId:homeId];
    [_home joinFamilyWithAccept:YES success:^(BOOL result) {
        NSLog(@"join success");
    } failure:^(NSError *error) {
        NSLog(@"join failure");
    }];
}

Swift:

func initMemberList(_ memberModel: ThingSmartHomeMemberModel) {
    home?.joinFamilyWithAccept(true, success: { (result: Bool) in
        print("join success")
    }, failure: { (error) in
        if let e = error {
            print("join failure: (e)")
        }
    })
}

Query invitation records

API description

Returns invitation records by using the class ThingSmartHomeInvitation.

- (void)fetchInvitationRecordListWithHomeID:(long long)homeID
                                    success:(void(^)(NSArray<ThingSmartHomeInvitationRecordModel *> *invitationRecordList))success
                                    failure:(ThingFailureError)failure;

Parameters

Parameter Description
homeID The home ID.
success The success callback.
failure The failure callback.

Example

ObjC:

- (void)fetchInvitationRecordListWithHomeID:(long long)homeID
                                    success:(void(^)(NSArray<ThingSmartHomeInvitationRecordModel *> *invitationRecordList))success
                                    failure:(ThingFailureError)failure {
    [self.smartHomeInvitation fetchInvitationRecordListWithHomeID:homeID success:success failure:failure];
}

Swift:

func fetchInvitationHomeInfo(
    withInvitationCode invitationCode: String?,
    success: @escaping (_ homeModel: ThingSmartHomeModel?) -> Void,
    failure: @escaping (_ error: Error?) -> Void
) {
    self.smartHomeInvitation.fetchInvitationHomeInfo(withInvitationCode: invitationCode, success: success, failure: failure)
}

Modify invitee information

API description

Modifies an invitee by using the class ThingSmartHomeInvitation.

- (void)updateInvitationInfoWithInvitationInfoRequestModel:(ThingSmartHomeInvitationInfoRequestModel *)invitationInfoRequestModel
                                                success:(ThingSuccessBOOL)success
                                                failure:(ThingFailureError)failure;

Parameters

Parameter Description
ThingSmartHomeInvitationInfoRequestModel The request model to modify an invitee.
success The success callback.
failure The failure callback.

Example

ObjC:

- (void)updateInvitationInfoWithInvitationInfoRequestModel:(ThingSmartHomeInvitationInfoRequestModel *)invitationInfoRequestModel
                                                success:(ThingSuccessBOOL)success
                                                failure:(ThingFailureError)failure {
    [self.smartHomeInvitation updateInvitationInfoWithInvitationInfoRequestModel:invitationInfoRequestModel success:success failure:failure];
}

Swift:

func updateInvitationInfo(
    with invitationInfoRequestModel: ThingSmartHomeInvitationInfoRequestModel?,
    success: @escaping (_ result: Bool) -> Void,
    failure: @escaping (_ error: Error?) -> Void
) {
    self.smartHomeInvitation.updateInvitationInfo(with: invitationInfoRequestModel, success: success, failure: failure)
}
  • Prev Doc Room Information Management
  • Next Doc Device Pairing (iOS)
This page contains content