Created
January 17, 2011 21:16
-
-
Save luisbebop/783505 to your computer and use it in GitHub Desktop.
ssl with verix ethernet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AppObject = CreateAppObj(4); // for ETHERNET | |
//terminais Vx510 6A2 com modem ethernet comum ou Vx510 11A1 com modem ethernet interno USB | |
if (SVC_INFO_MODULE_ID(3) == 22) | |
comnObj = uclFactory->Create(COM3, &ret, (ApplicationObj *)AppObject,ETHERNET); | |
else | |
comnObj = uclFactory->Create(COM_ETH1, &ret, (ApplicationObj *)AppObject,ETHERNET); | |
// utilizado camada IP/PPP em DIAL, GPRS, GSM suportados pelas rotinas da biblioteca UCL | |
ret = AssignUcltoTCP(comnObj, timer, 20000, 60000, 30000, 15000, 6000, 6000); | |
//phoneNo e APN sao setados diretamente no Appobj.c | |
// If you are using DHCP leave this address to 0.0.0.0 else assign the static IP address | |
strcpy(net_param.ipAddress, myIp); | |
strcpy(net_param.ipSubnetMask, subnet); | |
//terminais Vx510 6A2 com modem ethernet comum ou Vx510 11A1 com modem ethernet interno USB | |
if (SVC_INFO_MODULE_ID(3) == 22) | |
net_param.datalinkProtocol = DL_PPP_CO_ETH; | |
else | |
net_param.datalinkProtocol = DL_USB_ASIX_ETH; | |
// Following lines assigns DNS and GATEWAY adddresses. It is not required while using DHCP. | |
setparam(GATEWAY, myGateway, strlen(myGateway)); | |
setparam(DNSPRI, dnsPrimario, strlen(dnsPrimario)); | |
setparam(DNSSEC, dnsSecundario, strlen(dnsSecundario)); | |
ret = SetTimeout(SEND_TIMEOUT, 1000); | |
ret = SetTimeout(RECEIVE_TIMEOUT, 3000); | |
ret = netconfig(&net_param); | |
if(withSSL) vSSL_Init(NULL, NULL); | |
if(ret != 0) | |
{ | |
lastError = MODERR_INVALIDDIALPARAMS; | |
return false; | |
} | |
else | |
{ | |
// Setting the time to wait after sending AT+iDOWN command. If not set default value is 2750 msec. | |
waitTime = 1000; // time is in milli-seconds | |
ret = setparam(WAIT_ICHIPRESET, (char*)&waitTime, sizeof(waitTime)); | |
// This following 2 lines are for Ethernet and WiFi medias only. The setparam() for parameter | |
// should called after netconfig(). This parameter will make iChip commands to respond within | |
// the time set. | |
tcpTimout = 7; // time is in seconds | |
ret = setparam(TCP_TIMEOUT, (char*)&tcpTimout, sizeof(tcpTimout)); | |
ret = netconnect(0); | |
if(ret != 0) | |
{ | |
lastError = MODERR_ETHCONNECTFAIL; | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment