libsms_modem.h

00001 /*
00002 SMS Server Tools
00003 Copyright (C) 2000 Stefan Frings
00004 
00005 This program is free software unless you got it under another license directly
00006 from the author. You can redistribute it and/or modify it under the terms of 
00007 the GNU General Public License as published by the Free Software Foundation.
00008 Either version 2 of the License, or (at your option) any later version.
00009 
00010 http://www.isis.de/members/~s.frings
00011 mailto:s.frings@mail.isis.de
00012  */
00013 
00014 
00015 #ifndef _LIBSMS_MODEM_H
00016 #define _LIBSMS_MODEM_H
00017 
00018 #include <termios.h>
00019 #include "sms_funcs.h"
00020 
00021 
00022 #define MODE_OLD      1
00023 #define MODE_DIGICOM  2
00024 #define MODE_ASCII    3
00025 #define MODE_NEW      4
00026 
00027 #define READ_SLEEP   10000
00028 #define READ_TIMEOUT  10
00029 
00030 typedef int(*cds_report)( struct modem* , char* , int );
00031 
00032 
00033 /* put_command
00034    Sends a command to the modem and waits max timout*0.1 seconds for an answer.
00035    The function returns the length of the answer.
00036    The answer can be Ok, ERROR or expect.
00037    The command may be empty or NULL  */
00038 
00039 int put_command( struct modem *mdm, char* command, int clen, char* answer,
00040                                                                                         int max, int timeout,char* expect);
00041 
00042 int setmodemparams( struct modem *mdm);
00043 
00044 int checkmodem(struct modem *mdm);
00045 
00046 int initmodem(struct modem *mdm, cds_report cds_report_f);
00047 
00048 int setsmsc(struct modem *mdm, char *smsc);
00049 
00050 int openmodem(struct modem *mdm);
00051 
00052 int closemodem(struct modem *mdm);
00053 
00054 
00055 #endif