public final AppStateManager getStateManager() { return app.getStateManager(); }
public final AppStateManager getStateManager() { return app.getStateManager(); }
public final AppStateManager getStateManager() { return app.getStateManager(); }
@Override public void interruptCommand(Application app) { Logger.getLogger(getClass().getName()).info("Video recording stopped"); VideoRenderAppState videoAppState = app.getStateManager() .getState(VideoRenderAppState.class); if (videoAppState != null) { app.getStateManager().detach(videoAppState); } }
@Override public void runCommand(Application app) { Logger.getLogger(getClass().getName()).info("Video recording stopped"); VideoRenderAppState videoAppState = app.getStateManager() .getState(VideoRenderAppState.class); if (videoAppState != null) { app.getStateManager().detach(videoAppState); } setState(State.Success); }
@Override protected void onPlayingEnd() { app.getStateManager().detach(MovieState.this); MovieState.this.onPlayingEnd(); }
@Override public void runCommand(Application app) { AgentsAppState agentsAppState = app.getStateManager().getState(AgentsAppState.class); DevicesAppState devicesAppState = app.getStateManager().getState(DevicesAppState.class); EventLauncher el = new EventLauncher(agentsAppState, devicesAppState); setState(State.Success); }
@Override public void runCommand(Application app) { Logger.getLogger(getClass().getName()).info("Starting video recording"); VideoRenderAppState videoAppState = app.getStateManager() .getState(VideoRenderAppState.class); if (videoAppState == null) { videoAppState = new VideoRenderAppState(); app.getStateManager().attach(videoAppState); } // videoAppState.recordViewPort(app.getViewPort(), this.output); videoAppState.recordViewPort(app.getGuiViewPort(), this.output); setState(State.Success); }
@Override public void runCommand(Application app) { AgentsAppState agentsAppState = app.getStateManager().getState(AgentsAppState.class); agentsAppState.activateAllCallStateEventLaunchers(); setState(State.Success); }
@Override public void runCommand(Application app) { DevicesAppState devicesAppState = app.getStateManager().getState(DevicesAppState.class); ServerAppState serverAppState = app.getStateManager().getState(ServerAppState.class); Node smartphone = devicesAppState.getDevice(smartphoneId); if(smartphone != null) { AndroidVirtualDevice avd = serverAppState.getAVD(smartphoneId); if(avd != null) { avd.startActivity(packageName, activityName); setState(State.Success); return; } } setState(State.Fail); }
@Override public void runCommand(Application app) { DevicesAppState devicesAppState = app.getStateManager().getState(DevicesAppState.class); ServerAppState serverAppState = app.getStateManager().getState(ServerAppState.class); Node smartphone = devicesAppState.getDevice(smartphoneId); if(smartphone != null) { AndroidVirtualDevice avd = serverAppState.getAVD(smartphoneId); if(avd != null) { avd.install(apkFile); setState(State.Success); return; } } setState(State.Fail); }
@Override public void runCommand(Application app) { JsonRpcAppState jsonRpcAppState = app.getStateManager().getState(JsonRpcAppState.class); result = new JSONArray(); JsonToPHATCommandFactory factory = jsonRpcAppState.getCommandFactory(); for (String methodName : factory.getMethodNames()) { if (type == null || factory.getAnnType(methodName).equals(type.name())) { Map<String, Object> map = new HashMap<>(); map.put("cName", methodName); map.put("cType", factory.getAnnType(methodName)); map.put("cDebug", String.valueOf(factory.isAnnDebug(methodName))); map.put("cUsage", factory.getUsage(methodName)); JSONObject obj = new JSONObject(map); result.add(obj); } } setState(State.Success); }
@Override public void runCommand(Application app) { BodiesAppState bodiesAppState = app.getStateManager().getState(BodiesAppState.class); DevicesAppState devicesAppState = app.getStateManager().getState(DevicesAppState.class); Node body = bodiesAppState.getBody(bodyId); if (body != null && body.getParent() != null) { Spatial s = devicesAppState.getDevice(deviceId); if (s != null) { if (attachDevice(body, s)) { setState(State.Success); return; } } } setState(State.Fail); }
@Override public void runCommand(Application app) { DevicesAppState devicesAppState = app.getStateManager().getState(DevicesAppState.class); ServerAppState serverAppState = app.getStateManager().getState(ServerAppState.class); devicesAppState.registerAllAndroidDevicesInScenario(); Node device = devicesAppState.getDevice(sensorID); if (device != null) { PHATServerManager serverManager = serverAppState.getServerManager(); // avd.sendConfigFileForService(serverManager.getIP(), serverManager.getPort()); AccelerometerControl accSensor = device.getControl(AccelerometerControl.class); if(accSensor != null) { TCPAccelerometerServer accServer = serverManager.createAndStartAccelerometerServer(sensorGroupID,sensorID, accSensor); } setState(State.Success); return; } setState(State.Fail); }
@Override public void runCommand(Application app) { AgentsAppState agentsAppState = app.getStateManager().getState(AgentsAppState.class); BodiesAppState bodiesAppState = app.getStateManager().getState(BodiesAppState.class); Node body = bodiesAppState.getBody(agentId); if(body != null) { MicrophoneControl mc = body.getControl(MicrophoneControl.class); if(mc == null) { createHearingSense(body, app.getAudioRenderer()); } agentsAppState.activateWoredsHeard(agentId); setState(State.Success); return; } setState(State.Fail); }
@Override public void runCommand(Application app) { BodiesAppState bodiesAppState = app.getStateManager().getState(BodiesAppState.class); result = new JSONArray(); if (bodyId == null) { result = new JSONArray(); Iterator<String> it = bodiesAppState.getBodyIds().iterator(); while (it.hasNext()) { result.add(getInfo(it.next(), bodiesAppState)); } setState(State.Success); } else if (bodiesAppState.exists(bodyId)) { result.add(getInfo(bodyId, bodiesAppState)); setState(State.Success); } else { setState(State.Fail); } }
@Override public void runCommand(Application app) { DevicesAppState devicesAppState = app.getStateManager().getState(DevicesAppState.class); Node device = devicesAppState.getDevice(deviceId); if (device != null) { VibratorActuator vibratorActuator = device.getControl(VibratorActuator.class); if (vibratorActuator != null) { vibratorActuator.vibrate(millis); setState(State.Success); return; } } setState(State.Fail); }
@Override public void runCommand(Application app) { HouseAppState houseAppState = app.getStateManager().getState(HouseAppState.class); House house = houseAppState.getHouse("House1"); if (house != null) { if(roomId != null) { result = PHATObjectToJSON.getJSON(roomId, house); } else { result = PHATObjectToJSON.getJSON("House1", houseAppState.getHouseType(), house); } setState(State.Success); } else { setState(State.Fail); } }
@Override public void runCommand(Application app) { DevicesAppState devicesAppState = app.getStateManager().getState(DevicesAppState.class); WorldAppState worldAppState = app.getStateManager().getState(WorldAppState.class); Spatial object = SpatialUtils.getSpatialById(((SimpleApplication) app).getRootNode(), objectId); if (object != null) { Node sensorNode = new Node(doorSensorId); object.getParent().attachChild(sensorNode); sensorNode.setName(doorSensorId); PHATDoorSensor doorSensor = new PHATDoorSensor( doorSensorId, worldAppState.getCalendar()); sensorNode.addControl(doorSensor); devicesAppState.addDevice(doorSensorId, sensorNode); setState(State.Success); return; } setState(State.Fail); }
@Override public void runCommand(Application app) { HouseAppState houseAppState = app.getStateManager().getState(HouseAppState.class); Spatial tv = SpatialUtils.getSpatialById(SpatialFactory.getRootNode(), tvId); if (tv != null) { String imagePath = "Textures/on.png"; if (!on) { imagePath = "Textures/off.png"; } Geometry display = (Geometry) ((Node) (tv.getParent()).getChild("Geometries")).getChild("tv3"); Material mat = new Material(SpatialFactory.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md"); Texture cube1Tex = SpatialFactory.getAssetManager().loadTexture(imagePath); mat.setTexture("ColorMap", cube1Tex); display.setMaterial(mat); } setState(State.Fail); }