Sedang Disiapkan

Wavecom OpenAT FTP serial data

Job: Program Wavecom Fastrack Supreme 20 GPRS modem with OpenAT.

Process: The modem is to take in serial input from a current profiler. The current profiler outputs one serial string every 5 seconds. The modem is to store the serial strings into a buffer and FTP the data to a server via GPRS every 1 hour. If the FTP transmission fails, the modem will redial every 10 minutes.

Status:

We have managed to program the modem with openAT to send the serial data input every 1 hour. But the problem is we noticed that every time the modem managed to ftp only 5840b out of the 20kb data buffer.

We tried to tune with this line

static wip_channel_t dst_ftp_cx = NULL, dst_data = NULL;

wip_setOpts(dst_ftp_cx, WIP_COPT_SND_BUFSIZE, 30000,WIP_COPT_SND_LOWAT,3000, WIP_COPT_END );

by adjusting the below variables but of no use:

WIP_COPT_SND_BUFSIZE 30000, 20000, 10000

WIP_COPT_SND_LOWAT 10000, 3000, 500, 100, 0

Using dst_data instead of dst_ftp_cx

Another problem is when the modem is FTPing, it cannot take in the serial input so part of the serial data is missing.

Now we are stuck and need a programmer to continue from where we left off with the two problem above, and of course the code need to include error handling and ftp retry. Note we require source code.

Part of our code refer attachment.

The serial input string from the current profiler is below:

16 C811 70802 2008 3 28 12 21 52 3 0 1 2

40 200 100 10 1

0 0 0 2886 17424 0 0 0 0 0 15425

0 0 0 0 61 191 65 193 14 16 18 0 110 192 0 107

1 -1399 -2174 -172 0 0 0 129 131 162

2 -1412 -2378 -294 0 0 0 115 119 136

3 -2078 -1699 -211 0 0 0 115 107 118

4 -1839 -1868 -230 0 0 0 114 118 103

5 -1418 -2299 -333 0 0 0 109 124 104

6 -1778 -1971 -472 0 0 0 79 115 112

7 -1688 -1862 -289 0 0 0 120 95 109

8 -1675 -1995 -358 0 0 0 106 96 115

9 -986 -1709 -324 0 0 0 90 105 102

10 -1246 -1961 -422 0 0 0 87 104 94

11 -1399 -2030 -301 0 0 0 83 95 95

12 -1258 -775 -99 0 0 0 80 95 72

13 -992 -1405 -407 0 0 0 84 94 74

14 -1691 -1885 -484 0 0 0 82 99 83

15 -1603 -1586 -245 0 0 0 80 102 99

16 -1536 -1425 -239 0 0 0 87 91 102

17 -1266 -1690 -232 0 0 0 90 92 100

18 -1814 -1267 -326 0 0 0 65 69 96

19 -1379 -1944 -336 0 0 0 77 67 74

20 -1585 -1822 -495 0 0 0 56 61 54

21 -2084 -1354 -425 0 0 0 82 52 59

22 -1368 -1815 -126 0 0 0 61 63 66

23 -837 -1383 -436 0 0 0 45 58 66

24 -1608 -1715 -397 0 0 0 57 68 49

25 -1775 -1619 -282 0 0 0 47 56 59

26 -1445 -1433 -285 0 0 0 41 39 52

27 -1030 -1451 -256 0 0 0 40 43 46

28 -1248 -1572 -313 0 0 0 51 41 38

29 -1368 -2256 -160 0 0 0 39 43 49

30 -1256 -2065 -164 0 0 0 31 38 46

31 -1615 -2036 -278 0 0 0 29 32 38

32 -1926 -1847 3 0 0 0 50 23 44

33 -1281 -2289 -280 0 0 0 110 66 30

34 -1436 -1745 -343 0 0 0 75 137 32

35 -1763 -1328 -356 0 0 0 15 55 35

36 6009 -2757 -1856 0 0 0 13 13 67

37 -1235 1269 -1493 0 0 0 13 16 120

38 4405 -645 -2062 0 0 0 13 11 78

39 -2618 957 -1234 0 0 0 15 13 22

40 -1753 10311 499 0 0 0 15 14 22

Main source code:


#include "adl_global.h"
#include "wip.h"
#include "adl_rtc.h"
#define DST_SERVER "209.90.82.23"
#define DST_USER "datataker"
#define DST_PASSWORD "password"
#define DST_FILENAME "data.txt"
#define DST_ISPASSIVE TRUE
#define BKSP '\x08'
#define BKSPSEQ "\x08 \x08"
#define USED_FLOW ADL_FCM_FLOW_V24_UART1
s32 retVal;

adl_rtcTime_t presentTimeAndDate;
bool bFCMIsReady = TRUE;

ascii * buffer;
ascii * buffer2;


ascii * tempBuffer;
ascii * file_name;

static u16 tempLength;


static s8 V24Handle;
static int offset = 0;
static wip_channel_t
dst_ftp_cx = NULL,
dst_data = NULL;

u16 bufferLength;

static void evh_cx( wip_event_t *ev, void *ctx);
static void evh_data( wip_event_t *ev, void *ctx);
bool V24DataHandler ( u16 Length, u8 * Data );
bool V24CtrlHandler ( u8 Event );
void HelloWorld_TimerHandler ( u8 ID );

void appli_entry_point()
{
bufferLength = 0;

buffer = adl_memGet( 20000* sizeof(ascii) );
tempBuffer = adl_memGet( 20000* sizeof(ascii) );
file_name = adl_memGet( 20000* sizeof(ascii) );

TRACE (( 1, "fcm subscribe" ));
V24Handle = adl_fcmSubscribe ( USED_FLOW, V24CtrlHandler, V24DataHandler );

TRACE (( 1, "timer subscribe" ));
adl_tmrSubscribe ( TRUE, 600, ADL_TMR_TYPE_100MS, HelloWorld_TimerHandler );
}

static void evh_cx( wip_event_t *ev, void *ctx)
{
switch( ev->kind)
{
case WIP_CEV_OPEN:
wm_sprintf ( (file_name),"%d%d.%d%d.txt",presentTimeAndDate.Month,presentTimeAndDate.Day,presentTimeAndDate.Hour,presentTimeAndDate.Minute);
TRACE (( 1, "Make new file up FTP connection" ));
dst_data = wip_putFile( dst_ftp_cx, file_name, evh_data, NULL);
if( ! dst_data) { wip_debug( "Can't create data channel"); return; }
break;

case WIP_CEV_ERROR:
break;

case WIP_CEV_PEER_CLOSE:
break;
}
}

static void evh_data( wip_event_t *ev, void *ctx)
{
switch( ev->kind)
{
case WIP_CEV_OPEN:
wip_setOpts(dst_data, WIP_COPT_SND_BUFSIZE, 30000,WIP_COPT_SND_LOWAT,3000, WIP_COPT_END );
break;

case WIP_CEV_WRITE:
{
int nwrite = wip_write( dst_data, buffer, tempLength);

//wip_close( dst_data); //dst_data = NULL;
//wip_close( dst_ftp_cx); //dst_ftp_cx = NULL;

//adl_memRelease ( buffer );
tempLength = 0;
}
break;
case WIP_CEV_ERROR:
break;
}
}

bool V24CtrlHandler ( u8 Event )
{
bool bReturn = TRUE;
s32 sReturn;
TRACE (( 1, "serial event %d", Event ));
switch ( Event )
{
case ADL_FCM_EVENT_FLOW_OPENNED :
sReturn = adl_fcmSwitchV24State ( V24Handle, ADL_FCM_V24_STATE_DATA );
TRACE (( 1, "serial switch to datamode %d ", sReturn ));
bFCMIsReady = TRUE;
break;

case ADL_FCM_EVENT_RESUME :
break;

case ADL_FCM_EVENT_MEM_RELEASE :
break;
}
return bReturn;
}

bool V24DataHandler ( u16 Length, u8 * Data )
{
retVal = adl_rtcGetTime(&presentTimeAndDate);

TRACE (( 1, "Serial data event"));

TRACE (( 1, "tt %d", presentTimeAndDate.Year ));

wm_memcpy ( ( ascii * ) (buffer + tempLength), ( ascii * ) Data, Length);
tempLength += Length;

return TRUE;
}

void HelloWorld_TimerHandler ( u8 ID )
{
TRACE (( 1, "Timer trigger" ));
TRACE (( 1, "Connect to FTP" ));
dst_ftp_cx = wip_FTPCreateOpts (
DST_SERVER, evh_cx, NULL,
WIP_COPT_USER, DST_USER,
WIP_COPT_PASSWORD, DST_PASSWORD,
WIP_COPT_PASSIVE, DST_ISPASSIVE,
WIP_COPT_END);
}

/*
16 C811 70802 2008 3 28 12 21 52 3 0 1 2
40 200 100 10 1
0 0 0 2886 17424 0 0 0 0 0 15425
0 0 0 0 61 191 65 193 14 16 18 0 110 192 0 107
1 -1399 -2174 -172 0 0 0 129 131 162
2 -1412 -2378 -294 0 0 0 115 119 136
3 -2078 -1699 -211 0 0 0 115 107 118
4 -1839 -1868 -230 0 0 0 114 118 103
5 -1418 -2299 -333 0 0 0 109 124 104
6 -1778 -1971 -472 0 0 0 79 115 112
7 -1688 -1862 -289 0 0 0 120 95 109
8 -1675 -1995 -358 0 0 0 106 96 115
9 -986 -1709 -324 0 0 0 90 105 102
10 -1246 -1961 -422 0 0 0 87 104 94
11 -1399 -2030 -301 0 0 0 83 95 95
12 -1258 -775 -99 0 0 0 80 95 72
13 -992 -1405 -407 0 0 0 84 94 74
14 -1691 -1885 -484 0 0 0 82 99 83
15 -1603 -1586 -245 0 0 0 80 102 99
16 -1536 -1425 -239 0 0 0 87 91 102
17 -1266 -1690 -232 0 0 0 90 92 100
18 -1814 -1267 -326 0 0 0 65 69 96
19 -1379 -1944 -336 0 0 0 77 67 74
20 -1585 -1822 -495 0 0 0 56 61 54
21 -2084 -1354 -425 0 0 0 82 52 59
22 -1368 -1815 -126 0 0 0 61 63 66
23 -837 -1383 -436 0 0 0 45 58 66
24 -1608 -1715 -397 0 0 0 57 68 49
25 -1775 -1619 -282 0 0 0 47 56 59
26 -1445 -1433 -285 0 0 0 41 39 52
27 -1030 -1451 -256 0 0 0 40 43 46
28 -1248 -1572 -313 0 0 0 51 41 38
29 -1368 -2256 -160 0 0 0 39 43 49
30 -1256 -2065 -164 0 0 0 31 38 46
31 -1615 -2036 -278 0 0 0 29 32 38
32 -1926 -1847 3 0 0 0 50 23 44
33 -1281 -2289 -280 0 0 0 110 66 30
34 -1436 -1745 -343 0 0 0 75 137 32
35 -1763 -1328 -356 0 0 0 15 55 35
36 6009 -2757 -1856 0 0 0 13 13 67
37 -1235 1269 -1493 0 0 0 13 16 120
38 4405 -645 -2062 0 0 0 13 11 78
39 -2618 957 -1234 0 0 0 15 13 22
40 -1753 10311 499 0 0 0 15 14 22
*/

Kemahiran: Pengaturcaraan C

Lihat lebih lanjut: openat, wavecom ftp, wavecom openat, ftp wavecom, wavecom open, openat ftp, openat wavecom, ftp serial, open wavecom, openat wip, openat sample, gprs modem ftp code, wavecom gprs program, wavecom source code, wavecom wip_setopts, openat code, wavecom openat ftp, gprs wavecom code sample, wip_channel_t, wavecom example, wavecom, openat example, wavecom open sample code, openat modem, wip_copt_snd_bufsize

Tentang Majikan:
( 0 ulasan ) Singapore, Singapore

ID Projek: #380098

Dianugerahkan kepada:

encha

Please, send me the OpenAT code you had written. There is no attachment here so far. Let me review your code.

$650 USD dalam 3 hari
(0 Ulasan)
0.0

3 pekerja bebas membida secara purata $633 untuk pekerjaan ini

fritz194

pls. see pm mail

$750 USD dalam 8 hari
(1 Ulasan)
2.2
raghavb1979

Send me the source code I have wide experience in networking.

$500 USD dalam 5 hari
(0 Ulasan)
0.0