[gbinder-radio] Implement support for AIDL IRadioIms. JB#61702

This commit is contained in:
Matti Lehtimäki
2024-09-23 17:10:17 +03:00
parent 12133c9685
commit 418405697e
5 changed files with 180 additions and 1 deletions

123
include/radio_ims_types.h Normal file
View File

@@ -0,0 +1,123 @@
/*
* Copyright (C) 2024 Jollyboys Ltd
*
* You may use this file under the terms of the BSD license as follows:
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the names of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation
* are those of the authors and should not be interpreted as representing
* any official policies, either expressed or implied.
*/
#ifndef RADIO_IMS_TYPES_H
#define RADIO_IMS_TYPES_H
#include <gbinder_types.h>
G_BEGIN_DECLS
#define RADIO_IMS_INTERFACE_MAX (RADIO_IMS_INTERFACE_COUNT - 1)
#define RADIO_IMS_INSTANCE "default"
#define RADIO_IMS_IFACE_PREFIX "android.hardware.radio.ims."
#define RADIO_IMS_IFACE "IRadioIms"
#define RADIO_IMS_RESPONSE_IFACE "IRadioImsResponse"
#define RADIO_IMS_INDICATION_IFACE "IRadioImsIndication"
#define RADIO_IMS RADIO_IMS_IFACE_PREFIX RADIO_IMS_IFACE
#define RADIO_IMS_FQNAME RADIO_IMS "/" RADIO_IMS_INSTANCE
#define RADIO_IMS_RESPONSE RADIO_IMS_IFACE_PREFIX RADIO_IMS_RESPONSE_IFACE
#define RADIO_IMS_INDICATION RADIO_IMS_IFACE_PREFIX RADIO_IMS_INDICATION_IFACE
/* Transaction codes */
/* c(req,resp,Name,CALL_NAME) */
#define RADIO_IMS_CALL_1(c) \
c(1,1,setSrvccCallInfo,SET_SRVCC_CALL_INFO) \
c(2,2,updateImsRegistrationInfo,UPDATE_IMS_REGISTRATION_INFO) \
c(3,3,startImsTraffic,START_IMS_TRAFFIC) \
c(4,4,stopImsTraffic,STOP_IMS_TRAFFIC) \
c(5,5,triggerEpsFallback,TRIGGER_EPS_FALLBACK) \
c(7,6,sendAnbrQuery,SEND_ANBR_QUERY) \
c(8,7,updateImsCallStatus,UPDATE_IMS_CALL_STATUS) \
/* i(code,Name,IND_NAME) */
#define RADIO_IMS_IND_1(i) \
i(1,onConnectionSetupFailure,ON_CONNECTION_SETUP_FAILURE) \
i(2,notifyAnbr,NOTIFY_ANBR) \
i(3,triggerImsDeregistration,TRIGGER_IMS_DEREGISTRATION) \
typedef enum radio_ims_req {
RADIO_IMS_REQ_ANY = 0,
RADIO_IMS_REQ_NONE = 0,
#define RADIO_IMS_REQ_(req,resp,Name,NAME) RADIO_IMS_REQ_##NAME = req,
/* android.hardware.radio.ims.IRadioIms v1 */
RADIO_IMS_CALL_1(RADIO_IMS_REQ_)
RADIO_IMS_REQ_SET_RESPONSE_FUNCTIONS = 6, /* setResponseFunctions */
RADIO_IMS_1_REQ_LAST = RADIO_IMS_REQ_UPDATE_IMS_CALL_STATUS,
#undef RADIO_IMS_REQ_
} RADIO_IMS_REQ;
G_STATIC_ASSERT(sizeof(RADIO_IMS_REQ) == 4);
typedef enum radio_ims_resp {
RADIO_IMS_RESP_ANY = 0,
RADIO_IMS_RESP_NONE = 0,
#define RADIO_IMS_RESP_(req,resp,Name,NAME) RADIO_IMS_RESP_##NAME = resp,
/* android.hardware.radio.ims.IRadioImsResponse v1 */
RADIO_IMS_CALL_1(RADIO_IMS_RESP_)
RADIO_IMS_1_RESP_LAST = RADIO_IMS_RESP_UPDATE_IMS_CALL_STATUS,
#undef RADIO_IMS_RESP_
} RADIO_IMS_RESP;
G_STATIC_ASSERT(sizeof(RADIO_IMS_RESP) == 4);
typedef enum radio_ims_ind {
RADIO_IMS_IND_ANY = 0,
RADIO_IMS_IND_NONE = 0,
#define RADIO_IMS_IND_(code,Name,NAME) RADIO_IMS_IND_##NAME = code,
/* android.hardware.radio.ims.IRadioImsIndication v1 */
RADIO_IMS_IND_1(RADIO_IMS_IND_)
RADIO_IMS_1_IND_LAST = RADIO_IMS_IND_TRIGGER_IMS_DEREGISTRATION,
#undef RADIO_IMS_IND_
} RADIO_IMS_IND;
G_STATIC_ASSERT(sizeof(RADIO_IMS_IND) == 4);
G_END_DECLS
#endif /* RADIO_IMS_TYPES_H */
/*
* Local Variables:
* mode: C
* c-basic-offset: 4
* indent-tabs-mode: nil
* End:
*/

