Last Updated on : 2024-03-20 09:12:09download
This topic describes how to manage a site.
API description
ILockSiteManager # void getSiteList(IThingResultCallback<ArrayList<SiteDetail>> callback);
Parameter description
Parameter | Description |
---|---|
callback | The callback for getting the list of sites. |
Example
ThingOSLock.getSiteManager().getSiteList(new IThingResultCallback<ArrayList<SiteDetail>>() {
@Override
public void onSuccess(ArrayList<SiteDetail> result) {
// Got site list successfully
}
@Override
public void onError(String errorCode, String errorMessage) {
// Failed to get site list
}
});
API description
ILockSite #
void getSiteDetail(IThingResultCallback<SiteDetail> callback);
Parameter description
Parameter | Description |
---|---|
callback | The callback for getting the site details. |
Example
ThingOSLock.newSiteInstance(siteId).getSiteDetail(new IThingResultCallback<SiteDetail>() {
@Override
public void onSuccess(SiteDetail result) {
// Got site details successfully
}
@Override
public void onError(String errorCode, String errorMessage) {
// Failed to get site details
}
});
}
API description
ILockSiteManager # void createSite(String siteName, String geoName, double lat, double lon, IThingResultCallback<SiteDetail> callback);
Parameter description
Parameter | Description |
---|---|
siteName | The name of the site. This parameter is required. |
geoName | The location of the site. If not specified, it defaults to an empty string. |
lat | The latitude of the site. If not specified, it defaults to 0 . |
lon | The longitude of the site. If not specified, it defaults to 0 . |
callback | The callback for creating a site. |
Example
ThingOSLock.getSiteManager().createSite(siteName, geoName, 0, 0,
new IThingResultCallback<SiteDetail>() {
@Override
public void onSuccess(SiteDetail result) {
// Created site successfully
}
@Override
public void onError(String errorCode, String errorMessage) {
// Failed to create site
}
});
API description
ILockSiteManager # void removeSite(long siteId, IThingResultCallback<Boolean> callback);
Parameter description
Parameter | Description |
---|---|
siteId | The site ID. |
callback | The callback for deleting a site. |
Example
ThingOSLock.getSiteManager().removeSite(siteDetail.gid, new IThingResultCallback<Boolean>() {
@Override
public void onSuccess(Boolean result) {
// Removed site successfully
}
@Override
public void onError(String errorCode, String errorMessage) {
// Failed to remove site
}
});
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback