Last Updated on : 2024-03-28 10:26:42download
Project management is achieved by calling the following APIs:
ThingLightingProjectManager
: query project configurations and projects and create projects.ThingLightingRegionManager
: query administrative regions to create outdoor projects.ThingLightingProject
: query, update, and delete project information.ThingLightingProjectModel
: query project information.A project is an independent unit that is managed by a user. Areas and devices must be assigned to a user before they can be managed.
The maximum number of projects that can be created for a user depends on the plan purchased by the user. By default, new users do not have projects after registration and login. They must create projects to perform project-specific operations.
Mesh network mode: refers to the type of Bluetooth mesh network used by the current project. The following two types are supported:
Get the data configurations under the indoor, outdoor, and parking lot projects.
Based on the specified plan purchased by the current login account, dynamically send the configuration information of the projects available to the account, such as indoor projects, outdoor projects, and parking lot projects. You can create projects of the types returned by the current API call. An error will occur when you create projects of unauthorized types.
Bulk get project configurations
API description
- (void)getProjectConfigListWithSuccess:(void(^)(NSArray<ThingLightingProjectConfigModel *> *configList))success
failure:(void(^)(NSError *error))failure;
Parameters
Parameter | Description |
---|---|
success | The success callback. |
failure | The failure callback. |
Sample code
Objective-C:
[[ThingLightingProjectManager new] getProjectConfigListWithSuccess:^(NSArray <ThingLightingProjectConfigModel *> *configList) {
NSLog(@"get success");
} failure:^(NSError *error) {
NSLog(@"get failure: %@", error);
}];
API description
- (void)getProjectListWithSuccess:(nullable void(^)(NSArray <ThingLightingProjectModel *> *projectList))success
failure:(nullable void(^)(NSError *error))failure;
Parameters
Parameter | Description |
---|---|
success | The success callback. |
failure | The failure callback. |
Sample code
Objective-C:
[[ThingLightingProjectManager new] getProjectListWithSuccess:^(NSArray <ThingLightingProjectModel *> *projectList) {
NSLog(@"get success");
} failure:^(NSError *error) {
NSLog(@"get failure: %@", error);
}];
Parameter | Description |
---|---|
projectType | The project type. Valid values:
|
projectTypeName | The name of a specified project type. |
projectIconUrl | The URL of the project icon. |
spaceAttributes | The properties of a specified space level, in ThingLightingProjectSpaceItemModel array |
validationConditions | The valid input range, in ThingLightingProjectValidationItemModel array |
Parameter | Description |
---|---|
name | The name of a specified space level. |
iconUrl | The icon URL of a specified space level. |
roomLevel | The level of a specified space. |
Parameter | Description |
---|---|
min | The minimum valid value. |
max | The maximum valid value. |
API description
- (void)createProjectWithProjectType:(ThingLightingProjectType)projectType
networkType:(ThingLightingProjectMeshMode)networkType
projectName:(nonnull NSString *)projectName
leaderName:(nonnull NSString *)leaderName
leaderMobile:(nonnull NSString *)leaderMobile
detailAddress:(nonnull NSString *)detailAddress
regionLocationId:(nullable NSString *)regionLocationId
success:(nullable void(^)(id result))success
failure:(nullable void(^)(NSError *error))failure;
Parameters
Parameter | Description |
---|---|
projectType | The current project type. Valid values:
|
networkType | Mesh network mode: Valid values:
|
projectName | The project name. This parameter is required. |
leaderName | The name of the project owner. This parameter is required. |
leaderMobile | The mobile phone number of the project owner. This parameter is required. |
detailAddress | The detailed address. Indoor project and parking lot project: This parameter is required and is used to describe the detailed address of a specified project. Outdoor project: This parameter is required and is used to describe the location of a specified outdoor project. It is recommended to concatenate the selected areas. Example: Zhejiang Province, China and California, the United States. |
regionLocationId | The ID of the administrative region where the project is located. The ID is concatenated with the country code and the level-1 administrative region code, separated by , . Get the region code through ThingLightingRegionManager . This parameter is optional. |
success | The success callback. |
failure | The failure callback. |
Sample code
Objective-C:
[[ThingLightingProjectManager new] createProjectWithProjectType:ThingLightingProjectTypeIndoor
networkType:self.meshMode
projectName:self.projectNameTextField.text
leaderName:self.leaderNameTextField.text
leaderMobile:self.leaderMobileTextField.text
detailAddress:self.detailAddressTextField.text
regionLocationId:@""
success:^(id _Nonnull result) {
} failure:NULL];
API description
- (void)getProjectInfoWithSuccess:(nullable void(^)(id result))success
failure:(nullable void(^)(NSError *error))failure;
Parameters
Parameter | Description |
---|---|
success | The success callback. |
failure | The failure callback. |
Sample code
Objective-C:
ThingLightingProject *project = [ThingLightingProject projectWithProjectId:123];
[project getProjectInfoWithSuccess:^(id result) {
NSLog(@"get success");
} failure:^(NSError *error) {
NSLog(@"get failure: %@", error);
}];
Project details include the list of mesh networks, gateways, and areas, as well as project information and favorite areas.
API description
- (void)getProjectDetailWithSuccess:(nullable void(^)(void))success
failure:(nullable void(^)(NSError *error))failure;
Parameters
Parameter | Description |
---|---|
success | The success callback. |
failure | The failure callback. |
Sample code
Objective-C:
ThingLightingProject *project = [ThingLightingProject projectWithProjectId:123];
[project getProjectDetailWithSuccess:^(void) {
NSLog(@"get success");
} failure:^(NSError *error) {
NSLog(@"get failure: %@", error);
}];
API description
- (void)updateProjectInfoWithProjectName:(nonnull NSString *)projectName
leaderName:(nonnull NSString *)leaderName
leaderMobile:(nonnull NSString *)leaderMobile
detailAddress:(nonnull NSString *)detailAddress
regionLocationId:(nullable NSString *)regionLocationId
success:(nullable void(^)(id result))success
failure:(nullable void(^)(NSError *error))failure;
Parameters
Parameter | Description |
---|---|
projectName | The project name. This parameter is required. |
leaderName | The name of the project owner. This parameter is required. |
leaderMobile | The mobile phone number of the project owner. This parameter is required. |
detailAddress | The detailed address. Indoor project and parking lot project: This parameter is required and is used to describe the detailed address of a specified project. Outdoor project: This parameter is required and is used to describe the location of a specified outdoor project. It is recommended to concatenate the selected areas. Example: Zhejiang Province, China and California, the United States. |
regionLocationId | The ID of the administrative region where the project is located. The ID is concatenated with the country code and the level-1 administrative region code, separated by , . Get the region code through ThingLightingRegionManager . This parameter is optional. |
success | The success callback. |
failure | The failure callback. |
Sample code
Objective-C:
ThingLightingProject *project = [ThingLightingProject projectWithProjectId:123];
[project updateProjectInfoWithProjectName:@"your projectName"
leaderName:@"your leaderName"
leaderMobile:@"your leaderMobile"
detailAddress:@"your detailAddress"
regionLocationId:nil
success:^(id result) {
NSLog(@"update success");
} failure:^(NSError *error) {
NSLog(@"update failure: %@", error);
}];
API description
- (void)deleteProjectWithPassword:(nonnull NSString *)password
success:(nullable void(^)(void))success
failure:(nullable void(^)(NSError *error))failure;
Parameters
Parameter | Description |
---|---|
password | The password. This parameter is required. |
success | The success callback. |
failure | The failure callback. |
Sample code
Objective-C:
ThingLightingProject *project = [ThingLightingProject projectWithProjectId:123];
[project deleteProjectWithPassword:@"your password"
success:^{
NSLog(@"delete success");
} failure:^(NSError *error) {
NSLog(@"delete failure: %@", error);
}];
API description
- (void)getRegionListWithSuccess:(void(^)(NSArray<ThingLightingRegionModel *> *regionList))success
failure:(void(^)(NSError *error))failure;
Parameters
Parameter | Description |
---|---|
success | The success callback. |
failure | The failure callback. |
Sample code
Objective-C:
ThingLightingRegionManager *project = [ThingLightingRegionManager new];
[project getRegionListWithSuccess:^(NSArray * _Nonnull regionList) {
NSLog(@"get success");
} failure:^(NSError * _Nonnull error) {
NSLog(@"get failure: %@", error);
}];
Parameter | Description |
---|---|
locationId | The ID of a specified administrative region. |
name | The name of a specified administrative region. |
pinyinInitials | The initials of a specified administrative region name. |
parentId | The ID of a specified parent administrative region. |
name | The name of a specified space level. |
Parameter | Description |
---|---|
projectId | The project ID. |
name | The name of a specified project. |
geoName | The geographical location of a specified project. |
latitude | The latitude. |
longitude | The longitude. |
backgroundUrl | The background image. |
controlMode | The control mode. Valid values:
|
leaderName | The name of the project owner. |
leaderMobile | The mobile phone number or email address of the project owner. |
clientCount | The total number of devices. |
errorClientCount | The total number of offline devices, including directly connected Bluetooth devices. |
authClientCount | The total number of authorized devices. |
realOfflineCount | The total number of offline devices, excluding directly connected Bluetooth devices. |
power | The energy consumption. |
detail | The detailed address of the project. |
projectType | The project type. |
regionLocationId | The ID of the region where the project is located. |
projectTypeName | The name of a specified project type. |
projectIconUrl | The URL of the project icon. |
displayOrder | The display order. |
dealStatus | The standard field. |
role | The standard field. |
admin | The standard field. |
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback