Android-cuttlefish cvd tool
Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
cuttlefish::CallService Class Reference

#include <call_service.h>

Inheritance diagram for cuttlefish::CallService:
Inheritance graph
[legend]
Collaboration diagram for cuttlefish::CallService:
Collaboration graph
[legend]

Classes

struct  CallStatus
 

Public Member Functions

 CallService (int32_t service_id, ChannelMonitor *channel_monitor, ThreadLooper *thread_looper)
 
 ~CallService ()=default
 
 CallService (const CallService &)=delete
 
CallServiceoperator= (const CallService &)=delete
 
void SetupDependency (SimService *sim, NetworkService *net)
 
void HandleDial (const Client &client, const std::string &command)
 
void HandleAcceptCall (const Client &client)
 
void HandleRejectCall (const Client &client)
 
void HandleCurrentCalls (const Client &client)
 
void HandleHangup (const Client &client, const std::string &command)
 
void HandleMute (const Client &client, const std::string &command)
 
void HandleSendDtmf (const Client &client, const std::string &command)
 
void HandleCancelUssd (const Client &client, const std::string &command)
 
void HandleEmergencyMode (const Client &client, const std::string &command)
 
void HandleRemoteCall (const Client &client, const std::string &command)
 
int FindFreeCallIndex () const
 
- Public Member Functions inherited from cuttlefish::ModemService
virtual ~ModemService ()=default
 
 ModemService (const ModemService &)=delete
 
ModemServiceoperator= (const ModemService &)=delete
 
bool HandleModemCommand (const Client &client, std::string command)
 
void CloseRemoteConnection (ClientId remote_client)
 

Private Types

using CallToken = std::pair< int, std::string >
 

Private Member Functions

void InitializeServiceState ()
 
std::vector< CommandHandlerInitializeCommandHandlers ()
 
void SimulatePendingCallsAnswered ()
 
void CallStateUpdate ()
 
void SendCallStatusToRemote (CallStatus &call, CallStatus::CallState state)
 
void TimerWaitingRemoteCallResponse (CallToken token)
 

Private Attributes

SimServicesim_service_
 
NetworkServicenetwork_service_
 
std::map< int, CallStatusactive_calls_
 
bool in_emergency_mode_
 
bool mute_on_
 

Additional Inherited Members

- Static Public Attributes inherited from cuttlefish::ModemService
static constexpr char kCmeErrorOperationNotAllowed [] = "+CME ERROR: 3"
 
static constexpr char kCmeErrorOperationNotSupported [] = "+CME ERROR: 4"
 
static constexpr char kCmeErrorSimNotInserted [] = "+CME ERROR: 10"
 
static constexpr char kCmeErrorSimPinRequired [] = "+CME ERROR: 11"
 
static constexpr char kCmeErrorSimPukRequired [] = "+CME ERROR: 12"
 
static constexpr char kCmeErrorSimBusy [] = "+CME ERROR: 14"
 
static constexpr char kCmeErrorIncorrectPassword [] = "+CME ERROR: 16"
 
static constexpr char kCmeErrorMemoryFull [] = "+CME ERROR: 20"
 
static constexpr char kCmeErrorInvalidIndex [] = "+CME ERROR: 21"
 
static constexpr char kCmeErrorNotFound [] = "+CME ERROR: 22"
 
static constexpr char kCmeErrorInvalidCharactersInTextString []
 
static constexpr char kCmeErrorNoNetworkService [] = "+CME ERROR: 30"
 
static constexpr char kCmeErrorNetworkNotAllowedEmergencyCallsOnly []
 
static constexpr char kCmeErrorInCorrectParameters [] = "+CME ERROR: 50"
 
static constexpr char kCmeErrorNetworkNotAttachedDueToMTFunctionalRestrictions []
 
static constexpr char kCmeErrorFixedDialNumberOnlyAllowed []
 
static constexpr char kCmsErrorOperationNotAllowed [] = "+CMS ERROR: 302"
 
static constexpr char kCmsErrorOperationNotSupported [] = "+CMS ERROR: 303"
 
static constexpr char kCmsErrorInvalidPDUModeParam [] = "+CMS ERROR: 304"
 
static constexpr char kCmsErrorSCAddressUnknown [] = "+CMS ERROR: 304"
 
static constexpr std::pair< int, int > kRemotePortRange {6520, 6527}
 
- Protected Member Functions inherited from cuttlefish::ModemService
 ModemService (int32_t service_id, std::vector< CommandHandler > command_handlers, ChannelMonitor *channel_monitor, ThreadLooper *thread_looper)
 
