public Builder asSystemAlert() { request.setSource(AlertSource.System); return this; }
public Builder asSystemAlert() { request.setSource(AlertSource.System); return this; }
public Builder(String type, String message) { request.setType(type); request.setMessage(message); request.setSource(AlertSource.Device); request.setLevel(AlertLevel.Info); }
public Builder(String type, String message) { request.setType(type); request.setMessage(message); request.setSource(AlertSource.Device); request.setLevel(AlertLevel.Info); }
public Object generate() throws SiteWhereException { DeviceAlertCreateRequest request = new DeviceAlertCreateRequest(); request.setSource(ExampleData.EVENT_ALERT1.getSource()); request.setType(ExampleData.EVENT_ALERT1.getType()); request.setLevel(ExampleData.EVENT_ALERT1.getLevel()); request.setMessage(ExampleData.EVENT_ALERT1.getMessage()); request.setEventDate(new Date()); request.setUpdateState(true); return request; } }
public Object generate() throws SiteWhereException { DeviceEventBatch batch = new DeviceEventBatch(); batch.setHardwareId(ExampleData.TRACKER.getHardwareId()); DeviceMeasurementsCreateRequest mx = new DeviceMeasurementsCreateRequest(); mx.setMeasurements(ExampleData.EVENT_MEASUREMENT1.getMeasurements()); mx.setEventDate(new Date()); mx.setUpdateState(true); batch.getMeasurements().add(mx); DeviceLocationCreateRequest loc = new DeviceLocationCreateRequest(); loc.setLatitude(ExampleData.EVENT_LOCATION1.getLatitude()); loc.setLongitude(ExampleData.EVENT_LOCATION1.getLongitude()); loc.setElevation(ExampleData.EVENT_LOCATION1.getElevation()); loc.setEventDate(new Date()); loc.setUpdateState(true); batch.getLocations().add(loc); DeviceAlertCreateRequest alert = new DeviceAlertCreateRequest(); alert.setSource(ExampleData.EVENT_ALERT1.getSource()); alert.setType(ExampleData.EVENT_ALERT1.getType()); alert.setLevel(ExampleData.EVENT_ALERT1.getLevel()); alert.setMessage(ExampleData.EVENT_ALERT1.getMessage()); alert.setEventDate(new Date()); alert.setUpdateState(true); batch.getAlerts().add(alert); return batch; } }
request.setType(Type.DeviceAlert); DeviceAlertCreateRequest alert = new DeviceAlertCreateRequest(); alert.setSource(AlertSource.Device); alert.setLevel(AlertLevel.Info); alert.setType("engine.overheat");
/** * Convert device alert create request from GRPC to API. * * @param grpc * @return * @throws SiteWhereException */ public static DeviceAlertCreateRequest asApiDeviceAlertCreateRequest(GDeviceAlertCreateRequest grpc) throws SiteWhereException { DeviceAlertCreateRequest api = new DeviceAlertCreateRequest(); api.setSource(EventModelConverter.asApiAlertSource(grpc.getSource())); api.setLevel(EventModelConverter.asApiAlertLevel(grpc.getLevel())); api.setType(grpc.getType()); api.setMessage(grpc.getAlertMessage()); EventModelConverter.copyApiDeviceEventCreateRequest(grpc.getEvent(), api); return api; }
alert.setType("engine.overheat"); alert.setMessage("Engine overheating."); alert.setSource(AlertSource.Device); alert.setLevel(AlertLevel.Error); location.setMetadata(metadata);