// Copyright 2010 Google Inc. All Rights Reserved.
// Author: wink@google.com (Wink Saville)

package ril_proto;

option java_package='com.android.internal.telephony.ril_proto';
option java_outer_classname='RilCmds';

enum RadioState {
    RADIOSTATE_OFF                      = 0; /* Radio explictly powered off (eg CFUN=0) */
    RADIOSTATE_UNAVAILABLE              = 1; /* Radio unavailable (eg, resetting or not booted) */
    RADIOSTATE_SIM_NOT_READY            = 2; /* Radio is on, but the SIM interface is not ready */
    RADIOSTATE_SIM_LOCKED_OR_ABSENT     = 3; /* SIM PIN locked, PUK required, network
                                                personalization locked, or SIM absent */
    RADIOSTATE_SIM_READY                = 4; /* Radio is on and SIM interface is available */
    RADIOSTATE_RUIM_NOT_READY           = 5; /* Radio is on, but the RUIM interface is not ready */
    RADIOSTATE_RUIM_READY               = 6; /* Radio is on and the RUIM interface is available */
    RADIOSTATE_RUIM_LOCKED_OR_ABSENT    = 7; /* RUIM PIN locked, PUK required, network
                                                personalization locked, or RUIM absent */
    RADIOSTATE_NV_NOT_READY             = 8; /* Radio is on, but the NV interface is not available */
    RADIOSTATE_NV_READY                 = 9; /* Radio is on and the NV interface is available */
}

enum RilCardState {
    CARDSTATE_ABSENT   = 0;
    CARDSTATE_PRESENT  = 1;
    CARDSTATE_ERROR    = 2;
}

enum RilPersoSubstate {
    PERSOSUBSTATE_UNKNOWN                   = 0; /* initial state */
    PERSOSUBSTATE_IN_PROGRESS               = 1; /* in between each lock transition */
    PERSOSUBSTATE_READY                     = 2; /* when either SIM or RUIM Perso is finished
                                                    since each app can only have 1 active perso
                                                    involved */
    PERSOSUBSTATE_SIM_NETWORK               = 3;
    PERSOSUBSTATE_SIM_NETWORK_SUBSET        = 4;
    PERSOSUBSTATE_SIM_CORPORATE             = 5;
    PERSOSUBSTATE_SIM_SERVICE_PROVIDER      = 6;
    PERSOSUBSTATE_SIM_SIM                   = 7;
    PERSOSUBSTATE_SIM_NETWORK_PUK           = 8; /* The corresponding perso lock is blocked */
    PERSOSUBSTATE_SIM_NETWORK_SUBSET_PUK    = 9;
    PERSOSUBSTATE_SIM_CORPORATE_PUK         = 10;
    PERSOSUBSTATE_SIM_SERVICE_PROVIDER_PUK  = 11;
    PERSOSUBSTATE_SIM_SIM_PUK               = 12;
    PERSOSUBSTATE_RUIM_NETWORK1             = 13;
    PERSOSUBSTATE_RUIM_NETWORK2             = 14;
    PERSOSUBSTATE_RUIM_HRPD                 = 15;
    PERSOSUBSTATE_RUIM_CORPORATE            = 16;
    PERSOSUBSTATE_RUIM_SERVICE_PROVIDER     = 17;
    PERSOSUBSTATE_RUIM_RUIM                 = 18;
    PERSOSUBSTATE_RUIM_NETWORK1_PUK         = 19; /* The corresponding perso lock is blocked */
    PERSOSUBSTATE_RUIM_NETWORK2_PUK         = 20;
    PERSOSUBSTATE_RUIM_HRPD_PUK             = 21;
    PERSOSUBSTATE_RUIM_CORPORATE_PUK        = 22;
    PERSOSUBSTATE_RUIM_SERVICE_PROVIDER_PUK = 23;
    PERSOSUBSTATE_RUIM_RUIM_PUK             = 24;
}

enum RilAppState {
    APPSTATE_UNKNOWN               = 0;
    APPSTATE_DETECTED              = 1;
    APPSTATE_PIN                   = 2; /* If PIN1 or UPin is required */
    APPSTATE_PUK                   = 3; /* If PUK1 or Puk for UPin is required */
    APPSTATE_SUBSCRIPTION_PERSO    = 4; /* perso_substate should be look at
                                           when app_state is assigned to this value */
    APPSTATE_READY                 = 5;
}

enum RilPinState {
    PINSTATE_UNKNOWN              = 0;
    PINSTATE_ENABLED_NOT_VERIFIED = 1;
    PINSTATE_ENABLED_VERIFIED     = 2;
    PINSTATE_DISABLED             = 3;
    PINSTATE_ENABLED_BLOCKED      = 4;
    PINSTATE_ENABLED_PERM_BLOCKED = 5;
}

