Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ca59e7f3 authored by Amit Mahajan's avatar Amit Mahajan Committed by Gerrit Code Review
Browse files

Merge "Add p2 option in OpenLogicalChannel"

parents 085aca0e beb64d67
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1285,10 +1285,11 @@ interface IRadio {
     *
     * @param serial Serial number of request.
     * @param aid AID value, See ETSI 102.221 and 101.220.
     * @param p2 P2 value, described in ISO 7816-4. Ignore if equal to P2Constant:NO_P2
     *
     * Response callback is IRadioResponse.iccOpenLogicalChannelResponse()
     */
    oneway iccOpenLogicalChannel(int32_t serial, string aid);
    oneway iccOpenLogicalChannel(int32_t serial, string aid, int32_t p2);

    /**
     * Close a previously opened logical channel. This command reflects TS 27.007
+4 −0
Original line number Diff line number Diff line
@@ -1161,6 +1161,10 @@ enum DeviceStateType : int32_t {
                                          // this doesn't mean no data is expected.
};

enum P2Constant : int32_t {
    NO_P2 = -1,                           // No P2 value is provided
};

struct RadioResponseInfo {
    RadioResponseType type;               // Response type
    int32_t serial;                       // Serial number of the request
+4 −3
Original line number Diff line number Diff line
@@ -246,9 +246,10 @@ TEST_F(RadioHidlTest, iccTransmitApduBasicChannel) {
 */
TEST_F(RadioHidlTest, iccOpenLogicalChannel) {
  int serial = 1;

  int p2 = 0x04;
  // Specified in ISO 7816-4 clause 7.1.1 0x04 means that FCP template is requested.
  for (int i = 0; i < (int)cardStatus.applications.size(); i++) {
    radio->iccOpenLogicalChannel(++serial, cardStatus.applications[i].aidPtr);
    radio->iccOpenLogicalChannel(++serial, cardStatus.applications[i].aidPtr, p2);
    EXPECT_EQ(std::cv_status::no_timeout, wait());
    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);