public DeviceItem(Device device, String... label) { this.udn = device.getIdentity().getUdn(); this.device = device; this.label = label; }
protected void hydrateBasic(MutableService descriptor, Service undescribedService) { descriptor.serviceId = undescribedService.getServiceId(); descriptor.serviceType = undescribedService.getServiceType(); if (undescribedService instanceof RemoteService) { RemoteService rs = (RemoteService) undescribedService; descriptor.controlURI = rs.getControlURI(); descriptor.eventSubscriptionURI = rs.getEventSubscriptionURI(); descriptor.descriptorURI = rs.getDescriptorURI(); } }
public boolean isFullyHydrated() { S[] services = findServices(); for (S service : services) { if (service.hasStateVariables()) return true; } return false; }
public DeviceDetails createDeviceDetails(URL baseURL) { return new DeviceDetails( baseURL, friendlyName, new ManufacturerDetails(manufacturer, manufacturerURI), new ModelDetails(modelName, modelDescription, modelNumber, modelURI), serialNumber, upc, presentationURI, dlnaDocs.toArray(new DLNADoc[dlnaDocs.size()]), dlnaCaps ); }
@Override public void success(ActionInvocation invocation) { updateStatus( "Successfuly sent URI to: (Instance: " + instanceId + ") " + avTransportService.getDevice().getDetails().getFriendlyName() ); }
@Override public String getTitle() { return device != null ? device.getDetails().getFriendlyName() : "(NO DEVICE)"; }
private void generateSpecVersion(Service serviceModel, Document descriptor, Element rootElement) { Element specVersionElement = appendNewElement(descriptor, rootElement, ELEMENT.specVersion); appendNewElementIfNotNull(descriptor, specVersionElement, ELEMENT.major, serviceModel.getDevice().getVersion().getMajor()); appendNewElementIfNotNull(descriptor, specVersionElement, ELEMENT.minor, serviceModel.getDevice().getVersion().getMinor()); }
public URL normalizeURI(URI relativeOrAbsoluteURI) { // TODO: I have one device (Netgear 834DG DSL Router) that sends a <URLBase>, and even that is wrong (port)! // This can be fixed by "re-enabling" UPnP in the upnpService after a reboot, it will then use the right port... // return URIUtil.createAbsoluteURL(getDescriptorURL(), relativeOrAbsoluteURI); if (getDetails() != null && getDetails().getBaseURL() != null) { // If we have an <URLBase>, all URIs are relative to it return URIUtil.createAbsoluteURL(getDetails().getBaseURL(), relativeOrAbsoluteURI); } else { // Otherwise, they are relative to the descriptor location return URIUtil.createAbsoluteURL(getIdentity().getDescriptorURL(), relativeOrAbsoluteURI); } }
public Action<S> deepCopy() { ActionArgument<S>[] actionArgumentsDupe = new ActionArgument[getArguments().length]; for (int i = 0; i < getArguments().length; i++) { ActionArgument arg = getArguments()[i]; actionArgumentsDupe[i] = arg.deepCopy(); } return new Action<>( getName(), actionArgumentsDupe ); }
@Override public String toString() { return "Icon(" + getWidth() + "x" + getHeight() + ", MIME: " + getMimeType() + ") " + getUri(); } }
public Datatype<S> getDatatype(ActionArgument argument) { return getRelatedStateVariable(argument).getTypeDetails().getDatatype(); }
public Datatype getDatatype() { return getAction().getService().getDatatype(this); }
public StateVariableValue(StateVariable<S> stateVariable, Object value) throws InvalidValueException { super(stateVariable.getTypeDetails().getDatatype(), value); this.stateVariable = stateVariable; }
public StateVariable<S> getRelatedStateVariable(ActionArgument argument) { return getStateVariable(argument.getRelatedStateVariableName()); }
public ActionArgument<S> getInputArgument(String name) { for (ActionArgument<S> arg : getInputArguments()) { if (arg.isNameOrAlias(name)) return arg; } return null; }
public QueryStateVariableAction(S service) { super(ACTION_NAME, new ActionArgument[]{ new ActionArgument(INPUT_ARG_VAR_NAME, VIRTUAL_STATEVARIABLE_INPUT, ActionArgument.Direction.IN), new ActionArgument(OUTPUT_ARG_RETURN, VIRTUAL_STATEVARIABLE_OUTPUT, ActionArgument.Direction.OUT), } ); setService(service); }
@Override public LocalDevice getRoot() { if (isRoot()) return this; LocalDevice current = this; while (current.getParentDevice() != null) { current = current.getParentDevice(); } return current; }
@Override public String toString() { return super.toString() + ", Manager: " + manager; } }
@Override public RemoteService newInstance(ServiceType serviceType, ServiceId serviceId, URI descriptorURI, URI controlURI, URI eventSubscriptionURI, Action<RemoteService>[] actions, StateVariable<RemoteService>[] stateVariables) throws ValidationException { return new RemoteService( serviceType, serviceId, descriptorURI, controlURI, eventSubscriptionURI, actions, stateVariables ); }
public DeviceItem(Device device) { this.udn = device.getIdentity().getUdn(); this.device = device; }