enum RilAppType {
  APPTYPE_UNKNOWN = 0;
  APPTYPE_SIM     = 1;
  APPTYPE_USIM    = 2;
  APPTYPE_RUIM    = 3;
  APPTYPE_CSIM    = 4;
}

message RilAppStatus {
  optional RilAppType      app_type         = 1;
  optional RilAppState     app_state        = 2;
  optional RilPersoSubstate perso_substate  = 3; /* applicable only if app_state ==
                                                    APPSTATE_SUBSCRIPTION_PERSO */
  optional string          aid              = 4; /* null terminated string, e.g., from 0xA0, 0x00 -> 0x41,
                                                    0x30, 0x30, 0x30 */
  optional string          app_label        = 5; /* null terminated string */
  optional int32           pin1_replaced    = 6; /* applicable to USIM and CSIM */
  optional RilPinState     pin1             = 7;
  optional RilPinState     pin2             = 8;
}


message RilCardStatus {
  optional RilCardState card_state                      = 1; /* current state */
  optional RilPinState  universal_pin_state             = 2; /* applicable to USIM and CSIM: PINSTATE_xxx */
  optional int32        gsm_umts_subscription_app_index = 3; /* value < CARD_MAX_APPS */
  optional int32        cdma_subscription_app_index     = 4; /* value < CARD_MAX_APPS */
  optional int32        num_applications                = 5; /* value <= CARD_MAX_APPS */
  repeated RilAppStatus applications                    = 6; /* CARD_MAX_APPS == 8 */
}

/* User-to-User signaling Info activation types derived from 3GPP 23.087 v8.0 */
enum RilUusType {
    RILUUSTYPE1_IMPLICIT        = 0;
    RILUUSTYPE1_REQUIRED        = 1;
    RILUUSTYPE1_NOT_REQUIRED    = 2;
    RILUUSTYPE2_REQUIRED        = 3;
    RILUUSTYPE2_NOT_REQUIRED    = 4;
    RILUUSTYPE3_REQUIRED        = 5;
    RILUUSTYPE3_NOT_REQUIRED    = 6;
};

/* User-to-User Signaling Information data coding schemes. Possible values for
 * Octet 3 (Protocol Discriminator field) in the UUIE. The values have been
 * specified in section 10.5.4.25 of 3GPP TS 24.008 */
enum RilUusDcs {
    RILUUSDCS_USP               = 0;   /* User specified protocol */
    RILUUSDCS_OSIHLP            = 1;   /* OSI higher layer protocol */
    RILUUSDCS_X244              = 2;   /* X.244 */
    RILUUSDCS_RMCF              = 3;   /* Reserved for system mangement
                                          convergence function */
    RILUUSDCS_IA5c              = 4;   /* IA5 characters */
}

/* User-to-User Signaling Information defined in 3GPP 23.087 v8.0
 * This data is passed in RIL_ExtensionRecord and rec contains this
 * structure when type is RIL_UUS_INFO_EXT_REC */
message RilUusInfo {
  optional RilUusType uus_type  = 1; /* UUS Type */
  optional RilUusDcs uus_dcs    = 2; /* UUS Data Coding Scheme */
  optional int32 uus_length     = 3; /* Length of UUS Data */
  optional string uus_data      = 4; /* UUS Data */
}

enum RilCallState {
    CALLSTATE_ACTIVE     = 0;
    CALLSTATE_HOLDING    = 1;
    CALLSTATE_DIALING    = 2;   /* MO call only */
    CALLSTATE_ALERTING   = 3;   /* MO call only */
    CALLSTATE_INCOMING   = 4;   /* MT call only */
    CALLSTATE_WAITING    = 5;   /* MT call only */
}

message RilCall {
    optional RilCallState    state               = 1;  /* State of the call */
    optional int32           index               = 2;  /* Connection Index for use with,
                                                          eg, AT+CHLD */
    optional int32           toa                 = 3;  /* type of address, eg 145 = intl */
    optional bool            is_mpty             = 4;  /* true if is mpty call */
    optional bool            is_mt               = 5;  /* true if call is mobile terminated */
    optional int32           als                 = 6;  /* ALS line indicator if available
                                                          (0 = line 1) */
    optional bool            is_voice            = 7;  /* true if this is is a voice call */
    optional bool            is_voice_privacy    = 8;  /* true if CDMA voice privacy mode
                                                          is active */
    optional string          number              = 9;  /* Remote party number */
    optional int32           number_presentation = 10; /* 0=Allowed, 1=Restricted,
                                                          2=Not Specified/Unknown 3=Payphone */
    optional string          name                = 11; /* Remote party name */
    optional int32           name_presentation   = 12; /* 0=Allowed, 1=Restricted,
                                                          2=Not Specified/Unknown 3=Payphone */
    optional RilUusInfo      uus_info            = 13; /* NULL or Pointer to User-User Signaling
                                                          Information */
}

