/*
 *  Copyright (C) 2013 Canonical Ltd.
 *  Copyright (C) 2013-2020 Jolla Ltd.
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License version 2 as
 *  published by the Free Software Foundation.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 */

#ifndef __RIL_CONSTANTS_H
#define __RIL_CONSTANTS_H 1

#include <ofono/ril-constants.h>

#define RIL_MAX_UUID_LENGTH 64

/* Radio state */
enum ril_radio_state {
	RADIO_STATE_OFF                   = 0,
	RADIO_STATE_UNAVAILABLE           = 1,
	RADIO_STATE_SIM_NOT_READY         = 2,
	RADIO_STATE_SIM_LOCKED_OR_ABSENT  = 3,
	RADIO_STATE_SIM_READY             = 4,
	RADIO_STATE_RUIM_NOT_READY        = 5,
	RADIO_STATE_RUIM_READY            = 6,
	RADIO_STATE_RUIM_LOCKED_OR_ABSENT = 7,
	RADIO_STATE_NV_NOT_READY          = 8,
	RADIO_STATE_NV_READY              = 9,
	RADIO_STATE_ON                    = 10
};

/* Preferred network types */
enum ril_pref_net_type {
	PREF_NET_TYPE_GSM_WCDMA                 = 0,
	PREF_NET_TYPE_GSM_ONLY                  = 1,
	PREF_NET_TYPE_WCDMA                     = 2,
	PREF_NET_TYPE_GSM_WCDMA_AUTO            = 3,
	PREF_NET_TYPE_CDMA_EVDO_AUTO            = 4,
	PREF_NET_TYPE_CDMA_ONLY                 = 5,
	PREF_NET_TYPE_EVDO_ONLY                 = 6,
	PREF_NET_TYPE_GSM_WCDMA_CDMA_EVDO_AUTO  = 7,
	PREF_NET_TYPE_LTE_CDMA_EVDO             = 8,
	PREF_NET_TYPE_LTE_GSM_WCDMA             = 9,
	PREF_NET_TYPE_LTE_CMDA_EVDO_GSM_WCDMA   = 10,
	PREF_NET_TYPE_LTE_ONLY                  = 11,
	PREF_NET_TYPE_LTE_WCDMA                 = 12
};

/* Radio technologies */
enum ril_radio_tech {
	RADIO_TECH_UNKNOWN  = 0,
	RADIO_TECH_GPRS     = 1,
	RADIO_TECH_EDGE     = 2,
	RADIO_TECH_UMTS     = 3,
	RADIO_TECH_IS95A    = 4,
	RADIO_TECH_IS95B    = 5,
	RADIO_TECH_1xRTT    = 6,
	RADIO_TECH_EVDO_0   = 7,
	RADIO_TECH_EVDO_A   = 8,
	RADIO_TECH_HSDPA    = 9,
	RADIO_TECH_HSUPA    = 10,
	RADIO_TECH_HSPA     = 11,
	RADIO_TECH_EVDO_B   = 12,
	RADIO_TECH_EHRPD    = 13,
	RADIO_TECH_LTE      = 14,
	RADIO_TECH_HSPAP    = 15,
	RADIO_TECH_GSM      = 16,
	RADIO_TECH_TD_SCDMA = 17,
	RADIO_TECH_IWLAN    = 18,
	RADIO_TECH_LTE_CA   = 19
};

/* Radio capabilities */
enum ril_radio_access_family {
	RAF_GPRS     = (1 << RADIO_TECH_GPRS),
	RAF_EDGE     = (1 << RADIO_TECH_EDGE),
	RAF_UMTS     = (1 << RADIO_TECH_UMTS),
	RAF_IS95A    = (1 << RADIO_TECH_IS95A),
	RAF_IS95B    = (1 << RADIO_TECH_IS95B),
	RAF_1xRTT    = (1 << RADIO_TECH_1xRTT),
	RAF_EVDO_0   = (1 << RADIO_TECH_EVDO_0),
	RAF_EVDO_A   = (1 << RADIO_TECH_EVDO_A),
	RAF_HSDPA    = (1 << RADIO_TECH_HSDPA),
	RAF_HSUPA    = (1 << RADIO_TECH_HSUPA),
	RAF_HSPA     = (1 << RADIO_TECH_HSPA),
	RAF_EVDO_B   = (1 << RADIO_TECH_EVDO_B),
	RAF_EHRPD    = (1 << RADIO_TECH_EHRPD),
	RAF_LTE      = (1 << RADIO_TECH_LTE),
	RAF_HSPAP    = (1 << RADIO_TECH_HSPAP),
	RAF_GSM      = (1 << RADIO_TECH_GSM),
	RAF_TD_SCDMA = (1 << RADIO_TECH_TD_SCDMA),
	RAF_LTE_CA   = (1 << RADIO_TECH_LTE_CA)
};

enum ril_radio_capability_phase {
	RC_PHASE_CONFIGURED = 0,
	RC_PHASE_START      = 1,
	RC_PHASE_APPLY      = 2,
	RC_PHASE_UNSOL_RSP  = 3,
	RC_PHASE_FINISH     = 4
};

enum ril_radio_capability_status {
	RC_STATUS_NONE      = 0,
	RC_STATUS_SUCCESS   = 1,
	RC_STATUS_FAIL      = 2
};

#define RIL_RADIO_CAPABILITY_VERSION 1

struct ril_radio_capability {
	int version;
	int session;
	enum ril_radio_capability_phase phase;
	enum ril_radio_access_family rat;
	char logicalModemUuid[RIL_MAX_UUID_LENGTH];
	int status;
};

enum ril_uicc_subscription_action {
	RIL_UICC_SUBSCRIPTION_DEACTIVATE = 0,
	RIL_UICC_SUBSCRIPTION_ACTIVATE = 1
};

/* See RIL_REQUEST_LAST_CALL_FAIL_CAUSE */
enum ril_call_fail_cause {
	CALL_FAIL_UNOBTAINABLE_NUMBER = 1,
	CALL_FAIL_NO_ROUTE_TO_DESTINATION = 3,
	CALL_FAIL_CHANNEL_UNACCEPTABLE = 6,
	CALL_FAIL_OPERATOR_DETERMINED_BARRING = 8,
	CALL_FAIL_NORMAL = 16,
	CALL_FAIL_BUSY = 17,
	CALL_FAIL_NO_USER_RESPONDING = 18,
	CALL_FAIL_NO_ANSWER_FROM_USER = 19,
	CALL_FAIL_CALL_REJECTED = 21,
	CALL_FAIL_NUMBER_CHANGED = 22,
	CALL_FAIL_DESTINATION_OUT_OF_ORDER = 27,
	CALL_FAIL_INVALID_NUMBER_FORMAT = 28,
	CALL_FAIL_FACILITY_REJECTED = 29,
	CALL_FAIL_RESP_TO_STATUS_ENQUIRY = 30,
	CALL_FAIL_NORMAL_UNSPECIFIED = 31,
	CALL_FAIL_CONGESTION = 34,
	CALL_FAIL_NETWORK_OUT_OF_ORDER = 38,
	CALL_FAIL_TEMPORARY_FAILURE = 41,
	CALL_FAIL_SWITCHING_EQUIPMENT_CONGESTION = 42,
	CALL_FAIL_ACCESS_INFORMATION_DISCARDED = 43,
	CALL_FAIL_REQUESTED_CIRCUIT_OR_CHANNEL_NOT_AVAILABLE = 44,
	CALL_FAIL_RESOURCES_UNAVAILABLE_OR_UNSPECIFIED = 47,
	CALL_FAIL_QOS_UNAVAILABLE = 49,
	CALL_FAIL_REQUESTED_FACILITY_NOT_SUBSCRIBED = 50,
	CALL_FAIL_INCOMING_CALLS_BARRED_WITHIN_CUG = 55,
	CALL_FAIL_BEARER_CAPABILITY_NOT_AUTHORIZED = 57,
	CALL_FAIL_BEARER_CAPABILITY_UNAVAILABLE = 58,
	CALL_FAIL_SERVICE_OPTION_NOT_AVAILABLE = 63,
	CALL_FAIL_BEARER_SERVICE_NOT_IMPLEMENTED = 65,
	CALL_FAIL_ACM_LIMIT_EXCEEDED = 68,
	CALL_FAIL_REQUESTED_FACILITY_NOT_IMPLEMENTED = 69,
	CALL_FAIL_ONLY_DIGITAL_INFORMATION_BEARER_AVAILABLE = 70,
	CALL_FAIL_SERVICE_OR_OPTION_NOT_IMPLEMENTED = 79,
	CALL_FAIL_INVALID_TRANSACTION_IDENTIFIER = 81,
	CALL_FAIL_USER_NOT_MEMBER_OF_CUG = 87,
	CALL_FAIL_INCOMPATIBLE_DESTINATION = 88,
	CALL_FAIL_INVALID_TRANSIT_NW_SELECTION = 91,
	CALL_FAIL_SEMANTICALLY_INCORRECT_MESSAGE = 95,
	CALL_FAIL_INVALID_MANDATORY_INFORMATION = 96,
	CALL_FAIL_MESSAGE_TYPE_NON_IMPLEMENTED = 97,
	CALL_FAIL_MESSAGE_TYPE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE = 98,
	CALL_FAIL_INFORMATION_ELEMENT_NON_EXISTENT = 99,
	CALL_FAIL_CONDITIONAL_IE_ERROR = 100,
	CALL_FAIL_MESSAGE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE = 101,
	CALL_FAIL_RECOVERY_ON_TIMER_EXPIRED = 102,
	CALL_FAIL_PROTOCOL_ERROR_UNSPECIFIED = 111,
	CALL_FAIL_INTERWORKING_UNSPECIFIED = 127,
	CALL_FAIL_CALL_BARRED = 240,
	CALL_FAIL_FDN_BLOCKED = 241,
	CALL_FAIL_IMSI_UNKNOWN_IN_VLR = 242,
	CALL_FAIL_IMEI_NOT_ACCEPTED = 243,
	CALL_FAIL_DIAL_MODIFIED_TO_USSD = 244,
	CALL_FAIL_DIAL_MODIFIED_TO_SS = 245,
	CALL_FAIL_DIAL_MODIFIED_TO_DIAL = 246,
	CALL_FAIL_ERROR_UNSPECIFIED = 0xffff,

/* Not defined in ril.h but valid 3GPP specific cause values
 * for call control. See 3GPP TS 24.008 Annex H. */
	CALL_FAIL_ANONYMOUS_CALL_REJECTION = 24,
	CALL_FAIL_PRE_EMPTION = 25
};

