Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use the descriptor command to get localize name? #288

Open
kdon3141 opened this issue Aug 11, 2016 · 8 comments
Open

How to use the descriptor command to get localize name? #288

kdon3141 opened this issue Aug 11, 2016 · 8 comments

Comments

@kdon3141
Copy link

Hello,

I've just updated my AVDECC library for the first time in two years. The one thing I can't seem to quite understand is how to get a localized string with reference. It used to only take one parameter, but now it takes 3 (localized description, descriptor index, index). Can't quite seem to get it working. Any input/help is appreciated

(below is code in question from new library)


(descriptor_base.h)
///
/// \return The localized string reference pointing to the localized descriptor name.
///
AVDECC_CONTROLLER_LIB32_API virtual uint16_t STDCALL localized_description() = 0;

(configuration_descriptor.h)
///
/// \return The strings descriptor index and the string index for the string corresponding to a particular localized description.
///
AVDECC_CONTROLLER_LIB32_API virtual int STD
CALL get_strings_desc_string_by_reference(size_t reference, size_t &string_desc_index, size_t &string_index) = 0;


Katie

@vronchetti
Copy link

vronchetti commented Aug 11, 2016

Hi Katie,

You can use the get_strings_desc_string_by_reference API to input a localized_description and output a strings_descriptor index and a string_index within that descriptor.


Example: Finding the localized_description string for clock_source_descriptor index 0.

avdecc_lib::clock_source_descriptor * clk_src_desc = configuration->get_clock_source_desc_by_index(0);
avdecc_lib::clock_source_descriptor_response *clk_src_resp_ref = clk_src_desc->get_clock_source_response();

size_t string_desc_index;
size_t string_index;

int ret = configuration->get_strings_desc_string_by_reference(clk_src_resp_ref->localized_description,
   string_desc_index, string_index);

if (!ret)
{
   avdecc_lib::strings_descriptor * strings_desc = configuration->get_strings_desc_by_index(strings_desc_index);
   avdecc_lib::strings_descriptor_response *strings_resp_ref = strings_desc->get_strings_response();
   // the localized description string
   uint8_t * clock_source_localized_desc_str = strings_resp_ref->get_string_by_index(string_index)
   delete strings_resp_ref
}
delete clk_src_resp_ref;

Let me know if I can be of any other help.

Victor

@andrew-elder
Copy link
Collaborator

@kdon3141 - has your question been answered?

@kdon3141
Copy link
Author

@vronchetti thank you ! @andrew-elder yes, I will mess around with this.

@kdon3141
Copy link
Author

@vronchetti I am looking at the example code you gave me, and I am having trouble understanding your usage of

size_t string_desc_index;
size_t string_index;

They are used in other parts of the example, but they are initialized with no values set to them, no? I'm just a little confused about this, and could use some clarification.

Thank you!

@andrew-elder
Copy link
Collaborator

If you look in the header file

AVDECC_CONTROLLER_LIB32_API virtual int STDCALL get_strings_desc_string_by_reference(size_t reference, size_t & string_desc_index, size_t & string_index) = 0;

you will see that the string_desc_index and string_index are returned from a call to get_strings_desc_string_by_reference().

@kdon3141
Copy link
Author

@vronchetti I was looking at the history of the configuration_descriptor.h file and there was a commit of May 13th, 2015 titled 'config_desc string return fix'. This was the commit that changed the method get_strings_desc_string_by_reference() to what it is now. I was using this method in my wrapped classes to get the localized name of some configurations, and it was working perfectly fine beforehand. I'm just a little curious as to why it was changed.

@vronchetti
Copy link

@kdon3141 see #195

@andrew-elder
Copy link
Collaborator

Also, previous version did not support more than one strings descriptor, ie a maximum of 7 strings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants