How can I start session mdc?

I want to start the data connection by my legato app.
On documentation, I found the function: le_mdc_StartSession

#define NB_PROFILE  1
static le_mdc_ProfileRef_t ProfileRef[NB_PROFILE];
COMPONENT_INIT
{
	LE_INFO("begin app");
	le_mdc_StartSession(ProfileRef[0]);

But when I build the app, the following error occurs:

    /home/victor/ftsmartmind/modem-fx30s/conversor-mqtt/vscode/fx30s/components/fx30sSerialMqttComponent/fx30sSerialMqttComponent.c:23:8: error: unknown type name ‘le_mdc_ProfileRef_t’
     static le_mdc_ProfileRef_t ProfileRef[NB_PROFILE];
            ^~~~~~~~~~~~~~~~~~~
    /home/victor/ftsmartmind/modem-fx30s/conversor-mqtt/vscode/fx30s/components/fx30sSerialMqttComponent/fx30sSerialMqttComponent.c: In function ‘_fx30sSerialMqttComponent_COMPONENT_INIT’:
    /home/victor/ftsmartmind/modem-fx30s/conversor-mqtt/vscode/fx30s/components/fx30sSerialMqttComponent/fx30sSerialMqttComponent.c:29:2: error: implicit declaration of function ‘le_mdc_StartSession’; did you mean ‘le_msg_GetSession’? [-Werror=implicit-function-declaration]
      le_mdc_StartSession(ProfileRef[0]);

Is it necessary to include some lib on the project to use this function? I found some examples but nothing works.

I don’t see problem, you can use my application and put your code in demo.c
modemDemo1.rar (2.0 MB)

I compiled in VSCode with swi-fx30-catm_2.0.0 package:

  1. leaf shell
  2. cd apps/Demo/modemDemo1
  3. make

Running your example, I see that the le_mdc_StartSession function is successfully executed

root@fx30s:~# cm data
Index:                         1
APN:                           allcom.swir
PDP Type:                      IPV4V6
Connected:                     yes
Auth type:                     PAP
User name:                     allcom
Password:                      allcom
Interface:                     rmnet_data0
Family[IPv4]:                  inet
IP[IPv4]:                      10.110.47.74
Gateway[IPv4]:                 10.110.47.73
Dns1[IPv4]:                    8.8.8.8
Dns2[IPv4]:                    4.2.2.2

It looks like it starts the network interface but I don’t have internet connectivity

root@fx30s:~# ping google.com
ping: bad address 'google.com'
root@fx30s:~# 

I can only connect to the internet when I execute the command in the terminal:

root@fx30s:~# cm data connect
Checking if device 'rmnet_data0' is up ... ok
Routing inet ... ok
Updating /etc/resolv.conf ... ok
Updating /etc/resolv.conf ... ok

root@fx30s:~# ping google.com
PING google.com (172.217.1.46): 56 data bytes
64 bytes from 172.217.1.46: seq=0 ttl=116 time=1258.533 ms

How do I start an internet connection through my legato application?

Is it ok to ping 8.8.8.8?

Btw, you can call “cm data connect” within unsandboxed legato app with systen() api.

Fyi, it should work fine:

Using le_mdc_StartSession I get the following ping return

root@fx30s:~# ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8): 56 data bytes
ping: sendto: Network is unreachable

I changed one implementation per system (“cm data connect”); disabling the sandbox, but the cm command was not recognized:

Feb 23 08:35:05 fx30s user.err Legato: =ERR= | mqttPublisher[2788] | cm: not found

But it worked out using the full path to the cm.

system("/legato/systems/current/bin/cm data connect");

Thank you for your help!

hi i need help with mangOH yellow board
iam totally new to this board and i need some instruction if anyone can help me please send any contact media
thank you

You can see here

https://mangoh.io/mangoh-yellow-resources-getting-started

1 Like

i can’t login into mangoh.io website it is showing some error
but i need to work in linux with this board and i have set legato platform but i can’t connect board to
internet

i don’t see problem to download the document:

sir, iam not able to ping the board,i am getting unreachable,and i am not able to connect to internet
they have not shown in document how to connect to internet,

did you try with linux?

yes sir, i have also inserted sim , and tried connect wifi also

then have you set the IP address of the usb interface on linux PC side?

e.g.
sudo ifconfig usb0 192.168.2.3

after that you can try to ping 192.168.2.2 which is the IP address of module’s ECM interface

ok sir, i will try ,but my module is wp7608 it is not a problem wright

WP7608 should be OK for the ping test of USB ECM interface

nayan@nayan:~$ sudo ifconfig USB1 192.168.2.3
SIOCSIFADDR: No such device
USB1: ERROR while getting interface flags: No such device

I am getting like this

did you check “ifconfig -a” to see what interface do you have?

you can also check in dmesg

i tried for all interface it is showing same

what network interface is created?