enum ril_data_call_fail_cause {
	PDP_FAIL_NONE = 0,
	PDP_FAIL_OPERATOR_BARRED = 0x08,
	PDP_FAIL_INSUFFICIENT_RESOURCES = 0x1A,
	PDP_FAIL_MISSING_UKNOWN_APN = 0x1B,
	PDP_FAIL_UNKNOWN_PDP_ADDRESS_TYPE = 0x1C,
	PDP_FAIL_USER_AUTHENTICATION = 0x1D,
	PDP_FAIL_ACTIVATION_REJECT_GGSN = 0x1E,
	PDP_FAIL_ACTIVATION_REJECT_UNSPECIFIED = 0x1F,
	PDP_FAIL_SERVICE_OPTION_NOT_SUPPORTED = 0x20,
	PDP_FAIL_SERVICE_OPTION_NOT_SUBSCRIBED = 0x21,
	PDP_FAIL_SERVICE_OPTION_OUT_OF_ORDER = 0x22,
	PDP_FAIL_NSAPI_IN_USE = 0x23,
	PDP_FAIL_REGULAR_DEACTIVATION = 0x24,
	PDP_FAIL_QOS_NOT_ACCEPTED = 0x25,
	PDP_FAIL_NETWORK_FAILURE = 0x26,
	PDP_FAIL_UMTS_REACTIVATION_REQ = 0x27,
	PDP_FAIL_FEATURE_NOT_SUPP = 0x28,
	PDP_FAIL_TFT_SEMANTIC_ERROR = 0x29,
	PDP_FAIL_TFT_SYTAX_ERROR = 0x2A,
	PDP_FAIL_UNKNOWN_PDP_CONTEXT = 0x2B,
	PDP_FAIL_FILTER_SEMANTIC_ERROR = 0x2C,
	PDP_FAIL_FILTER_SYTAX_ERROR = 0x2D,
	PDP_FAIL_PDP_WITHOUT_ACTIVE_TFT = 0x2E,
	PDP_FAIL_ONLY_IPV4_ALLOWED = 0x32,
	PDP_FAIL_ONLY_IPV6_ALLOWED = 0x33,
	PDP_FAIL_ONLY_SINGLE_BEARER_ALLOWED = 0x34,
	PDP_FAIL_ESM_INFO_NOT_RECEIVED = 0x35,
	PDP_FAIL_PDN_CONN_DOES_NOT_EXIST = 0x36,
	PDP_FAIL_MULTI_CONN_TO_SAME_PDN_NOT_ALLOWED = 0x37,
	PDP_FAIL_MAX_ACTIVE_PDP_CONTEXT_REACHED = 0x41,
	PDP_FAIL_UNSUPPORTED_APN_IN_CURRENT_PLMN = 0x42,
	PDP_FAIL_INVALID_TRANSACTION_ID = 0x51,
	PDP_FAIL_MESSAGE_INCORRECT_SEMANTIC = 0x5F,
	PDP_FAIL_INVALID_MANDATORY_INFO = 0x60,
	PDP_FAIL_MESSAGE_TYPE_UNSUPPORTED = 0x61,
	PDP_FAIL_MSG_TYPE_NONCOMPATIBLE_STATE = 0x62,
	PDP_FAIL_UNKNOWN_INFO_ELEMENT = 0x63,
	PDP_FAIL_CONDITIONAL_IE_ERROR = 0x64,
	PDP_FAIL_MSG_AND_PROTOCOL_STATE_UNCOMPATIBLE = 0x65,
	PDP_FAIL_PROTOCOL_ERRORS = 0x6F,
	PDP_FAIL_APN_TYPE_CONFLICT = 0x70,
	PDP_FAIL_INVALID_PCSCF_ADDR = 0x71,
	PDP_FAIL_INTERNAL_CALL_PREEMPT_BY_HIGH_PRIO_APN = 0x72,
	PDP_FAIL_EMM_ACCESS_BARRED = 0x73,
	PDP_FAIL_EMERGENCY_IFACE_ONLY = 0x74,
	PDP_FAIL_IFACE_MISMATCH = 0x75,
	PDP_FAIL_COMPANION_IFACE_IN_USE = 0x76,
	PDP_FAIL_IP_ADDRESS_MISMATCH = 0x77,
	PDP_FAIL_IFACE_AND_POL_FAMILY_MISMATCH = 0x78,
	PDP_FAIL_EMM_ACCESS_BARRED_INFINITE_RETRY = 0x79,
	PDP_FAIL_AUTH_FAILURE_ON_EMERGENCY_CALL = 0x7A,
	PDP_FAIL_VOICE_REGISTRATION_FAIL = -1,
	PDP_FAIL_DATA_REGISTRATION_FAIL = -2,
	PDP_FAIL_SIGNAL_LOST = -3,
	PDP_FAIL_PREF_RADIO_TECH_CHANGED = -4,
	PDP_FAIL_RADIO_POWER_OFF = -5,
	PDP_FAIL_TETHERED_CALL_ACTIVE = -6,
	PDP_FAIL_ERROR_UNSPECIFIED = 0xffff
};

/* RIL_REQUEST_DEACTIVATE_DATA_CALL parameter */
#define RIL_DEACTIVATE_DATA_CALL_NO_REASON 0
#define RIL_DEACTIVATE_DATA_CALL_RADIO_SHUTDOWN 1

/* RIL_REQUEST_SETUP_DATA_CALL */
enum ril_data_profile {
	RIL_DATA_PROFILE_DEFAULT = 0,
	RIL_DATA_PROFILE_TETHERED = 1,
	RIL_DATA_PROFILE_IMS = 2,
	RIL_DATA_PROFILE_FOTA = 3,
	RIL_DATA_PROFILE_CBS = 4,
	RIL_DATA_PROFILE_OEM_BASE = 1000,
	RIL_DATA_PROFILE_INVALID = 0xFFFFFFFF
};

enum ril_profile_type {
	RIL_PROFILE_COMMON = 0,
	RIL_PROFILE_3GPP = 1,
	RIL_PROFILE_3GPP2 = 2
};

enum ril_auth {
	RIL_AUTH_NONE = 0,
	RIL_AUTH_PAP = 1,
	RIL_AUTH_CHAP = 2,
	RIL_AUTH_BOTH = 3
};

#define RIL_CARD_MAX_APPS 8

/* SIM card states */
enum ril_card_state {
	RIL_CARDSTATE_UNKNOWN = -1,
	RIL_CARDSTATE_ABSENT  = 0,
	RIL_CARDSTATE_PRESENT = 1,
	RIL_CARDSTATE_ERROR   = 2
};