message RILGWSignalStrength {
    optional int32 signal_strength = 1;   /* Valid values are (0-31, 99) as defined
                                             in TS 27.007 8.5 */
    optional int32 bit_error_rate  = 2;   /* bit error rate (0-7, 99) as defined
                                             in TS 27.007 8.5 */
}

message RILCDMASignalStrength {
    optional int32 dbm  = 1; /* Valid values are positive integers. This value is the actual RSSI
                                value multiplied by -1. Example: If the actual RSSI is -75, then
                                this response value will be 75.  */
    optional int32 ecio = 2; /* Valid values are positive integers. This value is the actual Ec/Io
                                multiplied by -10.  Example: If the actual Ec/Io is -12.5 dB, then
                                this response value will be 125. */
}

message RILEVDOSignalStrength {
    optional int32 dbm  = 1; /* Valid values are positive integers. This value is the actual RSSI
                                value multiplied by -1.  Example: If the actual RSSI is -75, then
                                this response value will be 75.  */
    optional int32 ecio = 2; /* Valid values are positive integers. This value is the actual
                                Ec/Io multiplied by -10.  Example: If the actual Ec/Io is -12.5 dB,
                                then this response value will be 125. */
    optional int32 signal_noise_ratio = 3; /* Valid values are 0-8.
                                        8 is the highest signal to noise ratio. */
}

// Response is an array of strings.
//
// If a strings(i) is "*magic-null*" then that value will be returned as null.
message RspStrings{
  repeated string strings                   = 1;
}

// Response is an array of integers
message RspIntegers{
  repeated int32 integers                   = 1;
}

//  1 RIL_REQUEST_GET_SIM_STATUS
message RspGetSimStatus {
  required RilCardStatus card_status        = 1;
}

//  2 RIL_REQUEST_ENTER_SIM_PIN
message ReqEnterSimPin {
  required string pin                       = 1;
}
//    RIL_REQUEST_ENTER_SIM_PIN response
message RspEnterSimPin {
  required int32 retries_remaining          = 1;
}

//  9 RIL_GET_CURRENT_CALLS response
message RspGetCurrentCalls {
  repeated RilCall calls                    = 1;
}

//  10 RIL_REQUEST_DIAL
message ReqDial {
  optional string     address  = 1;
  optional int32      clir     = 2;
                             /* (same as 'n' paremeter in TS 27.007 7.7 "+CLIR"
                              * clir == 0 on "use subscription default value"
                              * clir == 1 on "CLIR invocation" (restrict CLI presentation)
                              * clir == 2 on "CLIR suppression" (allow CLI presentation)
                              */
  optional RilUusInfo uus_info = 3;    /* NULL or Pointer to User-User Signaling Information */
}

// 12 RIL_REQUEST_HANG_UP
message ReqHangUp {
  required int32 connection_index           = 1;
}

// 18 response for RIL_REQUEST_LAST_CALL_FAIL_CAUSE
message RspLastCallFailCause {
  required int32 last_call_fail_cause       = 1;
}

// 19 RIL_REQUEST_SIGNAL_STRENGTH response
message RspSignalStrength {
    optional RILGWSignalStrength   gw_signalstrength   = 1;
    optional RILCDMASignalStrength cdma_signalstrength = 2;
    optional RILEVDOSignalStrength evdo_signalstrength = 3;
}

// 22 RIL_REQUEST_OPERATOR response
message RspOperator{
  optional string long_alpha_ons            = 1; // The long alpha ons or eons
  optional string short_alpha_ons           = 2; // The short alpha ons or eons
  optional string mcc_mnc                   = 3; // The 5 or 6 digit mcc + mnc
}

// 52 RIL_REQUEST_SEPARATE_CONNECTION
message ReqSeparateConnection{
  required int32 index                      = 1; // Connection index to separate
                                                 // from multiparty call
}

// 53 RIL_REQUEST_SET_MUTE
message ReqSetMute{
  required bool state                       = 1; // true to "enable mute", false to "disable mute"
}

// 61 RIL_REQUEST_SCREEN_STATE
message ReqScreenState {
  required bool state                       = 1; // true screen is on, false screen is off
}