public object DriverInstanceMethodCall(ISession session, string instanceId, string methodName, string contentBody) { object deviceInstance = session.GetSessionObject(instanceId); // TODO: deserialize a MethodCallParametersList from the request body (NOTE: check content type for JSON or XML) MethodCallParametersList paramList = contentBody.AsDeserialized<MethodCallParametersList>(); object returnValue = DeviceInterfaceCaller.MakeDeviceMethodCall(deviceInstance, methodName, paramList); return returnValue; }
public object DriverInstancePropertyGet(ISession session, string instanceId, string propertyName) { object deviceInstance = session.GetSessionObject(instanceId); object returnValue = DeviceInterfaceCaller.DevicePropertyGet(deviceInstance, propertyName); if (returnValue != null) { // TODO: Need to come up with some sort of registration driven model persister // This is probably a naive implementation IModelPersister modelPersister = ModelPersister.Instance.GetCustomPersister(returnValue.GetType()); if (modelPersister != null) { string content = modelPersister.ToHttpResponse(returnValue); return content; } else return returnValue; } return null; }
public void DriverInstancePropertySet(ISession session, string instanceId, string propertyName, string requestBody) { object deviceInstance = session.GetSessionObject(instanceId); // TODO: deserialize a MethodCallParametersList from the request body (NOTE: check content type for JSON or XML) MethodCallParametersList paramList = requestBody.AsDeserialized<MethodCallParametersList>(); DeviceInterfaceCaller.DevicePropertySet(deviceInstance, propertyName, paramList); }