Hello
i want to create a new file, put some data in that file and after that upload that file onto a ftp server. The problem is i don’t really know how. When the modem will run independently were will that file be created? To upload the file to ftp i need to use wip_ftp client right? (i have succeded to activate gprs with adl)
the file that i need to create can i create it in normal C style something like?
FILE file;
file = fopen(“file.txt”,“a+”); / apend file (add text to
a file or create a file if it does not exist.*/
fprintf(file,"%s","This is just an example "); /writes/
fclose(file); /done!/
There are no files in OpenAT.
You create an FTP control channel with wip_FTPClientCreateOpts(), which you then use to create an FTP upload channel with wip_putFile(); whatever you wip_write() in the upload channel is sent to the server, and when you’re done you just close it with wip_close().
Read the doc, look at the samples for more details.
i tried ti do what you said but now i have this error when building (i use eclipse 3.1 ide)
this the code
/************************************************************************/
/ File : ftp.c /
/-------------------------------------------------------------------------/
/ Object : Manage the ftp connection /
/ /
/ Contents : /
/ /
/**************************************************************************/
#include “adl_global.h”
#include “ftp.h”
#include “wip.h”
wip_bearer_t gprsBearer;
wip_channel_t ftpChannel;
wip_channel_t dataChannel;
static void dataHandler(wip_event_t *event,void *context){
switch (event->kind) {
case WIP_CEV_WRITE:{
wip_write(dataChannel,“this is a test”,14);
}
break;
case WIP_CEV_DONE:{
wip_close(event->channel);
}
break;
default:
break;
}
}
static void ftpHandler(wip_event_t *event,void *context){
if (event->kind==WIP_CEV_OPEN){
// ftp connection just established
dataChannel=wip_putFile(ftpChannel,“test.txt”,dataHandler,NULL);
}
else {
TRACE ((1,“some other ftp event”));
}
}
void gprsBearerHandler(wip_bearer_t br,s8 event,void *context){
switch (event) {
case WIP_BEV_IP_CONNECTED:{
ftpChannel=wip_FTPCreate(“195.225.65.69”,ftpHandler,NULL);
}
break;
case WIP_BEV_IP_DISCONNECTED:{
}
break;
default:{
TRACE ((1,“Some problems with the bearer”));
}
break;
}
}
bool createBearer( ascii *serverApn, ascii *userApn,ascii *passApn ){
if (wip_bearerOpen(&gprsBearer,“GPRS”,gprsBearerHandler,NULL)!=0 ){
// cannot open the bearer
return FALSE;
}
//configure the gprs connection
if (wip_bearerSetOpts(&gprsBearer,WIP_BOPT_GPRS_APN,serverApn,WIP_BOPT_LOGIN,userApn,WIP_BOPT_PASSWORD,passApn,WIP_BOPT_END)!=0){
//cannot configure the bearer
wip_bearerClose(&gprsBearer);
return FALSE;
}
// start connection
if (wip_bearerStart(&gprsBearer)!=0){
//cannot start the bearer
wip_bearerClose(&gprsBearer);
return FALSE;
}
return TRUE;
}
and i get this error
make: *** [make_single_bin] Error 1
rte_wmwip_3.0.0.2.0.lib(./rte/vc6/Release/st_rand.obj)(.text+0x25):U:\projet\gsmmi\in: undefined reference to _allmul' rte_wmwip_3.0.0.2.0.lib(./rte/vc6/Release/st_rand.obj)(.text+0x33):U:\projet\gsmmi\in: undefined reference to
_aullrem’
Done.
Updating RTE kernel file…
no generated DLL found…
[wmmake error #1] Build error.
what is wrong?
-
you’re compiling in release mode, so you won’t be able to debug. select the debug target
-
anyway, your problem is a link issue. You miss a lib, or something like that. Rebuild the project from scratch with the wizzard and retry
-
your code is wrong: why are you trying to catch a WIP_CEV_DONE on the data channel? such events only happen on the session channel, and in this case they don’t interest you. you can write then close immediately: if some delay is needed internally to send the data, the stack will do that for you transparently.
case WIP_CEV_WRITE:{
wip_write( ev->channel,"this is a test",14);
wip_close(ev->channel);
}
break;
I am using buid (RTE) and isn’t this the one i should use
i made a new project and still have this error
make: *** [make_single_bin] Error 1
rte_wmwip_3.0.0.2.0.lib(./rte/vc6/Release/st_rand.obj)(.text+0x25):U:\projet\gsmmi\in: undefined reference to _allmul' rte_wmwip_3.0.0.2.0.lib(./rte/vc6/Release/st_rand.obj)(.text+0x33):U:\projet\gsmmi\in: undefined reference to
_aullrem’
Done.
Updating RTE kernel file…
no generated DLL found…
[wmmake error #1] Build error.
if i comment everything in the file the project compiles but this isn’t a solution
you are saying i am compiling in release mode but since i am using build RTE i would say this is not the issue right?
release/debug: that’s a setting within VC6, some combo box in the toolbars most probably. Anyway that’s not the cause of your problem.
Google seem to imply that _aulrem and _allmul are internal functions for arithmetics, maybe you’re using floats somewhere? I don’t know what causes that dependency, so the best you can do is comment the whole code, then uncomment/recomment progressively until you find the line(s) which cause this dependency.
well from what i saw this is a wip lib problem There is a topic on the forum with this
http://www.wavecom.com/modules/movie/scenes/forums/viewtopic.php?t=1209
and there is a solution (not a really good one)
This problem is inly with eclipse? and visual C doesn’t have this problem?
Is there a solution for this in eclipse?