/********************************************************************************************/
/* Appli.c - Copyright Wavecom S.A. (c) 2002 */
/* */
/* */
/* DISCLAIMER OF WARRANTY */
/* ====================== */
/* This Software is provided free of charge on an 'as is' basis. No warranty is given */
/* by Wavecom S.A. in relation to the Software of the uses to which it may be put by you, */
/* the user, or its merchantability, fitness or suitability for any particular purpose */
/* or conditions; and/or that the use of the Software and all documentation relating */
/* thereto by the Licensee will not infringe any third party copyright or other */
/* intellectual property rights. Wavecom S.A. shall furthermore be under no obligation */
/* to provide support of any nature for the Software and the Documentation. */
/* */
/* LIMIT OF LIABILITY */
/* ================== */
/* In no event shall Wavecom S.A. be liable for any loss or damages whatsoever or howsoever */
/* caused arising directly or indirectly in connection with this licence, the Software, */
/* its use or otherwise except to the extent that such liability may not be lawfully */
/* excluded. Notwithstanding the generality of the foregoing, Wavecom S.A. expressly */
/* excludes liability for indirect, special, incidental or consequential loss or damage */
/* which may arise in respect of the Software or its use, or in respect of other equipment */
/* or property, or for loss of profit, business, revenue, goodwill or anticipated savings. */
/* */
/********************************************************************************************/
/***************************************************************************/
/* File : Appli.c */
/*-------------------------------------------------------------------------*/
/* Object : Customer application */
/* */
/* contents : Customer main procedures */
/* */
/* Change : */
/***************************************************************************/
/*
$LogWavecom: G:\projet\mmi\pvcsarch\archives\open-mmi\SAMPLES\adl\New_Project\src\appli.c-arc $
* --------------------------------------------------------------------------
* Date | Author | Revision | Description
* ----------+--------+----------------+-------------------------------------
* 16.12.02 | dpo | 1.0 | Initial revision.
* ----------+--------+----------------+-------------------------------------
*/
#include "adl_global.h"
#include "wip_bearer.h"
#include "wip_net.h"
#include "wip_smtp.h"
#include "wip.h"
/***************************************************************************/
/* Mandatory variables */
/*-------------------------------------------------------------------------*/
/* wm_apmCustomStack */
/* wm_apmCustomStackSize */
/*-------------------------------------------------------------------------*/
/***************************************************************************/
u32 wm_apmCustomStack [ 256 ];
const u16 wm_apmCustomStackSize = sizeof ( wm_apmCustomStack );
/***************************************************************************/
/* Local variables */
/***************************************************************************/
s8 netResult;
wip_bearer_t test123;
wip_in_addr_t ipaddress;
s8 smtpHandle;
wip_channel_t CHANNEL, CHANNEL1;
u8 set=0;
const ascii * SMTP_STR_SENDERNAME = "Guru";
const ascii * SMTP_STR_SENDER = "vguruindia@yahoo.com";
const ascii * SMTP_STR_REC = "s.nayak@hotmail.com";
const ascii * SMTP_STR_CCREC = "alan_joseph@infosys.com";
const ascii * SMTP_STR_BCCREC = "";
const ascii * SMTP_STR_SUBJ = "WIP sender mail test SMTP";
void putFileHandler(wip_event_t *ev, void *ctx);
/***************************************************************************/
/* Local functions */
/***************************************************************************/
s8 bytes_written;
void closeChannel(u8 ID)
{
wip_close (CHANNEL1);
}
void closeDataChannel(u8 i,s8 bytes_written)
{
s8 totalNumberBytes=11,countbytes;
if(i ==1)
{
countbytes=0;
countbytes += bytes_written;
}
countbytes += bytes_written;
if(countbytes==totalNumberBytes)
{
adl_tmrSubscribe(FALSE, 10, ADL_TMR_TYPE_100MS, (adl_tmrHandler_t) closeChannel);
}
}
static s32 smtp_ClientTestPutFile(void)
{
CHANNEL1 = wip_putFileOpts(CHANNEL, // Session channel
NULL, // string
&putFileHandler, // handler fct
NULL, // ctx
// Optional parameters (which are MANDATORY at creation )
// -------------------
WIP_COPT_SENDERNAME, SMTP_STR_SENDERNAME,
WIP_COPT_SENDER, SMTP_STR_SENDER,
WIP_COPT_REC, SMTP_STR_REC,
WIP_COPT_CC_REC, SMTP_STR_CCREC,
WIP_COPT_BCC_REC, SMTP_STR_BCCREC,
WIP_COPT_SUBJ, SMTP_STR_SUBJ,
// This option indicates if wip smtp should generate
// the mail header or if appli is in charge of it
// (for mail attachment for example)
WIP_COPT_NO_HEADER,
WIP_COPT_END);
if (CHANNEL1 == NULL)
{
adl_atSendResponse(ADL_AT_UNS,"\r\n !!!!!!!!!putfile connection failure !!!!!!!! ");
}
else
{
adl_atSendResponse(ADL_AT_UNS,"\r\n putfile connection established ");
}
return 1;
}
void putFileHandler(wip_event_t *ev, void *ctx)
{
u8 i=1;
adl_atSendResponse(ADL_AT_RSP,"\r\n putfile HANDLER \r\n");
switch(ev->kind)
{
case WIP_CEV_OPEN:
adl_atSendResponse (ADL_AT_RSP,"\r\nWIP CEV put file OPEN\r\n");
break;
case WIP_CEV_WRITE:
adl_atSendResponse (ADL_AT_RSP,"\r\nWIP CEV write\r\n");
bytes_written = wip_write(CHANNEL1,"Hello World",11);
closeDataChannel(i,bytes_written);
i++;
break;
case WIP_CEV_ERROR:
adl_atSendResponse(ADL_AT_UNS,"\r\n error in put file handler \r\n");
break;
}
}
void smtpHandler(wip_event_t *ev, void *ctx)
{
adl_atSendResponse(ADL_AT_UNS,"\r\n SMTP HANDLER \r\n");
switch(ev->kind)
{
case WIP_CEV_OPEN:
adl_atSendResponse (ADL_AT_RSP,"\r\nWIP CEV OPEN\r\n");
smtp