Project Management

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.

Concepts

Manage projects

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

Mesh network mode: refers to the type of Bluetooth mesh network used by the current project. The following two types are supported:

  • Single mesh network mode: This mode is recommended when the number of devices in the project is less than 300, or when non-Bluetooth mesh devices are used in the project. For example, an outdoor project, or an indoor project with less than 300 Bluetooth mesh devices.
  • Multi-mesh network mode: This mode is recommended when the project uses more than 300 Bluetooth mesh devices, or the project is a parking lot project. For example, a parking lot project, or an indoor project with more than 300 Bluetooth mesh devices.

Project version

  • Indoor projects: Visualize device management on floor plans. Indoor projects are recommended for simple scenarios, and the project address can be described in text. Suitable for office buildings, malls, and similar projects. Mesh network mode is classified into single mesh network mode and multi-mesh network mode.
  • Outdoor projects: Precisely locate devices on GIS maps. Outdoor projects are recommended for scenarios with large areas and scattered devices. The project address consists of the country name and first-level administrative region. Project sub-areas are displayed by marking specific locations on the map. Outdoor projects are exclusive to brand owners with premium accounts. Suitable for outdoor street lights, charging stations, and similar projects. The single mesh network mode is used.
  • Parking lot project: This project version is suitable for parking lot scenarios and adopts multi-mesh network mode.

Things to note

  • After a project using a single mesh network mode is created, a mesh will be automatically generated and associated with all areas under the entire project.
  • After a project using multi-mesh network mode is created, the project and space will not be bound with the mesh by default. Users need to manually create the mesh and bind it with the areas under the project. After the binding is completed, a Bluetooth mesh device can be paired.

Configure a project

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);
    }];

Get a list of projects

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);
    }];

ThingLightingProjectConfigModel

Parameter Description
projectType The project type. Valid values:
  • 0: a project suitable for indoor scenes
  • 1: a project suitable for outdoor scenes
  • 2: a project suitable for parking lot scenes
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

ThingLightingProjectSpaceItemModel

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.

ThingLightingProjectValidationItemModel

Parameter Description
min The minimum valid value.
max The maximum valid value.

Create a project

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:
  • 0: a project suitable for indoor scenes
  • 1: a project suitable for outdoor scenes
  • 2: a project suitable for parking lot scenes
Get the current project type using getProjectConfigListWithSuccess: failure:. This parameter is required.
networkType Mesh network mode: Valid values:
  • 0: single mesh network mode, default value
  • 1: multi-mesh network mode
For more information, see Concepts.
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];

Get project information

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);
    }];

Get project details

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);
    }];

Update project information

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);
                                    }];

Delete a project

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);
                             }];

Get a list of countries/regions

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);
    }];

Object description

ThingLightingRegionModel

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.

ThingLightingProjectModel

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:
  • smart: smart control
  • local: local control
  • remote: remote control
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.