Skip to content

Commit

Permalink
feat(Simcom-A7670C):
Browse files Browse the repository at this point in the history
Add platone to Simcom-A7670C #1377
BoATE-872
  • Loading branch information
zt222 committed Feb 21, 2023
1 parent 9be3f19 commit 1aed757
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 54 deletions.
Original file line number Diff line number Diff line change
@@ -1,16 +1,26 @@
/**
******************************************************************************
* @file sc_application.c
* @author SIMCom OpenSDK Team
* @brief Source code for SIMCom OpenSDK application, void userSpace_Main(void * arg) is the app entry for OpenSDK application,customer should start application from this call.
******************************************************************************
* @attention
*
* Copyright (c) 2022 SIMCom Wireless.
* All rights reserved.
*
******************************************************************************
*/
****************************************************************************************
* @FilePath: sc_application.c
* @Author: aitos
* @Date: 2023-02-21 11:22:10
* @LastEditors:
* @LastEditTime: 2023-02-21 11:22:10
* @Descripttion:
****************************************************************************************
*/
/**
******************************************************************************
* @file sc_application.c
* @author SIMCom OpenSDK Team
* @brief Source code for SIMCom OpenSDK application, void userSpace_Main(void * arg) is the app entry for OpenSDK application,customer should start application from this call.
******************************************************************************
* @attention
*
* Copyright (c) 2022 SIMCom Wireless.
* All rights reserved.
*
******************************************************************************
*/

/* Includes ------------------------------------------------------------------*/
#include <stdio.h>
Expand All @@ -19,7 +29,7 @@
#include <string.h>
#include <stdarg.h>
#include <unistd.h>
#include "sc_ApiMap.h"
#include "api_map.h"
#include "simcom_debug.h"
#include "simcom_os.h"
#include "simcom_uart.h"
Expand All @@ -32,33 +42,32 @@ extern void sAPP_UsbVcomTask(void);
extern void sAPP_PlatoneDemo(void);

/**
* @brief OpenSDK app entry.
* @param Pointer arg
* @note This is the app entry,like main(),all functions must start from here!!!!!!
* @retval void
*/
* @brief OpenSDK app entry.
* @param Pointer arg
* @note This is the app entry,like main(),all functions must start from here!!!!!!
* @retval void
*/
void userSpace_Main(void *arg)
{
/* simcom api init. Do not modify! */
ApiMapInit(arg);
// sAPI_enableDUMP();
/* UI demo task for customer with CLI method for all demo running,
customer need to define SIMCOM_UI_DEMO_TO_USB_AT_PORT or
SIMCOM_UI_DEMO_TO_UART1_PORT to select hardware interface.
*/
sleep(5);//Wait for USB initialization to complete and print catstudio log.

// sAPP_SimcomUIDemo();
/* simcom api init. Do not modify! */
ApiMapInit(arg);
// sAPI_enableDUMP();
/* UI demo task for customer with CLI method for all demo running,
customer need to define SIMCOM_UI_DEMO_TO_USB_AT_PORT or
SIMCOM_UI_DEMO_TO_UART1_PORT to select hardware interface.
*/
sleep(5); // Wait for USB initialization to complete and print catstudio log.

sAPP_UartTask();
sAPP_UrcTask();
sAPP_UsbVcomTask();
// sAPP_HelloWorldDemo();
sAPP_PlatoneDemo();
printf("user app is running...");
// sAPP_SimcomUIDemo();

sAPP_UartTask();
sAPP_UrcTask();
sAPP_UsbVcomTask();
// sAPP_HelloWorldDemo();
sAPP_PlatoneDemo();
printf("user app is running...");
}
#define _appRegTable_attr_ __attribute__((unused, section(".userSpaceRegTable")))

#define appMainStackSize (1024*10)
userSpaceEntry_t userSpaceEntry _appRegTable_attr_ = {NULL, NULL, appMainStackSize, 30, "userSpaceMain", userSpace_Main, NULL };
#define appMainStackSize (1024 * 10)
userSpaceEntry_t userSpaceEntry _appRegTable_attr_ = {NULL, NULL, appMainStackSize, 30, "userSpaceMain", userSpace_Main, NULL};
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
#include "http2intf.h"
#include "simcom_tcpip_old.h"
#include "simcom_ssl.h"
#include "boat_simcom_ssl.h"
#endif

// #if (PROTOCOL_USE_HLFABRIC == 1)
Expand Down Expand Up @@ -344,21 +343,21 @@ BSINT32 BoatConnect(const BCHAR *address, void *rsvd)
memcpy(ip, address, (int)(ptr - address));
memcpy(port, ptr + 1, strlen(address) - (int)(ptr - address));

if (-1 == sAPI_TcpipPdpActive(1, 1))
{
BoatLog(BOAT_LOG_CRITICAL, "sAPI_TcpipPdpActive() error");
return -1;
}
// if (-1 == sAPI_TcpipPdpActive(1, 1))
// {
// BoatLog(BOAT_LOG_CRITICAL, "sAPI_TcpipPdpActive() error");
// return -1;
// }

sockfd = sAPI_TcpipSocket(SC_AF_INET, SC_SOCK_STREAM, SC_IPPROTO_TCP);
BoatLog(BOAT_LOG_CRITICAL, "BoatConnect sockfd[%d]", sockfd);
if (sockfd < 0)
{
BoatLog(BOAT_LOG_CRITICAL, "sAPI_TcpipSocket() error");
if (-1 == sAPI_TcpipPdpDeactive(1, 1))
{
BoatLog(BOAT_LOG_CRITICAL, "sAPI_TcpipPdpDeactive() error");
}
// if (-1 == sAPI_TcpipPdpDeactive(1, 1))
// {
// BoatLog(BOAT_LOG_CRITICAL, "sAPI_TcpipPdpDeactive() error");
// }
return -1;
}

Expand All @@ -369,10 +368,10 @@ BSINT32 BoatConnect(const BCHAR *address, void *rsvd)
sAPI_SslClose(0);
sAPI_TcpipClose(sockfd);
BoatLog(BOAT_LOG_CRITICAL, "sAPI_TcpipGethostbyname() error");
if (-1 == sAPI_TcpipPdpDeactive(1, 1))
{
BoatLog(BOAT_LOG_CRITICAL, "sAPI_TcpipPdpDeactive() error");
}
// if (-1 == sAPI_TcpipPdpDeactive(1, 1))
// {
// BoatLog(BOAT_LOG_CRITICAL, "sAPI_TcpipPdpDeactive() error");
// }
return -1;
}

Expand All @@ -387,10 +386,10 @@ BSINT32 BoatConnect(const BCHAR *address, void *rsvd)
sAPI_SslClose(0);
sAPI_TcpipClose(sockfd);
BoatLog(BOAT_LOG_CRITICAL, "sAPI_TcpipConnect() error");
if (-1 == sAPI_TcpipPdpDeactive(1, 1))
{
BoatLog(BOAT_LOG_CRITICAL, "sAPI_TcpipPdpDeactive() error");
}
// if (-1 == sAPI_TcpipPdpDeactive(1, 1))
// {
// BoatLog(BOAT_LOG_CRITICAL, "sAPI_TcpipPdpDeactive() error");
// }
return -1;
}

Expand Down

0 comments on commit 1aed757

Please sign in to comment.