void HandleCommandDefaultSupported (const Client &client)
 
void SendUnsolicitedCommand (std::string unsol_command)
 
cuttlefish::SharedFD ConnectToRemoteCvd (std::string port)
 
void SendCommandToRemote (ClientId remote_client, std::string response)
 
- Static Protected Member Functions inherited from cuttlefish::ModemService
static std::string GetHostId ()
 
- Protected Attributes inherited from cuttlefish::ModemService
int32_t service_id_
 
const std::vector< CommandHandlercommand_handlers_
 
ThreadLooperthread_looper_
 
ChannelMonitorchannel_monitor_
 

Member Typedef Documentation

◆ CallToken

using cuttlefish::CallService::CallToken = std::pair<int, std::string>
private

Constructor & Destructor Documentation

◆ CallService() [1/2]

cuttlefish::CallService::CallService ( int32_t  service_id,
ChannelMonitor channel_monitor,
ThreadLooper thread_looper 
)

◆ ~CallService()

cuttlefish::CallService::~CallService ( )
default

◆ CallService() [2/2]

cuttlefish::CallService::CallService ( const CallService )
delete

Member Function Documentation

◆ CallStateUpdate()

void cuttlefish::CallService::CallStateUpdate ( )
private

◆ FindFreeCallIndex()

int cuttlefish::CallService::FindFreeCallIndex ( ) const
inline

◆ HandleAcceptCall()

void cuttlefish::CallService::HandleAcceptCall ( const Client client)

◆ HandleCancelUssd()

void cuttlefish::CallService::HandleCancelUssd ( const Client client,
const std::string &  command 
)

◆ HandleCurrentCalls()

void cuttlefish::CallService::HandleCurrentCalls ( const Client client)

AT+CLCC Returns list of current calls of MT. If command succeeds but no calls are available, no information response is sent to TE.

command Possible response(s) AT+CLCC [+CLCC: <ccid1>,<dir>,<stat>,<mode>,<mpty> [,<number>,<type>[,<alpha>[,<priority> [,<CLI validity>]]]][<CR><LF> +CLCC: <ccid2>,<dir>,<stat>,<mode>,<mpty> [,<number>,<type>[,<alpha>[,<priority>[,<CLI validity>]]]] +CME ERROR: <err>

<ccidx>: integer type. This number can be used in +CHLD command operations. Value range is from 1 to N. N, the maximum number of simultaneous call control processes is implementation specific. <dir>: integer type 0 mobile originated (MO) call 1 mobile terminated (MT) call <stat>: integer type (state of the call) 0 active 1 held 2 dialing (MO call) 3 alerting (MO call) 4 incoming (MT call) 5 waiting (MT call) <mode>: integer type (bearer/teleservice) 0 voice 1 data 2 fax 3 voice followed by data, voice mode 4 alternating voice/data, voice mode 5 alternating voice/fax, voice mode 6 voice followed by data, data mode 7 alternating voice/data, data mode 8 alternating voice/fax, fax mode 9 unknown <mpty>: integer type 0 call is not one of multiparty (conference) call parties 1 call is one of multiparty (conference) call parties <number>: string type phone number in format specified by <type>. <type>: type of address octet in integer format

see RIL_REQUEST_GET_CURRENT_CALLS in RIL

◆ HandleDial()

void cuttlefish::CallService::HandleDial ( const Client client,
const std::string &  command 
)

Normal dial: ATDnumber[clir]; Emergency dial: ATDnumber@[category],#[clir];

◆ HandleEmergencyMode()

void cuttlefish::CallService::HandleEmergencyMode ( const Client client,
const std::string &  command 
)

AT+WSOS

Command Possible response(s) +WSOS=[<n>] +CME ERROR: <err> +WSOS? +WSOS: <n> +CME ERROR: <err>

<n>: integer type 0 enter emergency mode 1 exit emergency mode

see RIL_REQUEST_EXIT_EMERGENCY_CALLBACK_MODE RIL_UNSOL_ENTER_EMERGENCY_CALLBACK_MODE RIL_UNSOL_EXIT_EMERGENCY_CALLBACK_MODE in RIL

◆ HandleHangup()

void cuttlefish::CallService::HandleHangup ( const Client client,
const std::string &  command 
)

AT+CHLD This command allows the control of the following call related services: 1) a call can be temporarily disconnected from the MT but the connection is retained by the network; 2) multiparty conversation (conference calls); 3) the served subscriber who has two calls (one held and the other either active or alerting) can connect the other parties and release the served subscriber's own connection.

Calls can be put on hold, recovered, released, added to conversation, and transferred similarly.

command Possible response(s) +CHLD=<n> +CME ERROR: <err>

+CHLD=? +CHLD: (list of supported <n>s) e.g. +CHLD: (0,1,1x,2,2x,3,4)

see RIL_REQUEST_HANGUP_WAITING_OR_BACKGROUND RIL_REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND RIL_REQUEST_SWITCH_WAITING_OR_HOLDING_AND_ACTIVE RIL_REQUEST_CONFERENCE RIL_REQUEST_SEPARATE_CONNECTION RIL_REQUEST_HANGUP RIL_REQUEST_UDUB in RIL

◆ HandleMute()

void cuttlefish::CallService::HandleMute ( const Client client,
const std::string &  command 
)

AT+CMUT This command is used to enable and disable the uplink voice muting during a voice call. Read command returns the current value of <n>.

Command Possible response(s) +CMUT=[<n>] +CME ERROR: <err> +CMUT? +CMUT: <n> +CME ERROR: <err>

<n>: integer type 0 mute off 1 mute on

see RIL_REQUEST_SET_MUTE or RIL_REQUEST_GET_MUTE in RIL

◆ HandleRejectCall()

void cuttlefish::CallService::HandleRejectCall ( const Client client)

◆ HandleRemoteCall()

void cuttlefish::CallService::HandleRemoteCall ( const Client client,
const std::string &  command 
)

AT+REMOTECALL=<dir>,<stat>,<mode>,<mpty>,<number>,<num_type> This command allows to dial a remote voice call with another cuttlefish emulator. If request is successful, the remote emulator can simulate hold on, hang up, reject and so on.

e.g. AT+REMOTECALL=4,0,0,6521,129

<stat>: integer type (state of the call) 0 active 1 held 2 dialing (MO call) 3 alerting (MO call) 4 incoming (MT call) 5 waiting (MT call) <mode>: integer type 0 voice 1 data 2 fax 3 voice followed by data, voice mode 4 alternating voice/data, voice mode 5 alternating voice/fax, voice mode 6 voice followed by data, data mode 7 alternating voice/data, data mode 8 alternating voice/fax, fax mode 9 unknown <mpty>: integer type 0 call is not one of multiparty (conference) call parties 1 call is one of multiparty (conference) call parties <number>: string here maybe remote port <num_type>: type of address octet in integer format

Note: reason should be added to indicate why hang up. Since not realizing RIL_LAST_CALL_FAIL_CAUSE, delay to be implemented.

◆ HandleSendDtmf()

void cuttlefish::CallService::HandleSendDtmf ( const Client client,
const std::string &  command 
)

AT+VTS This command transmits DTMF, after a successful call connection. Setting Command is used to send one or more ASCII characters which make MSC (Mobile Switching Center) send DTMF tone to remote User.

Command Possible response(s) AT+VTS=<dtmf>[,<duration>] +CME ERROR: <err>

<dtmf> A single ASCII character in the set { 0 -9, #, *, A – D}. <duration> Refer to duration value range of +VTD command

see RIL_REQUEST_DTMF in RIL

◆ InitializeCommandHandlers()

std::vector< CommandHandler > cuttlefish::CallService::InitializeCommandHandlers ( )
private

◆ InitializeServiceState()

void cuttlefish::CallService::InitializeServiceState ( )
private

◆ operator=()

CallService & cuttlefish::CallService::operator= ( const CallService )
delete

◆ SendCallStatusToRemote()

void cuttlefish::CallService::SendCallStatusToRemote ( CallStatus call,
CallStatus::CallState  state 
)
private

◆ SetupDependency()

void cuttlefish::CallService::SetupDependency ( SimService sim,
NetworkService net 
)

◆ SimulatePendingCallsAnswered()

void cuttlefish::CallService::SimulatePendingCallsAnswered ( )
private

◆ TimerWaitingRemoteCallResponse()

void cuttlefish::CallService::TimerWaitingRemoteCallResponse ( CallToken  token)
private

Member Data Documentation

◆ active_calls_

std::map<int, CallStatus> cuttlefish::CallService::active_calls_
private

◆ in_emergency_mode_

bool cuttlefish::CallService::in_emergency_mode_
private

◆ mute_on_

bool cuttlefish::CallService::mute_on_
private

◆ network_service_

NetworkService* cuttlefish::CallService::network_service_
private

◆ sim_service_

SimService* cuttlefish::CallService::sim_service_
private

The documentation for this class was generated from the following files: