summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfenglu <fenglu@google.com>2015-04-14 14:53:55 -0700
committerfenglu <fenglu@google.com>2015-04-15 17:16:14 -0700
commit9a4b19cc6c2ace1c61345f510ac9ad17e848283b (patch)
tree54a1745cd1dd122b113c431e2d3724013a23ff57
parent27976c479473bb772703fe4caa100e535e635e84 (diff)
downloadandroid_hardware_ril-9a4b19cc6c2ace1c61345f510ac9ad17e848283b.tar.gz
android_hardware_ril-9a4b19cc6c2ace1c61345f510ac9ad17e848283b.tar.bz2
android_hardware_ril-9a4b19cc6c2ace1c61345f510ac9ad17e848283b.zip
Link Capacity Estimation - RIL support
Change-Id: I9c4d4901d823d719be2b8bdec64f08eda342de53
-rw-r--r--include/telephony/ril.h80
-rw-r--r--libril/ril.cpp55
-rw-r--r--libril/ril_commands.h3
-rwxr-xr-xlibril/ril_unsol_commands.h1
4 files changed, 138 insertions, 1 deletions
diff --git a/include/telephony/ril.h b/include/telephony/ril.h
index a5079f4..3c0a2d1 100644
--- a/include/telephony/ril.h
+++ b/include/telephony/ril.h
@@ -113,7 +113,8 @@ typedef enum {
RIL_E_SS_MODIFIED_TO_DIAL = 24, /* SS request modified to DIAL */
RIL_E_SS_MODIFIED_TO_USSD = 25, /* SS request modified to USSD */
RIL_E_SUBSCRIPTION_NOT_SUPPORTED = 26, /* Subscription not supported by RIL */
- RIL_E_SS_MODIFIED_TO_SS = 27 /* SS request modified to different SS request */
+ RIL_E_SS_MODIFIED_TO_SS = 27, /* SS request modified to different SS request */
+ RIL_E_LCE_NOT_SUPPORTED = 28 /* LCE service not supported by RIL */
} RIL_Errno;
@@ -566,6 +567,27 @@ typedef struct {
*/
} RIL_NeighboringCell;
+typedef struct {
+ char lce_status; /* LCE service status:
+ * -1 = not supported;
+ * 0 = stopped;
+ * 1 = active.
+ */
+ unsigned int actual_interval_ms; /* actual LCE reporting interval,
+ * meaningful only if LCEStatus = 1.
+ */
+} RIL_LceStatusInfo;
+
+typedef struct {
+ unsigned int last_hop_capacity_kbps; /* last-hop cellular capacity: bytes/second. */
+ unsigned char confidence_level; /* capacity estimate confidence: 0-100 */
+ unsigned char lce_suspended; /* LCE report going to be suspended? (e.g., radio
+ * moves to inactive state or network type change)
+ * 1 = suspended;
+ * 0 = not suspended.
+ */
+} RIL_LceDataInfo;
+
/* See RIL_REQUEST_LAST_CALL_FAIL_CAUSE */
typedef enum {
CALL_FAIL_UNOBTAINABLE_NUMBER = 1,
@@ -4348,6 +4370,52 @@ typedef struct {
*/
#define RIL_REQUEST_SET_RADIO_CAPABILITY 131
+/**
+ * RIL_REQUEST_START_LCE
+ *
+ * Start Link Capacity Estimate (LCE) service if supported by the radio.
+ *
+ * "data" is const int *
+ * ((const int*)data)[0] specifies the desired reporting interval (ms).
+ *
+ * "response" is the RIL_LCEStatusInfo.
+ *
+ * Valid errors:
+ * SUCCESS
+ * RADIO_NOT_AVAILABLE
+ * LCE_NOT_SUPPORTED
+ */
+#define RIL_REQUEST_START_LCE 132
+
+/**
+ * RIL_REQUEST_STOP_LCE
+ *
+ * Stop Link Capacity Estimate (LCE) service, the STOP operation should be
+ * idempotent for the radio modem.
+ *
+ * "response" is the RIL_LCEStatusInfo.
+ *
+ * Valid errors:
+ * SUCCESS
+ * RADIO_NOT_AVAILABLE
+ * LCE_NOT_SUPPORTED
+ */
+#define RIL_REQUEST_STOP_LCE 133
+
+/**
+ * RIL_REQUEST_PULL_LCEDATA
+ *
+ * Pull LCE service for capacity information.
+ *
+ * "response" is the RIL_LCEDataInfo.
+ *
+ * Valid errors:
+ * SUCCESS
+ * RADIO_NOT_AVAILABLE
+ * LCE_NOT_SUPPORTED
+ */
+#define RIL_REQUEST_PULL_LCEDATA 134
+
/***********************************************************************/
@@ -4937,6 +5005,16 @@ typedef struct {
*/
#define RIL_UNSOL_STK_CC_ALPHA_NOTIFY 1044
+/**
+ * RIL_UNSOL_LCEDATA_RECV
+ *
+ * Called when there is an incoming Link Capacity Estimate (LCE) info report.
+ *
+ * "data" is the RIL_LCEDataInfo structure.
+ *
+ */
+#define RIL_UNSOL_LCEDATA_RECV 1045
+
/***********************************************************************/
diff --git a/libril/ril.cpp b/libril/ril.cpp
index 30e51c6..e551695 100644
--- a/libril/ril.cpp
+++ b/libril/ril.cpp
@@ -294,6 +294,8 @@ static int responseHardwareConfig(Parcel &p, void *response, size_t responselen)
static int responseDcRtInfo(Parcel &p, void *response, size_t responselen);
static int responseRadioCapability(Parcel &p, void *response, size_t responselen);
static int responseSSData(Parcel &p, void *response, size_t responselen);
+static int responseLceStatus(Parcel &p, void *response, size_t responselen);
+static int responseLceData(Parcel &p, void *response, size_t responselen);
static int decodeVoiceRadioTechnology (RIL_RadioState radioState);
static int decodeCdmaSubscriptionSource (RIL_RadioState radioState);
@@ -3565,6 +3567,59 @@ static int responseDcRtInfo(Parcel &p, void *response, size_t responselen)
return 0;
}
+static int responseLceStatus(Parcel &p, void *response, size_t responselen) {
+ if (response == NULL || responselen != sizeof(RIL_LceStatusInfo)) {
+ if (response == NULL) {
+ RLOGE("invalid response: NULL");
+ }
+ else {
+ RLOGE("responseLceStatus: invalid response length %d expecting len: d%",
+ sizeof(RIL_LceStatusInfo), responselen);
+ }
+ return RIL_ERRNO_INVALID_RESPONSE;
+ }
+
+ RIL_LceStatusInfo *p_cur = (RIL_LceStatusInfo *)response;
+ p.write((void *)p_cur, 1); // p_cur->lce_status takes one byte.
+ p.writeInt32(p_cur->actual_interval_ms);
+
+ startResponse;
+ appendPrintBuf("LCE Status: %d, actual_interval_ms: %d",
+ p_cur->lce_status, p_cur->actual_interval_ms);
+ closeResponse;
+
+ return 0;
+}
+
+static int responseLceData(Parcel &p, void *response, size_t responselen) {
+ if (response == NULL || responselen != sizeof(RIL_LceDataInfo)) {
+ if (response == NULL) {
+ RLOGE("invalid response: NULL");
+ }
+ else {
+ RLOGE("responseLceData: invalid response length %d expecting len: d%",
+ sizeof(RIL_LceDataInfo), responselen);
+ }
+ return RIL_ERRNO_INVALID_RESPONSE;
+ }
+
+ RIL_LceDataInfo *p_cur = (RIL_LceDataInfo *)response;
+ p.writeInt32(p_cur->last_hop_capacity_kbps);
+
+ /* p_cur->confidence_level and p_cur->lce_suspended take 1 byte each.*/
+ p.write((void *)&(p_cur->confidence_level), 1);
+ p.write((void *)&(p_cur->lce_suspended), 1);
+
+ startResponse;
+ appendPrintBuf("LCE info received: capacity %d confidence level %d
+ and suspended %d",
+ p_cur->last_hop_capacity_kbps, p_cur->confidence_level,
+ p_cur->lce_suspended);
+ closeResponse;
+
+ return 0;
+}
+
/**
* A write on the wakeup fd is done just to pop us out of select()
* We empty the buffer here and then ril_event will reset the timers on the
diff --git a/libril/ril_commands.h b/libril/ril_commands.h
index 074e822..d0a327b 100644
--- a/libril/ril_commands.h
+++ b/libril/ril_commands.h
@@ -146,3 +146,6 @@
{RIL_REQUEST_SHUTDOWN, dispatchVoid, responseVoid},
{RIL_REQUEST_GET_RADIO_CAPABILITY, dispatchVoid, responseRadioCapability},
{RIL_REQUEST_SET_RADIO_CAPABILITY, dispatchRadioCapability, responseRadioCapability},
+ {RIL_REQUEST_START_LCE, dispatchInts, responseLceStatus},
+ {RIL_REQUEST_STOP_LCE, dispatchVoid, responseLceStatus},
+ {RIL_REQUEST_PULL_LCEDATA, dispatchVoid, responseLceData},
diff --git a/libril/ril_unsol_commands.h b/libril/ril_unsol_commands.h
index 6ea7157..eb9e12d 100755
--- a/libril/ril_unsol_commands.h
+++ b/libril/ril_unsol_commands.h
@@ -59,3 +59,4 @@
{RIL_UNSOL_RADIO_CAPABILITY, responseRadioCapability, WAKE_PARTIAL},
{RIL_UNSOL_ON_SS, responseSSData, WAKE_PARTIAL},
{RIL_UNSOL_STK_CC_ALPHA_NOTIFY, responseString, WAKE_PARTIAL},
+ {RIL_UNSOL_LCEDATA_RECV, responseLceData, WAKE_PARTIAL},