FriendlyName on Device

6 views
Skip to first unread message

Leo C.

unread,
Jun 8, 2011, 12:13:57 PM6/8/11
to WS4D-gSOAP Users
Hello,

I am retrieving metadata from ThisDevice and ThisModel (such as in the
"describe" example). When testing with WS4D server, there are no
problem, but when I used SOA4D server the FriendlyName was not
displayed.

In my code I followed the "describe" example to get the FriendlyName
like this :

if (ThisDevice.__sizeFriendlyName > 0) && ws4d_locstring_get
(ThisDevice.FriendlyName, ThisDevice.__sizeFriendlyName, "en"))
{
friendlyName = ws4d_locstring_get (ThisDevice.FriendlyName,
ThisDevice.__sizeFriendlyName, "en");
}

I realized afterwards that SOA4D servers may not use English as
language but just French, so I gave this a try :

if (ThisDevice.__sizeFriendlyName > 0)
{
friendlyName = (ThisDevice.FriendlyName)->string;
}

and it worked for both WS4D and SOA4D servers, but I don't think this
is the right way to do it.

Here are my questions :
Is there only one language for each device? and if not, what is going
to happen with my last example?
Is there a way to get the language(s) of the device in order to use my
first example?
And finally, I didn't find anything in the reference manual about
"__sizeFriendlyName", I assumed that it was the number of languages.
Is that right?

Elmar Zeeb

unread,
Jun 9, 2011, 6:55:56 AM6/9/11
to ws4d-gso...@googlegroups.com
Hi Leo,

Am 08.06.2011 18:13, schrieb Leo C.:
> Hello,
>
> I am retrieving metadata from ThisDevice and ThisModel (such as in the
> "describe" example). When testing with WS4D server, there are no
> problem, but when I used SOA4D server the FriendlyName was not
> displayed.
>
> In my code I followed the "describe" example to get the FriendlyName
> like this :
>

> if (ThisDevice.__sizeFriendlyName> 0)&& ws4d_locstring_get


> (ThisDevice.FriendlyName, ThisDevice.__sizeFriendlyName, "en"))
> {
> friendlyName = ws4d_locstring_get (ThisDevice.FriendlyName,
> ThisDevice.__sizeFriendlyName, "en");
> }
>
> I realized afterwards that SOA4D servers may not use English as
> language but just French, so I gave this a try :
>
> if (ThisDevice.__sizeFriendlyName> 0)
> {
> friendlyName = (ThisDevice.FriendlyName)->string;
> }
>
> and it worked for both WS4D and SOA4D servers, but I don't think this
> is the right way to do it.
>
> Here are my questions :
> Is there only one language for each device? and if not, what is going
> to happen with my last example?

No, there can be any number of languages. And your example will always
return the first example.

The friendlyName element is a dynamic array
(http://www.cs.fsu.edu/~engelen/soapdoc2.html#tth_sEc11.11) - the way
gsoap maps elements with maxOccurs=unbounded. The __sizeFriendlyName
gives the number of elements in the array. The array consists of
structures of
http://trac.e-technik.uni-rostock.de/projects/ws4d-gsoap/browser/trunk/include/ws4d_localizedstring.h#L33
. You can look at the code in
ws4d_locstring_get()
http://trac.e-technik.uni-rostock.de/projects/ws4d-gsoap/browser/trunk/src/libdpws/ws4d_misc.c#L38
to see how to work with such arrays.

> Is there a way to get the language(s) of the device in order to use my
> first example?

I think it is better to be able to iterate all languages. I can add
function/macro like ws4d_locstring_foreach(string, lang, it, locstring)
to ws4d-gsoap.

I created a ticket for this feature, but can't promise implement this
soon. http://trac.e-technik.uni-rostock.de/projects/ws4d-gsoap/ticket/104

> And finally, I didn't find anything in the reference manual about
> "__sizeFriendlyName", I assumed that it was the number of languages.
> Is that right?
>

Yeah, that is specific to gsoaps dynamic arrays.

Regards,
Elmar

--

*******************************************************************************
Dipl.-Inf. Elmar Zeeb
Universit�t Rostock, Fakult�t f. Informatik und Elektrotechnik
Institut f. Angewandte Mikroelektronik und Datentechnik
University of Rostock, Faculty of CS and EE
Institute of Applied Microelectronics and Computer Engineering,
18051 Rostock
Deutschland/Germany
Tel. : ++49 (0)381 498 - 7262
Fax : ++49 (0)381 498 - 7252
Email: elmar...@uni-rostock.de
www : http://www.imd.uni-rostock.de/, http://www.ws4d.org/
*******************************************************************************

CHABANNE Leo

unread,
Jun 9, 2011, 8:26:36 AM6/9/11
to ws4d-gso...@googlegroups.com
Hi Elmar,
Thank you, these explanations are really helpful! I'll manage to take care
of my issue now.

Regards
_________________________________________________________________

Léo Chabanne | Sogeti High Tech
leo.ch...@sogeti.com

485 Avenue de l’Europe | 38380 Montbonnot Saint Martin | France
www.sogeti.com / www.sogeti-hightech.fr
_________________________________________________________________

-----Message d'origine-----
De : ws4d-gso...@googlegroups.com
[mailto:ws4d-gso...@googlegroups.com] De la part de Elmar Zeeb
Envoyé : jeudi 9 juin 2011 12:56
À : ws4d-gso...@googlegroups.com
Objet : Re: FriendlyName on Device

Hi Leo,

Regards,
Elmar

--

Universität Rostock, Fakultät f. Informatik und Elektrotechnik


Institut f. Angewandte Mikroelektronik und Datentechnik
University of Rostock, Faculty of CS and EE
Institute of Applied Microelectronics and Computer Engineering,
18051 Rostock
Deutschland/Germany
Tel. : ++49 (0)381 498 - 7262
Fax : ++49 (0)381 498 - 7252
Email: elmar...@uni-rostock.de
www : http://www.imd.uni-rostock.de/, http://www.ws4d.org/
****************************************************************************
***

--
You received this message because you are subscribed to the Google Groups
"WS4D-gSOAP Users" group.
To post to this group, send email to ws4d-gso...@googlegroups.com.
To unsubscribe from this group, send email to
ws4d-gsoap-use...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/ws4d-gsoap-users?hl=en.

Reply all
Reply to author
Forward
0 new messages