View File

@@ -39,6 +39,7 @@
#include <radio_types.h> #include <radio_types.h>
#include <radio_data_types.h> #include <radio_data_types.h>
#include <radio_ims_types.h>
#include <radio_messaging_types.h> #include <radio_messaging_types.h>
#include <radio_modem_types.h> #include <radio_modem_types.h>
#include <radio_network_types.h> #include <radio_network_types.h>

View File

@@ -69,7 +69,7 @@ typedef enum radio_interface {
typedef enum radio_aidl_interface { typedef enum radio_aidl_interface {
RADIO_AIDL_INTERFACE_NONE = -1, RADIO_AIDL_INTERFACE_NONE = -1,
RADIO_DATA_INTERFACE, RADIO_DATA_INTERFACE,
// RADIO_IMS_INTERFACE, RADIO_IMS_INTERFACE,
RADIO_MESSAGING_INTERFACE, RADIO_MESSAGING_INTERFACE,
RADIO_MODEM_INTERFACE, RADIO_MODEM_INTERFACE,
RADIO_NETWORK_INTERFACE, RADIO_NETWORK_INTERFACE,

View File

@@ -185,6 +185,7 @@ G_STATIC_ASSERT(G_N_ELEMENTS(radio_interfaces) == RADIO_INTERFACE_COUNT);
static const GBinderClientIfaceInfo radio_aidl_iface_info[] = { static const GBinderClientIfaceInfo radio_aidl_iface_info[] = {
{RADIO_DATA, RADIO_DATA_1_REQ_LAST}, {RADIO_DATA, RADIO_DATA_1_REQ_LAST},
{RADIO_IMS, RADIO_IMS_1_REQ_LAST},
{RADIO_MESSAGING, RADIO_MESSAGING_1_REQ_LAST}, {RADIO_MESSAGING, RADIO_MESSAGING_1_REQ_LAST},
{RADIO_MODEM, RADIO_MODEM_1_REQ_LAST}, {RADIO_MODEM, RADIO_MODEM_1_REQ_LAST},
{RADIO_NETWORK, RADIO_NETWORK_1_REQ_LAST}, {RADIO_NETWORK, RADIO_NETWORK_1_REQ_LAST},
@@ -202,6 +203,16 @@ static const char* const radio_data_response_ifaces[] = {
NULL NULL
}; };
static const char* const radio_ims_indication_ifaces[] = {
RADIO_IMS_INDICATION,
NULL
};
static const char* const radio_ims_response_ifaces[] = {
RADIO_IMS_RESPONSE,
NULL
};
static const char* const radio_messaging_indication_ifaces[] = { static const char* const radio_messaging_indication_ifaces[] = {
RADIO_MESSAGING_INDICATION, RADIO_MESSAGING_INDICATION,
NULL NULL
@@ -261,6 +272,14 @@ static const RadioInterfaceDesc radio_aidl_interfaces[] = {
radio_data_response_ifaces, radio_data_response_ifaces,
RADIO_DATA_REQ_SET_RESPONSE_FUNCTIONS, RADIO_DATA_REQ_SET_RESPONSE_FUNCTIONS,
}, },
{
RADIO_INTERFACE_NONE,
RADIO_IMS_INTERFACE,
RADIO_IMS,
radio_ims_indication_ifaces,
radio_ims_response_ifaces,
RADIO_IMS_REQ_SET_RESPONSE_FUNCTIONS,
},
{ {
RADIO_INTERFACE_NONE, RADIO_INTERFACE_NONE,
RADIO_MESSAGING_INTERFACE, RADIO_MESSAGING_INTERFACE,
@@ -408,6 +427,7 @@ radio_instance_indication(
if (gutil_strv_contains((const GStrV*)radio_indication_ifaces, iface) if (gutil_strv_contains((const GStrV*)radio_indication_ifaces, iface)
|| gutil_strv_contains((const GStrV*)radio_data_indication_ifaces, iface) || gutil_strv_contains((const GStrV*)radio_data_indication_ifaces, iface)
|| gutil_strv_contains((const GStrV*)radio_ims_indication_ifaces, iface)
|| gutil_strv_contains((const GStrV*)radio_messaging_indication_ifaces, iface) || gutil_strv_contains((const GStrV*)radio_messaging_indication_ifaces, iface)
|| gutil_strv_contains((const GStrV*)radio_modem_indication_ifaces, iface) || gutil_strv_contains((const GStrV*)radio_modem_indication_ifaces, iface)
|| gutil_strv_contains((const GStrV*)radio_network_indication_ifaces, iface) || gutil_strv_contains((const GStrV*)radio_network_indication_ifaces, iface)
@@ -521,6 +541,13 @@ radio_instance_response(
info = gbinder_reader_read_parcelable(&reader, &out_size); info = gbinder_reader_read_parcelable(&reader, &out_size);
GASSERT(out_size >= sizeof(RadioResponseInfo)); GASSERT(out_size >= sizeof(RadioResponseInfo));
} }
} else if (gutil_strv_contains((const GStrV*)radio_ims_response_ifaces, iface)) {
{
/* RadioResponseInfo has the same fields/padding between HIDL and AIDL */
gsize out_size;
info = gbinder_reader_read_parcelable(&reader, &out_size);
GASSERT(out_size >= sizeof(RadioResponseInfo));
}
} else if (gutil_strv_contains((const GStrV*)radio_messaging_response_ifaces, iface)) { } else if (gutil_strv_contains((const GStrV*)radio_messaging_response_ifaces, iface)) {
if (code == RADIO_MESSAGING_RESP_ACKNOWLEDGE_REQUEST) { if (code == RADIO_MESSAGING_RESP_ACKNOWLEDGE_REQUEST) {
gbinder_reader_read_int32(&reader, &ack_serial); gbinder_reader_read_int32(&reader, &ack_serial);

View File

@@ -101,6 +101,16 @@ radio_req_name2(
case RADIO_DATA_REQ_ANY: case RADIO_DATA_REQ_ANY:
break; break;
} }
} else if (instance->interface_aidl == RADIO_IMS_INTERFACE) {
switch ((RADIO_IMS_REQ)req) {
#define RADIO_IMS_REQ_(req,resp,Name,NAME) \
case RADIO_IMS_REQ_##NAME: return #Name;
RADIO_IMS_CALL_1(RADIO_IMS_REQ_)
#undef RADIO_IMS_REQ_
case RADIO_IMS_REQ_SET_RESPONSE_FUNCTIONS: return "setResponseFunctions";
case RADIO_IMS_REQ_ANY:
break;
}
} else if (instance->interface_aidl == RADIO_MESSAGING_INTERFACE) { } else if (instance->interface_aidl == RADIO_MESSAGING_INTERFACE) {
switch ((RADIO_MESSAGING_REQ)req) { switch ((RADIO_MESSAGING_REQ)req) {
#define RADIO_MESSAGING_REQ_(req,resp,Name,NAME) \ #define RADIO_MESSAGING_REQ_(req,resp,Name,NAME) \
@@ -227,6 +237,15 @@ radio_resp_name2(
case RADIO_DATA_RESP_ANY: case RADIO_DATA_RESP_ANY:
break; break;
} }
} else if (instance->interface_aidl == RADIO_IMS_INTERFACE) {
switch ((RADIO_IMS_RESP)resp) {
#define RADIO_IMS_RESP_(req,resp,Name,NAME) \
case RADIO_IMS_RESP_##NAME: return #Name "Response";
RADIO_IMS_CALL_1(RADIO_IMS_RESP_)
#undef RADIO_IMS_RESP_
case RADIO_IMS_RESP_ANY:
break;
}
} else if (instance->interface_aidl == RADIO_MESSAGING_INTERFACE) { } else if (instance->interface_aidl == RADIO_MESSAGING_INTERFACE) {
switch ((RADIO_MESSAGING_RESP)resp) { switch ((RADIO_MESSAGING_RESP)resp) {
case RADIO_MESSAGING_RESP_ACKNOWLEDGE_REQUEST: return "acknowledgeRequest"; case RADIO_MESSAGING_RESP_ACKNOWLEDGE_REQUEST: return "acknowledgeRequest";
@@ -316,6 +335,15 @@ radio_ind_name2(
case RADIO_DATA_IND_ANY: case RADIO_DATA_IND_ANY:
break; break;
} }
} else if (instance->interface_aidl == RADIO_IMS_INTERFACE) {
switch ((RADIO_IMS_IND)ind) {
#define RADIO_IMS_IND_(code,Name,NAME) \
case RADIO_IMS_IND_##NAME: return #Name;
RADIO_IMS_IND_1(RADIO_IMS_IND_)
#undef RADIO_IMS_IND_
case RADIO_IMS_IND_ANY:
break;
}
} else if (instance->interface_aidl == RADIO_MESSAGING_INTERFACE) { } else if (instance->interface_aidl == RADIO_MESSAGING_INTERFACE) {
switch ((RADIO_MESSAGING_IND)ind) { switch ((RADIO_MESSAGING_IND)ind) {
#define RADIO_MESSAGING_IND_(code,Name,NAME) \ #define RADIO_MESSAGING_IND_(code,Name,NAME) \