<p>laforge has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/osmo-remsim/+/16620">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">rspro_util: Add functions generating {Bank,Client}SlotStatusInd<br><br>Change-Id: Ib07d397d80310f94dd6357b895455a1897e01cf3<br>---<br>M src/rspro_util.c<br>M src/rspro_util.h<br>2 files changed, 84 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/osmo-remsim refs/changes/20/16620/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/rspro_util.c b/src/rspro_util.c</span><br><span>index 422aef4..1d95aee 100644</span><br><span>--- a/src/rspro_util.c</span><br><span>+++ b/src/rspro_util.c</span><br><span>@@ -385,6 +385,84 @@</span><br><span>         return pdu;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+RsproPDU_t *rspro_gen_BankSlotStatusInd(const BankSlot_t *bank, const ClientSlot_t *client,</span><br><span style="color: hsl(120, 100%, 40%);">+                                     bool rst_active, int vcc_present, int clk_active,</span><br><span style="color: hsl(120, 100%, 40%);">+                                     int card_present)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+  SlotPhysStatus_t *pstatus;</span><br><span style="color: hsl(120, 100%, 40%);">+    RsproPDU_t *pdu = CALLOC(1, sizeof(*pdu));</span><br><span style="color: hsl(120, 100%, 40%);">+    if (!pdu)</span><br><span style="color: hsl(120, 100%, 40%);">+             return NULL;</span><br><span style="color: hsl(120, 100%, 40%);">+  pdu->version = 2;</span><br><span style="color: hsl(120, 100%, 40%);">+  pdu->msg.present = RsproPDUchoice_PR_bankSlotStatusInd;</span><br><span style="color: hsl(120, 100%, 40%);">+    OSMO_ASSERT(bank);</span><br><span style="color: hsl(120, 100%, 40%);">+    pdu->msg.choice.bankSlotStatusInd.fromBankSlot = *bank;</span><br><span style="color: hsl(120, 100%, 40%);">+    OSMO_ASSERT(client)</span><br><span style="color: hsl(120, 100%, 40%);">+   pdu->msg.choice.bankSlotStatusInd.toClientSlot = *client;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+        pstatus = &pdu->msg.choice.bankSlotStatusInd.slotPhysStatus;</span><br><span style="color: hsl(120, 100%, 40%);">+   pstatus->resetActive = rst_active ? 1 : 0;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+       if (vcc_present >= 0) {</span><br><span style="color: hsl(120, 100%, 40%);">+            pstatus->vccPresent = CALLOC(1, sizeof(BOOLEAN_t));</span><br><span style="color: hsl(120, 100%, 40%);">+                OSMO_ASSERT(pstatus->vccPresent);</span><br><span style="color: hsl(120, 100%, 40%);">+          *pstatus->vccPresent = vcc_present;</span><br><span style="color: hsl(120, 100%, 40%);">+        }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+   if (clk_active >= 0) {</span><br><span style="color: hsl(120, 100%, 40%);">+             pstatus->clkActive = CALLOC(1, sizeof(BOOLEAN_t));</span><br><span style="color: hsl(120, 100%, 40%);">+         OSMO_ASSERT(pstatus->clkActive);</span><br><span style="color: hsl(120, 100%, 40%);">+           *pstatus->clkActive = clk_active;</span><br><span style="color: hsl(120, 100%, 40%);">+  }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+   if (card_present >= 0) {</span><br><span style="color: hsl(120, 100%, 40%);">+           pstatus->cardPresent = CALLOC(1, sizeof(BOOLEAN_t));</span><br><span style="color: hsl(120, 100%, 40%);">+               OSMO_ASSERT(pstatus->cardPresent);</span><br><span style="color: hsl(120, 100%, 40%);">+         *pstatus->cardPresent = card_present;</span><br><span style="color: hsl(120, 100%, 40%);">+      }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+   return pdu;</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+RsproPDU_t *rspro_gen_ClientSlotStatusInd(const ClientSlot_t *client, const BankSlot_t *bank,</span><br><span style="color: hsl(120, 100%, 40%);">+                                         bool rst_active, int vcc_present, int clk_active,</span><br><span style="color: hsl(120, 100%, 40%);">+                                     int card_present)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+        SlotPhysStatus_t *pstatus;</span><br><span style="color: hsl(120, 100%, 40%);">+    RsproPDU_t *pdu = CALLOC(1, sizeof(*pdu));</span><br><span style="color: hsl(120, 100%, 40%);">+    if (!pdu)</span><br><span style="color: hsl(120, 100%, 40%);">+             return NULL;</span><br><span style="color: hsl(120, 100%, 40%);">+  pdu->version = 2;</span><br><span style="color: hsl(120, 100%, 40%);">+  pdu->msg.present = RsproPDUchoice_PR_clientSlotStatusInd;</span><br><span style="color: hsl(120, 100%, 40%);">+  OSMO_ASSERT(client)</span><br><span style="color: hsl(120, 100%, 40%);">+   pdu->msg.choice.clientSlotStatusInd.fromClientSlot = *client;</span><br><span style="color: hsl(120, 100%, 40%);">+      OSMO_ASSERT(bank);</span><br><span style="color: hsl(120, 100%, 40%);">+    pdu->msg.choice.clientSlotStatusInd.toBankSlot = *bank;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  pstatus = &pdu->msg.choice.clientSlotStatusInd.slotPhysStatus;</span><br><span style="color: hsl(120, 100%, 40%);">+ pstatus->resetActive = rst_active ? 1 : 0;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+       if (vcc_present >= 0) {</span><br><span style="color: hsl(120, 100%, 40%);">+            pstatus->vccPresent = CALLOC(1, sizeof(BOOLEAN_t));</span><br><span style="color: hsl(120, 100%, 40%);">+                OSMO_ASSERT(pstatus->vccPresent);</span><br><span style="color: hsl(120, 100%, 40%);">+          *pstatus->vccPresent = vcc_present;</span><br><span style="color: hsl(120, 100%, 40%);">+        }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+   if (clk_active >= 0) {</span><br><span style="color: hsl(120, 100%, 40%);">+             pstatus->clkActive = CALLOC(1, sizeof(BOOLEAN_t));</span><br><span style="color: hsl(120, 100%, 40%);">+         OSMO_ASSERT(pstatus->clkActive);</span><br><span style="color: hsl(120, 100%, 40%);">+           *pstatus->clkActive = clk_active;</span><br><span style="color: hsl(120, 100%, 40%);">+  }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+   if (card_present >= 0) {</span><br><span style="color: hsl(120, 100%, 40%);">+           pstatus->cardPresent = CALLOC(1, sizeof(BOOLEAN_t));</span><br><span style="color: hsl(120, 100%, 40%);">+               OSMO_ASSERT(pstatus->cardPresent);</span><br><span style="color: hsl(120, 100%, 40%);">+         *pstatus->cardPresent = card_present;</span><br><span style="color: hsl(120, 100%, 40%);">+      }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+   return pdu;</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> RsproPDU_t *rspro_gen_ResetStateReq(void)</span><br><span> {</span><br><span>   RsproPDU_t *pdu = CALLOC(1, sizeof(*pdu));</span><br><span>diff --git a/src/rspro_util.h b/src/rspro_util.h</span><br><span>index 8c6ae3b..3c5de0d 100644</span><br><span>--- a/src/rspro_util.h</span><br><span>+++ b/src/rspro_util.h</span><br><span>@@ -42,6 +42,12 @@</span><br><span>                                      const uint8_t *tpdu, unsigned int tpdu_len);</span><br><span> RsproPDU_t *rspro_gen_TpduCard2Modem(const BankSlot_t *bank, const ClientSlot_t *client,</span><br><span>                                     const uint8_t *tpdu, unsigned int tpdu_len);</span><br><span style="color: hsl(120, 100%, 40%);">+RsproPDU_t *rspro_gen_BankSlotStatusInd(const BankSlot_t *bank, const ClientSlot_t *client,</span><br><span style="color: hsl(120, 100%, 40%);">+                                        bool rst_active, int vcc_present, int clk_active,</span><br><span style="color: hsl(120, 100%, 40%);">+                                     int card_present);</span><br><span style="color: hsl(120, 100%, 40%);">+RsproPDU_t *rspro_gen_ClientSlotStatusInd(const ClientSlot_t *client, const BankSlot_t *bank,</span><br><span style="color: hsl(120, 100%, 40%);">+                                       bool rst_active, int vcc_present, int clk_active,</span><br><span style="color: hsl(120, 100%, 40%);">+                                     int card_present);</span><br><span> RsproPDU_t *rspro_gen_ResetStateReq(void);</span><br><span> RsproPDU_t *rspro_gen_ResetStateRes(e_ResultCode res);</span><br><span> </span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-remsim/+/16620">change 16620</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/c/osmo-remsim/+/16620"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-remsim </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: Ib07d397d80310f94dd6357b895455a1897e01cf3 </div>
<div style="display:none"> Gerrit-Change-Number: 16620 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: laforge <laforge@osmocom.org> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>