where can i find API for sending a command over smp service for downloading a file from file system

hello Nordic

i am working with ncs v2.5.0 (with nrf52840 and nrf52832)

i am using the fs_mgmt.c for upload/download files from lfs.

till now used it only on one side, peripheral which receives a request to download that activate the relevant handlers. 

now we want to download a file with smp with 2 devices, both running on ncs. 

is there an example for api commands for downloading files from another device ? 

if not can you direct to me where to look for that api 

hope to read you soon

best regards

Ziv

Parents Reply Children
  • Hey Vidar

    i am not really sure how i can use it 

    seems to me that i have to implement something like img_mgmt_client.c for fs -> fs_mgmt_client.c 

    but when i try to understand the API use,

    from this test /ncs/zephyr/tests/subsys/mgmt/mcumgr/smp_client/src/main.c

    and this sample https://github.com/nrfconnect/sdk-nrf/tree/main/samples/cellular/lwm2m_client

    i get a little bit lost, each uses different methods and i don't see where they actually call for the send and where do they manage the continues receive and respond of a big file.

    i see this call ' smp_client_send_cmd(..) '

    but i am not sure if it is correct to handle the response and save to fs, and resend to request the next packet, all in this call back (because then maybe it is not using smp stack but the stack of the calling process (which is not as large), but i don't know how to use some under the hood implementation)-> 

    typedef int (*smp_client_res_fn)(struct net_buf *nb, void *user_data);
     
    also not sure if just calling for 
    ' smp_client_object_init(..) ' followed by 
    ' smp_client_buf_allocation(..) ' is enough and use
    the ' smp_client_buf_free(..) ' at the end of all transmission
    hope to read from you soon
    best regards
    Ziv
  • Hi Ziv,

    ziv123 said:
    seems to me that i have to implement something like img_mgmt_client.c for fs -> fs_mgmt_client.c 

    Yes, Zephyr does not include a client for fs_mgmt, so this is something you will need to implement, unfortunately. I'm not that familiar with this code, so my best suggestion is to use the img_mgmt_client.c implementation as a reference.

    Best regards,

    Vidar

Related