Example of web request over mobile data connection

Hello,

I can’t seem to find any examples related to starting a mobile data connection, and using that connection to get data from a server.

There is HTTPGET example, but it uses wifi, which is not what I’m trying to achieve.

I’ve gone through the MDC documentation, but can’t seem to get anything to work.

Kind Regards,

Brown

*EDIT: I’m using MangOH Red with WP7702

For getting a mobile connection I have just made the following:

  • le_mrc_SetRadioPower(LE_ON)
  • On the le_mrc_AddNetRegStateEventHandler I have the following (pseudo code)
le_mdc_ProfileRef_t profile = le_mdc_GetProfile(LE_MDC_DEFAULT_PROFILE);
if (state == LE_MRC_REG_HOME || state == LE_MRC_REG_ROAMING)
{
  if (le_mdc_StartSession(profile) == LE_OK)
  {
    LE_DEBUG("Started data session");
  }
}
  • At the le_mdc_AddSessionStateHandler I have the following (pseudo code):
  if ( le_mdc_IsIPv4(profileRef) )
  {   
    le_mdc_GetIPv4Address(profileRef, ipAddr, sizeof(ipAddr));
    le_mdc_GetIPv4GatewayAddress(profileRef, gatewayAddr, sizeof(gatewayAddr));
    le_mdc_GetIPv4DNSAddresses( profileRef, dns1Addr, sizeof(dns1Addr), dns2Addr, sizeof(dns2Addr));
    snprintf(systemCmd, sizeof(systemCmd), "/sbin/route add default gw %s", gatewayAddr);

  }
  else if ( le_mdc_IsIPv6(profileRef) )
  {
    le_mdc_GetIPv6Address(profileRef, ipAddr, sizeof(ipAddr));
    le_mdc_GetIPv6GatewayAddress(profileRef, gatewayAddr, sizeof(gatewayAddr));
    le_mdc_GetIPv6DNSAddresses( profileRef, dns1Addr, sizeof(dns1Addr), dns2Addr, sizeof(dns2Addr)); 
    snprintf(systemCmd, sizeof(systemCmd), "/sbin/route -A inet6 add default gw %s", gatewayAddr);
  }

AddDnsAddressesToResolv();

Hope that helps

Hi @MisterBrownRSA
did you try the shared example ?
do you need more information for this topic?
best regards,