Project Management

Last Updated on : 2024-04-03 10:00:06download

This topic describes how to manage a project.

Concepts

Project

A project is an independent unit that is associated with an account. An area and device must be assigned to a project before it becomes available.

Each user can manage one or more projects. The number of projects that can be created depends on the subscribed plan. 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 specifies the type of Bluetooth mesh network a project uses. Two mesh network modes are available:

  • Single mesh network mode: Suitable for projects with less than 300 devices or with no Bluetooth mesh devices included. For example, an outdoor project, or an indoor project with less than 300 Bluetooth mesh devices.
  • Multi-mesh network mode: Suitable for projects with more than 300 Bluetooth mesh devices, or parking lot projects. For example, a parking lot project, or an indoor project with more than 300 Bluetooth mesh devices.

Project type

  • Indoor project: Manage devices using a visual floor plan. It is suitable for simple use cases, such as office buildings and shopping malls. Both the single mesh network mode and multi-mesh network mode apply to indoor projects.
  • Outdoor project: Use a GIS map to get the precise location of devices. It is suitable for use cases where devices are spread across a wide area. The project location is defined by country and first-level administrative division. The subdivisions are pinpointed on the map. Outdoor projects are exclusive to premium brand owner accounts. They are suitable for street lighting and charging station projects. The single mesh network mode applies to outdoor projects.
  • Parking lot project: It is suitable for parking spaces and uses the multi-mesh network mode.

Things to note

  • For a project created in single mesh network mode, a mesh network will be automatically generated and associated with all areas in the project.
  • For a project created in multi-mesh network mode, users must manually create and bind a mesh network with the area in the project. Users can only pair a Bluetooth mesh device after the mesh network is bound with the area.

Configure project

Get the configuration for an indoor, outdoor, or parking lot project.

Send the configuration for the supported project type based on the subscription plan the current account is on. You can create a project of the type returned by the method. An error will occur if you attempt to create a project of an unsupported type.

API description

void getProjectConfigList(IThingResultCallback<List<LightingProjectConfigsBean>> callback);

LightingProjectConfigsBean

Project configuration class

Parameter Type Description
projectType int The project type. Valid values:
  • 0: Indoor project
  • 1: Outdoor project
  • 2: Parking lot project
projectTypeName String The name of the project type.
projectIconUrl String The icon of the project type.
spaceAttributes List The list of area hierarchy.

AreaConfig

Area hierarchy class

Parameter Type Description
id int The ID of the area hierarchy.
name String The name of the area hierarchy, for example, zone-building-floor-room.
iconUrl String The icon of the area hierarchy.

Example

ThingCommercialLightingProject.getLightingProjectManager().getProjectConfigList(new IThingResultCallback<List<LightingProjectConfigsBean>>() {
            @Override
            public void onSuccess(List<LightingProjectConfigsBean> result) {
                if (null != result) {
                    iProjectIndexView.getProjectConfigListSuccess(result);
                }
            }

            @Override
            public void onError(String errorCode, String errorMessage) {
                Log.e(TAG, "getProjectConfigList onError: errorCode=" + errorMessage);
                iProjectIndexView.getProjectConfigListError();
            }
        });

Create project

API description

Create a project, which can be an indoor project or an outdoor project.

void createProject(
    int projectType,
    String name,
    String leaderName,
    String leaderMobile,
    String detail,
    String regionLocationId,
        int networkType,
    IThingHomeResultCallback callback);

Parameter description

Parameter Description Required
projectType The project type. Valid values:
  • 0: Indoor project (default)
  • 1: Outdoor project
  • 2: Parking lot project
You can get the ID of the project type by requesting the project configuration information.
Yes
name The name of the project. Yes
leaderName The owner of the project. Yes
leaderMobile The contact information. Yes
detail The address details.
This parameter is required for an indoor project or parking lot project to specify the address details.
This parameter is required for an outdoor project to specify the location. It is recommended to concatenate the selected area, for example, California, USA.
Yes
regionLocationId The area ID, with multiple IDs separated by a comma (,).
This parameter is required for an outdoor project to specify the location.
China: first-level administrative division. Other countries: Country + first-level administrative division.
Example: The ID of the Zhejiang province. The ID of the USA,the ID of California
Set this field to an empty string for an indoor project or parking lot project.
No
networkType Mesh network mode:
  • 0: Single mesh network mode (default)
  • 1: Multi-mesh network mode
See Concepts for details.
Yes

Example

ThingCommercialLightingProject.getLightingProjectManager().createProject(projectType, projectName, leaderName, leaderMobile, detailAddress, regionId, networkType, new IThingHomeResultCallback() {
    @Override
    public void onSuccess(HomeBean homeBean) {
        if (null == mProjectAddView) {
            return;
        }
        mProjectAddView.doSaveSuccess();
    }

    @Override
    public void onError(String s, String s1) {
        if (null == mProjectAddView) {
            return;
        }
        mProjectAddView.doSaveFailed(s1);
    }
});

Edit project

API description

Edit the project information.

void updateProjectInfo(
  String name,
  String regionLocationId,
  String detail,
  String leaderName,
  String leaderMobile,
  IResultCallback callback);

Parameter description

Parameter Description Required
projectId The project ID. Yes
name The name of the project. Yes
regionLocationId The area ID, with multiple IDs separated by a comma (,).
This parameter is required for an outdoor project to specify the location.
China: first-level administrative division. Other countries: Country + first-level administrative division.
Example: The ID of the Zhejiang province. The ID of the USA,the ID of California
Set this field to an empty string for an indoor project or parking lot project.
No
detail The address details.
This parameter is required for an indoor project or parking lot project to specify the address details.
This parameter is required for an outdoor project to specify the location. It is recommended to concatenate the selected area, for example, California, USA.
Yes
leaderName The owner of the project. Yes
leaderMobile The contact information. Yes

Example

ThingCommercialLightingProject.newProjectInstance(projectId).updateProjectInfo(mHomeBean.getHomeId(), mHomeBean.getName(),mHomeBean.getLeaderName(), mHomeBean.getLeaderMobile(), regionId, content, new IResultCallback() {
    @Override
    public void onError(String code, String error) {
        if (null == mIProjectInfoView) {
            return;
        }
        mIProjectInfoView.showToast(error);
    }

    @Override
    public void onSuccess() {
        if (null == mIProjectInfoView) {
            return;
        }
        mIProjectInfoView.updateAddressDetail(content);
    }
});

Delete project

API description

Delete a project. Once a project is deleted, all its data will be erased, and the associated device will be unbound and reset.

Users will be prompted to enter their password to confirm the action and prevent accidental deletion. The project deletion method will process password verification. Entering the correct password will immediately initiate the project deletion. A warning pop-up window should appear before users input their password.

void deleteProjectWithPassword(String password, IResultCallback callback);

Parameter description

Parameter Description
projectId The ID of the target project.
key The key obtained through the password (user system: getKeyFromPassword).
password The password for the account.

Example

ThingCommercialLightingProject.newProjectInstance(projectId).deleteProjectWithPassword(mIProjectInfoView.getProjectId(), password, new IResultCallback() {
    @Override
    public void onError(String s, String s1) {
        if (null == mIProjectInfoView) {
            return;
        }
        mIProjectInfoView.showToast(s1);
    }

    @Override
    public void onSuccess() {
        if (null == mIProjectInfoView) {
            return;
        }
        mIProjectInfoView.doRemoveView(true);
    }
});

Get project list

API description

Get the list of created projects.

void getProjectList(IThingGetHomeListCallback callback);

Example

ThingCommercialLightingProject.getLightingProjectManager().getProjectList(new IThingGetHomeListCallback() {
    @Override
    public void onSuccess(List<HomeBean> list) {
        Log.i(TAG, "queryProjectList onSuccess: " + JSON.toJSONString(list));
        if (null == iProjectIndexView.getContext()) {
            return;
        }
        if (CollectionUtils.isEmpty(list)) {
            iProjectIndexView.showProjectEmptyView();
        } else {
            iProjectIndexView.setProjectList(list);
        }
    }

    @Override
    public void onError(String s, String s1) {
        Log.e(TAG, "queryProjectList onError: errorCode=" + s);
    }
});

Get project details

API description

Get the details of the specified project.

void getProjectDetail(IThingHomeResultCallback callback);

Parameter description

Parameter Description
projectId The project ID. The method get project list returns projectId.

Example

ThingCommercialLightingProject.newProjectInstance(long projectId).getProjectDetail(mIProjectInfoView.getProjectId(), new IThingHomeResultCallback() {
    @Override
    public void onSuccess(HomeBean homeBean) {
        if (null == mIProjectInfoView) {
            return;
        }
        mIProjectInfoView.setProjectData(homeBean);
    }

    @Override
    public void onError(String s, String s1) {
        if (null == mIProjectInfoView) {
            return;
        }
        mIProjectInfoView.showToast(s1);
    }
});

Get country list by data center

API description

Get the list of countries based on the data center associated with the account. Currently, six countries are supported across three data centers: China Data Center (China), America Data Center (United States, Japan, and Hong Kong, China), and Europe Data Center (Australia). The country supported by a data center can be added dynamically, which is subject to the return value. To add country support, contact your product manager.

void getRegionList(IThingResultCallback<List<LightingRegionListBean>> listener);

LightingRegionListBean

Field Type Description
locationId String The ID of the area.
name String The name of the area, which can be in multiple languages.
pinyinInitials String The initial of the area name.
Chinese: The initial of the Pinyin. Other languages: The initial of the first word.
This field is used for custom sort or index.
children List The sub-area of the current area. For example: the first-level administrative division of a country.

Example

ThingCommercialLightingRegion.getRegionManager().getRegionList(new IThingResultCallback<List<LightingRegionListBean>>() {
    @Override
    public void onSuccess(List<LightingRegionListBean> result) {
        if (result != null) {
            mRegionListView.getRegionListSuccess(result);
        }
    }

    @Override
    public void onError(String errorCode, String errorMessage) {
        mRegionListView.getRegionListError(errorMessage);
    }
});