gsmHandsfreeVolume (Function)

Top  Previous  Next

Architecture:

NX32

Device support:

MX2 turbo

Firmware version:

4.00


Controls the volume levels used for the handsfree interface. Can be set both before and after opening the hands-free interface with gsmHandsfree.

The volume levels does not necessarily correspond directly to a volume level in the device, but will be mapped to the closest supported level.

 

Input:                

spk: SINT (-1..100) Default -1

Speaker volume. Set to -1 to leave it as it is, 0 to mute.

mic: SINT (-1..100) Default -1

Microphone volume. Set to -1 to leave it as it is, 0 to mute.

 

Returns: INT

0

- Operation  was successful.

1

- Invalid volume

3

- General error

5

- Not supported on this device.

 

Declaration:

FUNCTION gsmHandsfreeVolume : INT;
VAR_INPUT
  spk : SINT := -1;
  mic : SINT := -1;
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;