|
|
|
@ -79,6 +79,7 @@ import org.wso2.carbon.device.mgt.common.operation.mgt.Operation;
|
|
|
|
|
import org.wso2.carbon.device.mgt.common.report.mgt.ReportManagementService;
|
|
|
|
|
import org.wso2.carbon.device.mgt.common.spi.DeviceTypeGeneratorService;
|
|
|
|
|
import org.wso2.carbon.device.mgt.common.spi.OTPManagementService;
|
|
|
|
|
import org.wso2.carbon.device.mgt.common.spi.TraccarManagementService;
|
|
|
|
|
import org.wso2.carbon.device.mgt.core.app.mgt.ApplicationManagementProviderService;
|
|
|
|
|
import org.wso2.carbon.device.mgt.core.device.details.mgt.DeviceInformationManager;
|
|
|
|
|
import org.wso2.carbon.device.mgt.core.dto.DeviceTypeVersion;
|
|
|
|
@ -295,6 +296,19 @@ public class DeviceMgtAPIUtils {
|
|
|
|
|
return deviceTypeGeneratorService;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static TraccarManagementService getTraccarManagementService() {
|
|
|
|
|
TraccarManagementService traccarManagementService;
|
|
|
|
|
PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext();
|
|
|
|
|
traccarManagementService = (TraccarManagementService) ctx.getOSGiService(
|
|
|
|
|
TraccarManagementService.class, null);
|
|
|
|
|
if (traccarManagementService == null) {
|
|
|
|
|
String msg = "Traccar management service not initialized.";
|
|
|
|
|
log.error(msg);
|
|
|
|
|
throw new IllegalStateException(msg);
|
|
|
|
|
}
|
|
|
|
|
return traccarManagementService;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static boolean isValidDeviceIdentifier(DeviceIdentifier deviceIdentifier) throws DeviceManagementException {
|
|
|
|
|
Device device = getDeviceManagementService().getDevice(deviceIdentifier, false);
|
|
|
|
|
if (device == null || device.getDeviceIdentifier() == null ||
|
|
|
|
|