Open Sint  3.4-2
Macros | Functions
cell.h File Reference

cellular phone functions More...

#include "uart.h"
Include dependency graph for cell.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define PHONE_PORT   PORTB
 which port has the power ON switch.
 
#define PHONE_ON   PB0
 which pin is the power ON.
 
#define MODEM_USART_PORT   0
 on which USART port is the modem connected.
 

Functions

void phone_send (const char *s)
 the cellular phone. More...
 
void phone_init (void)
 initialize the serial port connected to the phone. More...
 
uint8_t phone_on (void)
 power up the phone. More...
 
uint8_t phone_msg (char *s)
 check for a message from the phone. More...
 
void phone_answer (void)
 answer the call
 
void phone_hangup (void)
 drop the call
 
uint8_t phone_waitfor (const char *s, const uint8_t locked)
 Wait for string from the modem. More...
 

Detailed Description

cellular phone functions

Command sent to the modem MUST be terminated with '' char and not '
'.

Function Documentation

◆ phone_init()

void phone_init ( void  )

initialize the serial port connected to the phone.

and allocate the RXTX struct buffer.

◆ phone_msg()

uint8_t phone_msg ( char *  s)

check for a message from the phone.

Parameters
spre-allocated string space.
Returns
1 - ok message is presente, 0 - no message.

◆ phone_on()

uint8_t phone_on ( void  )

power up the phone.

Note
turning on the modem will take from 11sec to 16 seconds
Returns
FALSE if the phone is not detected, or number of init sentences catched.
Bug:
modem answers during power on should be exactly what we expect, not if I got at least once it's ok.
Bug:
void the eventually chars left in queue.
Todo:
the init strings should be defined somewhere.

◆ phone_send()

void phone_send ( const char *  s)

the cellular phone.

if a fixed cellular operator must be used then uncomment below and change the operator's code example with I_WIND code: 22288 "at+cops=1,2,22288\r"

file cell.c

send the string to the phone.

Bug:
should be implemeted with PGM_P string to spare some memory.

◆ phone_waitfor()

uint8_t phone_waitfor ( const char *  s,
const uint8_t  locked 
)

Wait for string from the modem.

Used to wait a specific string from the modem in a locked or tmout way. For example used after sending an AT command to the modem and wait for the OK string. In a non-locked case, the waitfor will be 50*100msec long.

Parameters
sthe string to wait for.
lockedif locked, wait forever.
Returns
true - ok, false - error
Bug:

the string s should be checked not to be larger than the allocated RX buffer size or this function will always fail.

delay 100msec to wait for a new message should be releated to the serial speed.

Bug:
non-multiport ready. works only to port 0.