bankd: Implement card reset based on clientSlotStatusInd

If a client is sending us a clientSlotStatusInd indicating that
the modem has switched off VCC or activated RST, bankd will
now issue a respective PC/SC command to perform a cold or warm
reset of the card.

Change-Id: Ifa615d239ec3ad6daebd8e99e4f7d5b99d32c0e1
Closes: OS#4330
diff --git a/src/bankd/bankd_main.c b/src/bankd/bankd_main.c
index af25ded..b3e38b3 100644
--- a/src/bankd/bankd_main.c
+++ b/src/bankd/bankd_main.c
@@ -727,6 +727,26 @@
 	return 0;
 }
 
+static int worker_handle_clientSlotStatusInd(struct bankd_worker *worker, const RsproPDU_t *pdu)
+{
+	const struct ClientSlotStatusInd *cssi = &pdu->msg.choice.clientSlotStatusInd;
+	const struct SlotPhysStatus *sps = &cssi->slotPhysStatus;
+	int rc = 0;
+
+	LOGW(worker, "clientSlotStatusInd(RST=%s, VCC=%s, CLK=%s)\n",
+		sps->resetActive ? "ACTIVE" : "INACTIVE",
+		sps->vccPresent ? *sps->vccPresent ? "PRESENT" : "ABSENT" : "NULL",
+		sps->clkActive ? *sps->clkActive ? "ACTIVE" : "INACTIVE" : "NULL");
+
+	/* perform cold or warm reset */
+	if (sps->vccPresent && *sps->vccPresent == 0)
+		rc = worker->ops->reset_card(worker, true);
+	else if (sps->resetActive)
+		rc = worker->ops->reset_card(worker, false);
+
+	return rc;
+}
+
 /* handle one incoming RSPRO message from a client inside a worker thread */
 static int worker_handle_rspro(struct bankd_worker *worker, const RsproPDU_t *pdu)
 {
@@ -742,7 +762,7 @@
 		rc = worker_handle_tpduModemToCard(worker, pdu);
 		break;
 	case RsproPDUchoice_PR_clientSlotStatusInd:
-		/* FIXME */
+		rc = worker_handle_clientSlotStatusInd(worker, pdu);
 		rc = 0;
 		break;
 	case RsproPDUchoice_PR_setAtrRes: