speechd-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: C API: Query regarding Speech Dispatcher Callbacks and State Managem


From: Day Garwood
Subject: Re: C API: Query regarding Speech Dispatcher Callbacks and State Management
Date: Sun, 17 Sep 2023 08:58:22 +0100
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1

Hi Samuel,

Thank you for your prompt response.

I appreciate your suggestion regarding the use of client_id through spd_get_client_id.

The challenge I'm facing is that to retrieve the client ID, I'd need access to the connection. This connection information, along with other data, is part of the state/I'm trying to access.

To provide some context, here's a brief sample of how my code is structured right now (error checks are omitted for brevity):


struct my_state

{

spd_connection* connection;

/* Other members here */

};

void init(struct my_state* state)

{

state->connection=spd_connect("myapp", "myclient", NULL, SPD_MODE_THREADED);

/* set callbacks and activate notifications here. */

}


void _vb_spd_callback(int msg, int client, SPDNotificationType state)

{

/* need access to struct my_state* state passed to init and other functions here. */

}


Is there another method or mechanism I might be missing to retrieve this?
Thank you for your guidance and understanding.

Best,

Day.


On 16/09/2023 22:50, Samuel Thibault wrote:
Hello,

Day Garwood, le sam. 16 sept. 2023 22:14:34 +0100, a ecrit:
but from what I can gather, the current callback mechanism
doesn't allow for sending user data or context.
Indeed, it seems that wasn't added.

I am looking for a way to accomplish this without the use of global
variables.
You can use client_id: spd_get_client_id will tell you what client_id a
given connection has, and the callback has it as parameter. That
requires looking up a bit, however.

Samuel




reply via email to

[Prev in Thread] Current Thread [Next in Thread]