Thomasz,
On 05/11/2015 02:36 PM, Tomasz Bursztyka wrote: > Hi Mylene, > >>> That would need to be fixed yes. >>> My best bet would be to revert the logic when it comes to context and >>> network: >>> >>> instead of modem->context = ... >>> you could have: context->modem = modem >>> and modem->contexts would be a list of those context (a simple GSList). >> Yes, this is what I have done so far. I did not create a GSList but a >> HashTable to have the context_path, but it is pretty the same logic. > > Unless you get dozens of contexts, go for a GSList. GHashTable does not have > tiny memory footprint. > (well, the current code is not perfect either. With an hashtable storing > context path/data pairs is also overkill. > I guess we would need to cleanup this also one day) Yes, I will have only 2 contexts so, you are right, I will modify it to use a GSList. > >>> Then you would create the network with the context as data. >>> For the network, try to get a name made of the modem's name, and something >>> that identifies the context (is there such thing? I don't know) >> In fact, the network is created with the context path as identifier. So I >> have the information but since it is the identifier, should I create a list >> of networks ? do you think it could work ? If I implement a list of network, >> the "add_network" and "connman_network_create" would be called twice (for >> the two contexts). I think you have more distance than me about the code : >> do you think it could work like this ? > > Actually I missed this last time. But you seem to be on the right track. Good to know ! > Since you are moving towards a network per context, remove the network > pointer and put it network_context structure. > You will thus get in a modem: a list of context as you did, each context will > point to its proper network structure. > So indeed you will call add_network and connman_network_create as many times > as context your modem provides. Ok, sounds better than a network list. > > You will have to change many functions which works on modem basis instead of > context. > (like set_connected, or netreg_update_strength where you would need to loop > on each context from the modem, etc...) > Basically, whatever exists around modem->network, you will have to adapt the > code to the new logic. > > I have never touched that plugin myself, so I might miss some stuff there. I understand and see (in outline) how adapt the code. Thank you for the tips, it will help me a lot if the Frederik solution's did not work for me. Best regards, Mylene _______________________________________________ connman mailing list [email protected] https://lists.connman.net/mailman/listinfo/connman
