Not Able to Create Device !!

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Not Able to Create Device !!

r4jiv
I am trying to pass String between two android devices and I am stuck at this point not able to figure out why I am getting this error :-
Creating demo device failed Related state variable not found for output argument: RetTextValue

this is my class :-

package com.mobiotics.motionsdk.server.utils;

import org.teleal.cling.binding.annotations.*;

import java.beans.PropertyChangeSupport;

@UpnpService(serviceId = @UpnpServiceId("StringVals"), serviceType = @UpnpServiceType(value = "StringVals", version = 1))
public class StringVals {

        private final PropertyChangeSupport propertyChangeSupport;

        public StringVals() {
                this.propertyChangeSupport = new PropertyChangeSupport(this);
        }

        public PropertyChangeSupport getPropertyChangeSupport() {
                return propertyChangeSupport;
        }

        @UpnpStateVariable(datatype = "String", sendEvents = false, defaultValue = "")
        private String text = null;

        @UpnpStateVariable(eventMinimumDelta = 0)
        private int status = 0;

        @UpnpAction
        public void setText(
                        @UpnpInputArgument(name = "NewTextValue") String NewTextValue) {

                String textOldValue = text;
                text = NewTextValue;
                int statusOldValue = status;
                status = (NewTextValue == null) ? 0 : 1;

                // These have no effect on the UPnP monitoring but it's JavaBean
                // compliant
                getPropertyChangeSupport().firePropertyChange("text", textOldValue,
                                text);
                getPropertyChangeSupport().firePropertyChange("status", statusOldValue,
                                status);

                // This will send a UPnP event, it's the name of a state variable that
                // sends events
                getPropertyChangeSupport().firePropertyChange("Status", statusOldValue,
                                status);
        }

        @UpnpAction(out = @UpnpOutputArgument(name = "RetTextValue"))
        public String getText() {
                return text;
        }

        @UpnpAction(out = @UpnpOutputArgument(name = "ResultStatus"))
        public int getStatus() {
                return status;
        }


}

any lead is heartily appreciated !
Reply | Threaded
Open this post in threaded view
|

Re: Not Able to Create Device !!

Jean-Claude Dufourd
The error message seems pretty clear: you need to define the related state variable (retTextValue) like this below...

    @UpnpStateVariable(defaultValue = "0", sendEvents = false)
    private String retTextValue = "";

Best regards
JC

Le 4/4/14 14:05 , r4jiv [via Mailinglists] a écrit :
I am trying to pass String between two android devices and I am stuck at this point not able to figure out why I am getting this error :-
Creating demo device failed Related state variable not found for output argument: RetTextValue

this is my class :-

package com.mobiotics.motionsdk.server.utils;

import org.teleal.cling.binding.annotations.*;

import java.beans.PropertyChangeSupport;

@UpnpService(serviceId = @UpnpServiceId("StringVals"), serviceType = @UpnpServiceType(value = "StringVals", version = 1))
public class StringVals {

        private final PropertyChangeSupport propertyChangeSupport;

        public StringVals() {
                this.propertyChangeSupport = new PropertyChangeSupport(this);
        }

        public PropertyChangeSupport getPropertyChangeSupport() {
                return propertyChangeSupport;
        }

        @UpnpStateVariable(datatype = "String", sendEvents = false, defaultValue = "")
        private String text = null;

        @UpnpStateVariable(eventMinimumDelta = 0)
        private int status = 0;

        @UpnpAction
        public void setText(
                        @UpnpInputArgument(name = "NewTextValue") String NewTextValue) {

                String textOldValue = text;
                text = NewTextValue;
                int statusOldValue = status;
                status = (NewTextValue == null) ? 0 : 1;

                // These have no effect on the UPnP monitoring but it's JavaBean
                // compliant
                getPropertyChangeSupport().firePropertyChange("text", textOldValue,
                                text);
                getPropertyChangeSupport().firePropertyChange("status", statusOldValue,
                                status);

                // This will send a UPnP event, it's the name of a state variable that
                // sends events
                getPropertyChangeSupport().firePropertyChange("Status", statusOldValue,
                                status);
        }

        @UpnpAction(out = @UpnpOutputArgument(name = "RetTextValue"))
        public String getText() {
                return text;
        }

        @UpnpAction(out = @UpnpOutputArgument(name = "ResultStatus"))
        public int getStatus() {
                return status;
        }


}

any lead is heartily appreciated !


If you reply to this email, your message will be added to the discussion below:
http://mailinglists.945824.n3.nabble.com/Not-Able-to-Create-Device-tp4026096.html
To start a new topic under Cling users and developers, email [hidden email]
To unsubscribe from Cling users and developers, click here.
NAML


--
Télécom
                  ParisTech Jean-Claude DUFOURD
Directeur d'études
Tél. : +33 1 45 81 77 33
37-39 rue Dareau
75014 Paris, France

Site webTwitterFacebookGoogle+Blog
Reply | Threaded
Open this post in threaded view
|

Re: Not Able to Create Device !!

r4jiv
thanks for your reply , but issue was with method name not with definition of state variable , i solved it :) thanks again
Reply | Threaded
Open this post in threaded view
|

Re: Not Able to Create Device !!

Jean-Claude Dufourd
well, when I remove the definition of the state variable retTextValue, I get the exact message you mention...
Reply | Threaded
Open this post in threaded view
|

Re: Not Able to Create Device !!

r4jiv
now I am facing following issue while trying to call SetText() method :-

package com.mobiotics.motionsdk.server.utils;

import org.teleal.cling.binding.annotations.*;

import java.beans.PropertyChangeSupport;

@UpnpService(serviceId = @UpnpServiceId("StringVals"), serviceType = @UpnpServiceType(value = "StringVals", version = 1))
public class StringVals {

        private final PropertyChangeSupport propertyChangeSupport;

        public StringVals() {
                this.propertyChangeSupport = new PropertyChangeSupport(this);
        }

        public PropertyChangeSupport getPropertyChangeSupport() {
                return propertyChangeSupport;
        }

        @UpnpStateVariable(datatype = "String", sendEvents = false, defaultValue = "")
        private String text = null;

        @UpnpStateVariable(eventMinimumDelta = 0)
        private int status = 0;

        @UpnpAction
        public void setText(
                        @UpnpInputArgument(name = "NewTextValue") String NewTextValue) {

                String textOldValue = text;
                text = NewTextValue;
                int statusOldValue = status;
                status = (NewTextValue == null) ? 0 : 1;

                // These have no effect on the UPnP monitoring but it's JavaBean
                // compliant
                getPropertyChangeSupport().firePropertyChange("text", textOldValue,
                                text);
                getPropertyChangeSupport().firePropertyChange("status", statusOldValue,
                                status);

                // This will send a UPnP event, it's the name of a state variable that
                // sends events
                getPropertyChangeSupport().firePropertyChange("Status", statusOldValue,
                                status);
        }

        @UpnpAction(out = @UpnpOutputArgument(name = "RetTextValue"))
        public String getText() {
                return text;
        }

        @UpnpAction(out = @UpnpOutputArgument(name = "ResultStatus"))
        public int getStatus() {
                return status;
        }


}


Error: Current state of service prevents invoking that action. Connection error or no response received.