From ebc67c74ff5a699b4205ef3d534733211adfeec5 Mon Sep 17 00:00:00 2001
From: marcofilho <marco.filho@ess.eu>
Date: Fri, 3 Jan 2025 14:41:26 +0100
Subject: [PATCH] Add SC, SL, STH, SM and SMX parameters.

Didn't add SD because the mechanism is a bit different.
---
 vmmTblApp/src/vmm_tbl.cpp | 85 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/vmmTblApp/src/vmm_tbl.cpp b/vmmTblApp/src/vmm_tbl.cpp
index b2c535e..d890ff7 100644
--- a/vmmTblApp/src/vmm_tbl.cpp
+++ b/vmmTblApp/src/vmm_tbl.cpp
@@ -286,6 +286,24 @@ asynStatus VMMTbl::readInt8Array(asynUser *pasynUser, epicsInt8 *value, size_t n
 
   if (function < FIRST_VMM_PARAM) return asynPortDriver::readInt8Array(pasynUser, value, nElements, nIn);
 
+  found_param = VecUtils::getIndex(vmmSC_, function, hyb_index, vmm_index);
+  if (found_param == 0) {
+    for (size_t i = 0; i < nElements; i++) {
+      status |= (int)this->pVmmAPI->getSC(hyb_index, vmm_index, i, data);
+      value[i] = data;
+    }
+    goto endOfReadInt8Array;
+  }
+
+  found_param = VecUtils::getIndex(vmmSL_, function, hyb_index, vmm_index);
+  if (found_param == 0) {
+    for (size_t i = 0; i < nElements; i++) {
+      status |= (int)this->pVmmAPI->getSL(hyb_index, vmm_index, i, data);
+      value[i] = data;
+    }
+    goto endOfReadInt8Array;
+  }
+
   found_param = VecUtils::getIndex(vmmST_, function, hyb_index, vmm_index);
   if (found_param == 0) {
     for (size_t i = 0; i < nElements; i++) {
@@ -295,6 +313,33 @@ asynStatus VMMTbl::readInt8Array(asynUser *pasynUser, epicsInt8 *value, size_t n
     goto endOfReadInt8Array;
   }
 
+  found_param = VecUtils::getIndex(vmmSTH_, function, hyb_index, vmm_index);
+  if (found_param == 0) {
+    for (size_t i = 0; i < nElements; i++) {
+      status |= (int)this->pVmmAPI->getSTH(hyb_index, vmm_index, i, data);
+      value[i] = data;
+    }
+    goto endOfReadInt8Array;
+  }
+
+  found_param = VecUtils::getIndex(vmmSM_, function, hyb_index, vmm_index);
+  if (found_param == 0) {
+    for (size_t i = 0; i < nElements; i++) {
+      status |= (int)this->pVmmAPI->getSM(hyb_index, vmm_index, i, data);
+      value[i] = data;
+    }
+    goto endOfReadInt8Array;
+  }
+
+  found_param = VecUtils::getIndex(vmmSMX_, function, hyb_index, vmm_index);
+  if (found_param == 0) {
+    for (size_t i = 0; i < nElements; i++) {
+      status |= (int)this->pVmmAPI->getSMX(hyb_index, vmm_index, i, data);
+      value[i] = data;
+    }
+    goto endOfReadInt8Array;
+  }
+
   endOfReadInt8Array:
   if (found_param != 0) {
     asynPrint(pasynUserSelf, ASYN_TRACE_ERROR,
@@ -328,6 +373,22 @@ asynStatus VMMTbl::writeInt8Array(asynUser *pasynUser, epicsInt8 *value, size_t
 
   if (function < FIRST_VMM_PARAM) return asynPortDriver::writeInt8Array(pasynUser, value, nElements);
 
+  found_param = VecUtils::getIndex(vmmSC_, function, hyb_index, vmm_index);
+  if (found_param == 0) {
+    for (size_t i = 0; i < nElements; i++) {
+      status |= (int)this->pVmmAPI->setSC(hyb_index, vmm_index, i, (bool)value[i]);
+    }
+    goto endOfWriteInt8Array;
+  }
+
+  found_param = VecUtils::getIndex(vmmSL_, function, hyb_index, vmm_index);
+  if (found_param == 0) {
+    for (size_t i = 0; i < nElements; i++) {
+      status |= (int)this->pVmmAPI->setSL(hyb_index, vmm_index, i, (bool)value[i]);
+    }
+    goto endOfWriteInt8Array;
+  }
+
   found_param = VecUtils::getIndex(vmmST_, function, hyb_index, vmm_index);
   if (found_param == 0) {
     for (size_t i = 0; i < nElements; i++) {
@@ -336,6 +397,30 @@ asynStatus VMMTbl::writeInt8Array(asynUser *pasynUser, epicsInt8 *value, size_t
     goto endOfWriteInt8Array;
   }
 
+  found_param = VecUtils::getIndex(vmmSTH_, function, hyb_index, vmm_index);
+  if (found_param == 0) {
+    for (size_t i = 0; i < nElements; i++) {
+      status |= (int)this->pVmmAPI->setSTH(hyb_index, vmm_index, i, (bool)value[i]);
+    }
+    goto endOfWriteInt8Array;
+  }
+
+  found_param = VecUtils::getIndex(vmmSM_, function, hyb_index, vmm_index);
+  if (found_param == 0) {
+    for (size_t i = 0; i < nElements; i++) {
+      status |= (int)this->pVmmAPI->setSM(hyb_index, vmm_index, i, (bool)value[i]);
+    }
+    goto endOfWriteInt8Array;
+  }
+
+  found_param = VecUtils::getIndex(vmmSMX_, function, hyb_index, vmm_index);
+  if (found_param == 0) {
+    for (size_t i = 0; i < nElements; i++) {
+      status |= (int)this->pVmmAPI->setSMX(hyb_index, vmm_index, i, (bool)value[i]);
+    }
+    goto endOfWriteInt8Array;
+  }
+
   endOfWriteInt8Array:
   status |= (int)doCallbacksInt8Array(value, nElements, function, 0); // Comparing different statuses, yes.
   if (found_param != 0) {
-- 
GitLab