Hardware Reference
In-Depth Information
Table 17-1:
getVoiceCallStatus() Return Codes
CONSTANT
DESCRIPTION
IDLE_CALL
The modem is idling: no incoming calls, no outgoing calls, and no
call in progress.
CALLING
The modem is currently calling a number.
RECEIVINGCALL
The modem is receiving an incoming call.
TALKING
A call has been placed (incoming or outgoing) and communication
is established.
The other end of a telephone call can hang up whenever it chooses (or even
when network conditions no longer allow a call to continue), and the Arduino
can also instruct the GSM device to hang up with
hangCall()
:
result =
vcs
.hangCall();
This function takes no parameters and returns an
int
: 1 if the operation suc-
ceeded and 0 otherwise. This function not only hangs up a connected call, but
can also hang up on an incoming call.
Arduinos can also receive calls, but the GSM modem does not warn the sketch
of incoming calls; the sketch must poll the GSM device with
getVoiceCall-
Status()
when there's an incoming call expected. When an incoming call is
detected (when
getVoiceCallStatus()
returns
RECEIVINGCALL
), you can retrieve
the calling number and decide to accept/refuse the call. To get the incoming
telephone number, use
retrieveCallingNumber()
:
result =
vcs
.retrieveCallingNumber(number, size);
The
number
parameter is a
char
array and can store the incoming number.
The
size
parameter is the size of the array. This function returns
1
if the phone
number is retrieved, and
0
if it is unable to retrieve the phone number.
To pick up an incoming call, use
answerCall()
:
result =
vcs
.answerCall();
This function does not take any parameters and returns
1
if the call is answered,
or
0
if it is unable to answer. Incoming calls can also be refused with
hangCall()
.
GPRS
GPRS is the method used to send and receive data using a GSM mobile device. It does
not require an active voice call but does require authentication. When the SIM card
has been told to create a connection, it maintains the connection and automatically
reconnects if needed. Before using a GPRS connection, you must use the GPRS class:
GPRS gprs;
Search WWH ::
Custom Search