@WSAR1-V1@<@COMMENT@USE COM4 to send email@DPS@š 2)b[º™:ÐãUsÄù_~ªÕ}QùÜ:Ðù-¦ŠKUôÙdmºPy­& ËÂuCäßbUͽpÙ!ªërQóÛe@ͽpÙ!ªë|YòÓM=šðY ¡†*küÙr^ÿÄumºPy­& ËÜyRàÑbQýí:Ðù-¦ŠK\ùÒs_ýÀy\õí:Ðõ^tÃõSdÙÿ^=š@NOTE@s email Use COM4 of I-8417/8817/8437/8837 controllers to send an email. Shoud link COM4 to a modem *** Target : I-8417/8817/8437/8837 *** *********************************** Note: email is only supported with driver version "email_2.15" *********************************** Example: Please refer to Demo_31 & Demo_32 call: ACT_ : if rising from false to true, start to send an email, and the return value - STEP_ will be changed. If no sending request occurs, the return value STEP_ set to 0 (0 means sleep) TIMEOUT_ : unit : seconds. The max time allowed to send an email after linking to mail server. Value should be between 50 ~ 120 (sec). PHONE_ : ISP's phone No. For ex. '4123000' or '0,4123000' the ',' char. will delay 1 sec and then dial the rest No. USER_ : Registerd user name from ISP. ex. 'Chun' PASSWD_ : Password of USER_ ex. 'abcd127' SERVER1_ : Mail server 1. ex. 'ms9.hinet.net' SERVER2_ : Mail server 2. ex. 'mail.icpdas.com' . If only one mail server can be used , please set SERVER2 as same as SERVER1 FROM_ : email address of sender. ex. 'wilson@icpdas.com' TO_ : email address of receiver. ex. 'chun@icpdas.com' SUBJECT_ : subject of email. ex. 'Hi !' DATA_ : email message. ex. 'Dear Chun, Hello !' return: STEP_ : 0 : sleep 21 : mail successfully ! less than 0 , error happens -1 : Com4 not ready -2 : modem not ready -3 : ISP doesn't pick up the phone -4 : ISP request to terminate -5 : Timeout happen -6 : Mail server refuse to send mail -7 : Can not link to mail server 1 & 2 -8 : Can't get IP address of mail server 1 & 2 others : reserved Note: 1. After an email is successfully sent, if no more sending request occurs in 8 seconds, the controller will disconnect the connection from the connected ISP and then hang off the phone . 2. If sending request occurs in 8 second After an email is successfully sent, and then again, the max number of emails can be sent in one phone connection is 10. The other more emails should be sent in another phone connection. 3. If dial fail, for ex. the target phone No. is busy. The controller will dial again 1 minute later. The max re-dial number is 3 for each sending request. ICP DAS , Taiwan Dec.17,2002 @PARAM@„#BSTEP_ @SRC@ /* function block name: email */ #include #include typedef struct { } str_data; uint16 FBINIT_email (uint16 hinstance) { return (sizeof (str_data)); } void FBACT_email (uint16 hinstance, str_data *data, str_arg *arg) { } #define BOO_VALUE ((T_BOO *)value) #define ANA_VALUE ((T_ANA *)value) #define REAL_VALUE ((T_REAL *)value) #define TMR_VALUE ((T_TMR *)value) #define MSG_VALUE ((T_MSG *)value) void FBREAD_email (uint16 hinstance, str_data *data, uint16 parno, void *value) { } ABP fbldef_email (char *name, IBP *initproc, RBP *readproc) { sys_strcpy (name, "EMAIL"); *initproc = (IBP)FBINIT_email; *readproc = (RBP)FBREAD_email; return ((ABP)FBACT_email); } @DEFS@/* function block interface name: email */ typedef long T_BOO; typedef long T_ANA; typedef float T_REAL; typedef long T_TMR; typedef char *T_MSG; typedef struct { /* CALL */ T_BOO _act_; /* CALL */ T_ANA _timeout_; /* CALL */ T_MSG _phone_; /* CALL */ T_MSG _user_; /* CALL */ T_MSG _passwd_; /* CALL */ T_MSG _server1_; /* CALL */ T_MSG _server2_; /* CALL */ T_MSG _from_; /* CALL */ T_MSG _to_; /* CALL */ T_MSG _subject_; /* CALL */ T_MSG _data_; } str_arg; #define ACT_ (arg->_act_) #define TIMEOUT_ (arg->_timeout_) #define PHONE_ (arg->_phone_) #define USER_ (arg->_user_) #define PASSWD_ (arg->_passwd_) #define SERVER1_ (arg->_server1_) #define SERVER2_ (arg->_server2_) #define FROM_ (arg->_from_) #define TO_ (arg->_to_) #define SUBJECT_ (arg->_subject_) #define DATA_ (arg->_data_) #define FBLPNO_STEP_ 0 @END@