Use Attributes in commands

Hello!
Is it possible to use attributes in a command? Not to read it in a client, only use it as a variable. If yes, how can I do this? How to get the value of an attribute?
Hi,

Let's consider an example Java Tango server.

The attribute will be normally a field in this case:


@Attribute
private double myDoubleAttr;

//setters and getters


So using that attribute in a command in this case is straightforward:


@Command
public double readMyDoubleAttr(){
return this.myDoubleAttr;
}


Hope this helps.
Edited 5 years ago
Ingvord
Hi,

Let's consider an example Java Tango server.

The attribute will be normally a field in this case:


@Attribute
private double myDoubleAttr;

//setters and getters


So using that attribute in a command in this case is straightforward:


@Command
public double readMyDoubleAttr(){
return this.myDoubleAttr;
}


Hope this helps.
I'm not really familiar with Java. Could you please show me an example in C++?
Well, in C++ there is too much boilerplate code. You can easily generate one using Pogo for instance.

The basic idea is that you have a field say myDoubleAttr wich you get/set via read_/write_ methods.

In any other method, which may be a command method, just access the field e.g. this->myDoubleAttr

Hope this helps.

Cheers
Hi Team,

I'm not sure whether this is the correct forum to post this, but i have tried Tango contact email address as well.

We are a sustainable textile manufacturer from the USA and we are looking forward to automate our manufacturing plants and we are on the lookout for an effective MES system. I want to know more about Tango and its capabilities and how it will help us to automate our manufacturing plants.

whom should I contact ?

Thanks and regards,
Prasad Wickramasinghe
 
Register or login to create to post a reply.