gsmHandsfree (Function)

Top  Previous  Next

Architecture:

NX32

Device support:

MX2 turbo

Firmware version:

4.00


This function can enable the hands-free interface on the device, routing all audio in- and output from the GSM modem through the audio jack to a connected speaker and microphone.

Voice and DTMF functionality will be disabled when this function is used.

 

If gsmHeadset is already enabled or the GSM modem is not powered on, the hands-free interface can not be enabled.

 

Input:                

enable : BOOL

TRUE:

The hands-free interface will be enabled. RTCU voice and DTMF capability is disabled.

FALSE:

The hands-free interface will be disabled. RTCU voice and DTMF capability is reactivated.

 

Returns: INT

0

- Operation  was successful.

1

- Audio interface already opened by gsmHeadset.

2

- GSM module not powered on.

3

- General error.

5

- Not supported on this device.

 

Declaration:

FUNCTION gsmHandsfree : INT;
VAR_INPUT
  enable : BOOL;
END_VAR;

 

 

Example:

INCLUDE rtcu.inc
 
PROGRAM test;
 
// Turn on power to the GSM module
gsmPower(power := TRUE);
 
BEGIN
  ...
  // Make a call
  IF gsmMakeCall(phonenumber := "+44 22 33 44 55") THEN
     // Successful, we have established a connection
     // Set volume to 50 % for speaker and microphone
    gsmHandsfreeVolume( spk := 50, mic := 50);
    // Enable headset for 10 seconds
    gsmHandsfree(enable:=TRUE);
    Sleep(delay:=10000);
    // Disable headset
    gsmHandsfree(enable:=FALSE);
    // Hangup the phone
    gsmHangup();
     ...
  END_IF;
END;
 
END_PROGRAM;