uniquid / esp32-sdk

1 stars 0 forks source link

create context to send #1

Open giovannicandotti opened 6 years ago

giovannicandotti commented 6 years ago

Salve, sto provando ad inviare un messaggio periodicamente, ma non riesco a creare il contesto: errore 8, MSG_NOT FOUND. Ho usato l'esempio "test_user.c" ` // create the contest for the communication (contract, identities of the peers, etc) UID_ClientChannelCtx ctx; //if ( UID_MSG_OK != (ret = UID_createChannel("UID8ea4f87dbbe5", &ctx)) ) { if ( UID_MSG_OK != (ret = UID_createChannel("mwTrYbu4DjfE4FAby44hHMpo3174zL3t3H", &ctx)) ) {

    //          < manage_error(ret) >

    printf("cando> ERROR --> %d\n\n\n", ret);
    return;
}

` Qual'è un valore valido per il primo parametro della UID_createChannel?

successivamente, devo inviare il messaggio (ma qui non sono mai arrivato); potrebbe andare il seguente codice? // < Send_Msg_to_provider(buffer, size) > data_in_service arg; arg.type=0; //sprintf(arg.serviceUserAddress,"%s", ""); arg.msg=buffer; arg.len=size; service_provider(&arg); printf("cando>: SENT\n\n\n");

a cosa serve, e quali sono valori validi, per il parametro serviceUserAddress?

grazie

giovannicandotti commented 6 years ago
screen shot 2018-07-10 at 06 11 29
stefacc commented 6 years ago

Hi Giovanni can you explain more about your project? do you need a user or a provider or both?

giovannicandotti commented 6 years ago

hi stefacc, I've downloaded dev-in-a-box and esp32-sdk. As per previous talk with Pepe and Cardinale Ciccotti, I'm trying to integrate your system with mine, to have a POC. So, now I'm able to intercept and interpret a mqtt message sent by a 'tank', but I'm not able to get my device sending autonomously a mqtt message with a payload respectful of your syntax.

So, what I definitely need is to understand how to send a message - I guess it's a user - while the provider is the 'tank', right?

stefacc commented 6 years ago

Ok perfect A "tank" (PC app or ESP32 fw) to start a communication (send a message and not an answer) must be a "user". "ESP32-sdk demo" does not provide this functionality because it derives from a previous project, provider-only. I will do it in the next days or next week

stefacc commented 6 years ago

Hi giovanni I did add user profile ;) https://github.com/uniquid/esp32-sdk/blob/b2da76550b58619da394a2888be4ec794d8c0fa5/src/init.c#L55

and from https://github.com/uniquid/esp32-sdk/blob/b2da76550b58619da394a2888be4ec794d8c0fa5/src/init.c#L94 to https://github.com/uniquid/esp32-sdk/blob/b2da76550b58619da394a2888be4ec794d8c0fa5/src/init.c#L104