/* SIM personalization substates */
enum ril_perso_substate {
	RIL_PERSOSUBSTATE_UNKNOWN                   = 0,
	RIL_PERSOSUBSTATE_IN_PROGRESS               = 1,
	RIL_PERSOSUBSTATE_READY                     = 2,
	RIL_PERSOSUBSTATE_SIM_NETWORK               = 3,
	RIL_PERSOSUBSTATE_SIM_NETWORK_SUBSET        = 4,
	RIL_PERSOSUBSTATE_SIM_CORPORATE             = 5,
	RIL_PERSOSUBSTATE_SIM_SERVICE_PROVIDER      = 6,
	RIL_PERSOSUBSTATE_SIM_SIM                   = 7,
	RIL_PERSOSUBSTATE_SIM_NETWORK_PUK           = 8,
	RIL_PERSOSUBSTATE_SIM_NETWORK_SUBSET_PUK    = 9,
	RIL_PERSOSUBSTATE_SIM_CORPORATE_PUK         = 10,
	RIL_PERSOSUBSTATE_SIM_SERVICE_PROVIDER_PUK  = 11,
	RIL_PERSOSUBSTATE_SIM_SIM_PUK               = 12,
	RIL_PERSOSUBSTATE_RUIM_NETWORK1             = 13,
	RIL_PERSOSUBSTATE_RUIM_NETWORK2             = 14,
	RIL_PERSOSUBSTATE_RUIM_HRPD                 = 15,
	RIL_PERSOSUBSTATE_RUIM_CORPORATE            = 16,
	RIL_PERSOSUBSTATE_RUIM_SERVICE_PROVIDER     = 17,
	RIL_PERSOSUBSTATE_RUIM_RUIM                 = 18,
	RIL_PERSOSUBSTATE_RUIM_NETWORK1_PUK         = 19,
	RIL_PERSOSUBSTATE_RUIM_NETWORK2_PUK         = 20,
	RIL_PERSOSUBSTATE_RUIM_HRPD_PUK             = 21,
	RIL_PERSOSUBSTATE_RUIM_CORPORATE_PUK        = 22,
	RIL_PERSOSUBSTATE_RUIM_SERVICE_PROVIDER_PUK = 23,
	RIL_PERSOSUBSTATE_RUIM_RUIM_PUK             = 24
};

/* SIM - App states */
enum ril_app_state {
	RIL_APPSTATE_ILLEGAL            = -1,
	RIL_APPSTATE_UNKNOWN            = 0,
	RIL_APPSTATE_DETECTED           = 1,
	RIL_APPSTATE_PIN                = 2,
	RIL_APPSTATE_PUK                = 3,
	RIL_APPSTATE_SUBSCRIPTION_PERSO = 4,
	RIL_APPSTATE_READY              = 5
};

/* SIM - PIN states */
enum ril_pin_state {
	RIL_PINSTATE_UNKNOWN              = 0,
	RIL_PINSTATE_ENABLED_NOT_VERIFIED = 1,
	RIL_PINSTATE_ENABLED_VERIFIED     = 2,
	RIL_PINSTATE_DISABLED             = 3,
	RIL_PINSTATE_ENABLED_BLOCKED      = 4,
	RIL_PINSTATE_ENABLED_PERM_BLOCKED = 5
};

/* SIM - App types */
enum ril_app_type {
	RIL_APPTYPE_UNKNOWN = 0,
	RIL_APPTYPE_SIM     = 1,
	RIL_APPTYPE_USIM    = 2,
	RIL_APPTYPE_RUIM    = 3,
	RIL_APPTYPE_CSIM    = 4,
	RIL_APPTYPE_ISIM    = 5
};

/* Cell info */
enum ril_cell_info_type {
	RIL_CELL_INFO_TYPE_NONE     = 0,
	RIL_CELL_INFO_TYPE_GSM      = 1,
	RIL_CELL_INFO_TYPE_CDMA     = 2,
	RIL_CELL_INFO_TYPE_LTE      = 3,
	RIL_CELL_INFO_TYPE_WCDMA    = 4,
	RIL_CELL_INFO_TYPE_TD_SCDMA = 5
};

enum ril_restricted_state {
	RIL_RESTRICTED_STATE_NONE         = 0x00,
	RIL_RESTRICTED_STATE_CS_EMERGENCY = 0x01,
	RIL_RESTRICTED_STATE_CS_NORMAL    = 0x02,
	RIL_RESTRICTED_STATE_CS_ALL       = 0x04,
	RIL_RESTRICTED_STATE_PS_ALL       = 0x10
};

/* Suplementary services Service class*/
#define SERVICE_CLASS_NONE 0

/* RIL_FACILITY_LOCK parameters */
#define RIL_FACILITY_UNLOCK "0"
#define RIL_FACILITY_LOCK "1"

/* See RIL_REQUEST_SET_UNSOLICITED_RESPONSE_FILTER (RIL_VERSION >= 15) */
enum  ril_unsolicited_response_filter {
	RIL_UR_SIGNAL_STRENGTH            = 0x01,
	RIL_UR_FULL_NETWORK_STATE         = 0x02,
	RIL_UR_DATA_CALL_DORMANCY_CHANGED = 0x04
};

/* RIL_REQUEST_QUERY_NETWORK_SELECTION_MODE result */
enum ril_network_selection_mode {
	RIL_NETWORK_SELECTION_MODE_AUTO	  = 0,
	RIL_NETWORK_SELECTION_MODE_MANUAL = 1
};

#endif /*__RIL_CONSTANTS_H */

/*
 * Local Variables:
 * mode: C
 * c-basic-offset: 8
 * indent-tabs-mode: t
 * End:
 */
