remsim_client: Store and use BankSlot received in ConfigClientBankReq

Change-Id: I6858b68590789d38741e541b9028d2b9b142e0c0
diff --git a/src/client.h b/src/client.h
index dae53a2..5df5e67 100644
--- a/src/client.h
+++ b/src/client.h
@@ -6,6 +6,7 @@
 
 #include "rspro_util.h"
 #include "rspro_client_fsm.h"
+#include "slotmap.h"
 #include "debug.h"
 
 /* fsm.c */
@@ -32,6 +33,7 @@
 	/* connection to the remsim-bankd */
 	char *bankd_host;
 	uint16_t bankd_port;
+	struct bank_slot bankd_slot;
 	struct ipa_client_conn *bankd_conn;
 	struct osmo_fsm_inst *bankd_fi;
 };
diff --git a/src/remsim_client.c b/src/remsim_client.c
index b31a849..0fb9f21 100644
--- a/src/remsim_client.c
+++ b/src/remsim_client.c
@@ -143,8 +143,7 @@
 		osmo_talloc_replace_string(g_client, &g_client->bankd_host,
 					   rspro_IpAddr2str(&pdu->msg.choice.configClientBankReq.bankd.ip));
 		g_client->bankd_port = ntohs(pdu->msg.choice.configClientBankReq.bankd.port);
-		/* FIXME: Store bankslot */
-		//*g_client->srv_conn.bslot = pdu->msg.choice.configClientBankReq.bankSlot;
+		rspro2bank_slot(&g_client->bankd_slot, &pdu->msg.choice.configClientBankReq.bankSlot);
 		/* instruct bankd FSM to connect */
 		osmo_fsm_inst_dispatch(g_client->bankd_fi, BDC_E_ESTABLISH, NULL);
 		/* send response to server */
diff --git a/src/simtrace2-remsim_client.c b/src/simtrace2-remsim_client.c
index f15bdfe..2780682 100644
--- a/src/simtrace2-remsim_client.c
+++ b/src/simtrace2-remsim_client.c
@@ -427,7 +427,9 @@
 			memcpy(apdu_command + sizeof(ac.hdr), ac.dc, ac.lc.tot); // copy APDU command data 
 		}
 		// send APDU to card
-		RsproPDU_t *pdu = rspro_gen_TpduModem2Card(g_client->srv_conn.clslot, &(BankSlot_t){ .bankId = 0, .slotNr = 0}, apdu_command, sizeof(ac.hdr) + ac.lc.tot); // create RSPRO packet
+		BankSlot_t bslot;
+		bank_slot2rspro(&bslot, &g_client->bankd_slot);
+		RsproPDU_t *pdu = rspro_gen_TpduModem2Card(g_client->srv_conn.clslot, &bslot, apdu_command, sizeof(ac.hdr) + ac.lc.tot); // create RSPRO packet
 		ipa_client_conn_send_rspro(g_client->bankd_conn, pdu); // send RSPRO packet
 		// the response will come separately
 		free(apdu_command);
@@ -632,8 +634,7 @@
 		/* store/set the bankd ip/port as instructed by the server */
 		osmo_talloc_replace_string(g_client, &g_client->bankd_host,
 					   rspro_IpAddr2str(&pdu->msg.choice.configClientBankReq.bankd.ip));
-		/* FIXME: Store bankslot */
-		//g_client->bankd_slot = pdu->msg.choice.configClientBankReq.bankSlot;
+		rspro2bank_slot(&g_client->bankd_slot, &pdu->msg.choice.configClientBankReq.bankSlot);
 		g_client->bankd_port = ntohs(pdu->msg.choice.configClientBankReq.bankd.port);
 		/* instruct bankd FSM to connect */
 		osmo_fsm_inst_dispatch(g_client->bankd_fi, BDC_E_ESTABLISH, NULL);