Change in osmo-remsim[master]: rspro_util: Add functions generating {Bank, Client}SlotStatusInd

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

laforge gerrit-no-reply at lists.osmocom.org
Tue Dec 17 12:41:34 UTC 2019


laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-remsim/+/16620 )

Change subject: rspro_util: Add functions generating {Bank,Client}SlotStatusInd
......................................................................

rspro_util: Add functions generating {Bank,Client}SlotStatusInd

Change-Id: Ib07d397d80310f94dd6357b895455a1897e01cf3
---
M src/rspro_util.c
M src/rspro_util.h
2 files changed, 84 insertions(+), 0 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



diff --git a/src/rspro_util.c b/src/rspro_util.c
index 422aef4..1d95aee 100644
--- a/src/rspro_util.c
+++ b/src/rspro_util.c
@@ -385,6 +385,84 @@
 	return pdu;
 }
 
+RsproPDU_t *rspro_gen_BankSlotStatusInd(const BankSlot_t *bank, const ClientSlot_t *client,
+					bool rst_active, int vcc_present, int clk_active,
+					int card_present)
+{
+	SlotPhysStatus_t *pstatus;
+	RsproPDU_t *pdu = CALLOC(1, sizeof(*pdu));
+	if (!pdu)
+		return NULL;
+	pdu->version = 2;
+	pdu->msg.present = RsproPDUchoice_PR_bankSlotStatusInd;
+	OSMO_ASSERT(bank);
+	pdu->msg.choice.bankSlotStatusInd.fromBankSlot = *bank;
+	OSMO_ASSERT(client)
+	pdu->msg.choice.bankSlotStatusInd.toClientSlot = *client;
+
+	pstatus = &pdu->msg.choice.bankSlotStatusInd.slotPhysStatus;
+	pstatus->resetActive = rst_active ? 1 : 0;
+
+	if (vcc_present >= 0) {
+		pstatus->vccPresent = CALLOC(1, sizeof(BOOLEAN_t));
+		OSMO_ASSERT(pstatus->vccPresent);
+		*pstatus->vccPresent = vcc_present;
+	}
+
+	if (clk_active >= 0) {
+		pstatus->clkActive = CALLOC(1, sizeof(BOOLEAN_t));
+		OSMO_ASSERT(pstatus->clkActive);
+		*pstatus->clkActive = clk_active;
+	}
+
+	if (card_present >= 0) {
+		pstatus->cardPresent = CALLOC(1, sizeof(BOOLEAN_t));
+		OSMO_ASSERT(pstatus->cardPresent);
+		*pstatus->cardPresent = card_present;
+	}
+
+	return pdu;
+}
+
+RsproPDU_t *rspro_gen_ClientSlotStatusInd(const ClientSlot_t *client, const BankSlot_t *bank,
+					  bool rst_active, int vcc_present, int clk_active,
+					  int card_present)
+{
+	SlotPhysStatus_t *pstatus;
+	RsproPDU_t *pdu = CALLOC(1, sizeof(*pdu));
+	if (!pdu)
+		return NULL;
+	pdu->version = 2;
+	pdu->msg.present = RsproPDUchoice_PR_clientSlotStatusInd;
+	OSMO_ASSERT(client)
+	pdu->msg.choice.clientSlotStatusInd.fromClientSlot = *client;
+	OSMO_ASSERT(bank);
+	pdu->msg.choice.clientSlotStatusInd.toBankSlot = *bank;
+
+	pstatus = &pdu->msg.choice.clientSlotStatusInd.slotPhysStatus;
+	pstatus->resetActive = rst_active ? 1 : 0;
+
+	if (vcc_present >= 0) {
+		pstatus->vccPresent = CALLOC(1, sizeof(BOOLEAN_t));
+		OSMO_ASSERT(pstatus->vccPresent);
+		*pstatus->vccPresent = vcc_present;
+	}
+
+	if (clk_active >= 0) {
+		pstatus->clkActive = CALLOC(1, sizeof(BOOLEAN_t));
+		OSMO_ASSERT(pstatus->clkActive);
+		*pstatus->clkActive = clk_active;
+	}
+
+	if (card_present >= 0) {
+		pstatus->cardPresent = CALLOC(1, sizeof(BOOLEAN_t));
+		OSMO_ASSERT(pstatus->cardPresent);
+		*pstatus->cardPresent = card_present;
+	}
+
+	return pdu;
+}
+
 RsproPDU_t *rspro_gen_ResetStateReq(void)
 {
 	RsproPDU_t *pdu = CALLOC(1, sizeof(*pdu));
diff --git a/src/rspro_util.h b/src/rspro_util.h
index 8c6ae3b..3c5de0d 100644
--- a/src/rspro_util.h
+++ b/src/rspro_util.h
@@ -42,6 +42,12 @@
 				     const uint8_t *tpdu, unsigned int tpdu_len);
 RsproPDU_t *rspro_gen_TpduCard2Modem(const BankSlot_t *bank, const ClientSlot_t *client,
 				     const uint8_t *tpdu, unsigned int tpdu_len);
+RsproPDU_t *rspro_gen_BankSlotStatusInd(const BankSlot_t *bank, const ClientSlot_t *client,
+					bool rst_active, int vcc_present, int clk_active,
+					int card_present);
+RsproPDU_t *rspro_gen_ClientSlotStatusInd(const ClientSlot_t *client, const BankSlot_t *bank,
+					  bool rst_active, int vcc_present, int clk_active,
+					  int card_present);
 RsproPDU_t *rspro_gen_ResetStateReq(void);
 RsproPDU_t *rspro_gen_ResetStateRes(e_ResultCode res);
 

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-remsim/+/16620
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-remsim
Gerrit-Branch: master
Gerrit-Change-Id: Ib07d397d80310f94dd6357b895455a1897e01cf3
Gerrit-Change-Number: 16620
Gerrit-PatchSet: 3
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20191217/390b52c6/attachment.htm>


More information about the gerrit-log mailing list