【问题标题】:How do I get the Cassette type information using XFS in an ATM?如何在 ATM 中使用 XFS 获取 Cassette 类型信息?
【发布时间】:2018-08-06 05:04:19
【问题描述】:

usNumber 表示序列号。 cUnitID 表示卡带标识符,但不同的供应商有不同的格式来表示它。我在哪里可以找到这种格式?还有其他地方可以获取逻辑现金单元标识符(类型号)

【问题讨论】:

  • 不知道你在追求什么,但要弄清楚某些事情。 cUnitID 只是提供一个 ID。 usNumber 是遍历它们。 usType 告诉这个盒子可以做什么(分配、存放、回收、收回、拒绝等)。没有一种模具可以使用。您需要收集所有信息,然后开始决定如何处理这些信息。哦,由于一个逻辑磁带可以包含多个物理磁带,您当然希望遍历这些磁带。解析物理磁带位置 (lpPhysicalPositionName),您可能会猜到,但文档是关键。

标签: c cen-xfs


【解决方案1】:

首先,我不知道你的意思是“不同的格式”。由 wosa/xfs 库定义的usType。 以下定义来自 Xfscdm.h,它们是固定的。

/* values of WFSCDMCASHUNIT.usType */
#define     WFS_CDM_TYPENA                      (1)
#define     WFS_CDM_TYPEREJECTCASSETTE          (2)
#define     WFS_CDM_TYPEBILLCASSETTE            (3)
#define     WFS_CDM_TYPECOINCYLINDER            (4)
#define     WFS_CDM_TYPECOINDISPENSER           (5)
#define     WFS_CDM_TYPERETRACTCASSETTE         (6)
#define     WFS_CDM_TYPECOUPON                  (7)
#define     WFS_CDM_TYPEDOCUMENT                (8)
#define     WFS_CDM_TYPEREPCONTAINER           (11)
#define     WFS_CDM_TYPERECYCLING              (12)

无论如何,以下功能可以帮助您获取现金单元信息:

#include "Xfsapi.h"
#include "Xfscdm.h"

HRESULT getCashUnitInfo();
HSERVICE hService;
USHORT cashUnitCount;   // Number of Logical Cash Units
LPWFSCDMCASHUNIT cashUnitInfo[6];
int main()
{
    if(getCashUnitInfo()==WFS_SUCCESS) {
        printf("Get CashUnit Info Failed\n");
        return -1;
    }
    printf("Get Cash Unit Info Success.\n");

    return 0;
}

HRESULT getCashUnitInfo()
{
    LPWFSRESULT result;
    HRESULT r;
    r=WFSGetInfo(hService, WFS_INF_CDM_CASH_UNIT_INFO, NULL,20000, &result );
    if ( r == WFS_SUCCESS) {
        LPWFSCDMCUINFO cuInfo =  (LPWFSCDMCUINFO)result->lpBuffer;
        cashUnitCount = cuInfo->usCount;
        ZF_LOGI("m_CashUnitCount:%d",cashUnitCount);

        LPWFSCDMCASHUNIT * lppList = cuInfo->lppList;
        for ( int i = 0; i < cuInfo->usCount; ++i ) {
            USHORT no = lppList[i]->usNumber -1;
            if (cashUnitInfo[no] == NULL)
                cashUnitInfo[no] = new WFSCDMCASHUNIT();

            //Copy logical Cash Unit info
            memcpy(cashUnitInfo[no], lppList[i], sizeof(WFSCDMCASHUNIT) );
            printf("m_CashUnitInfo[%d]->bAppLock----------------->%d\n",i,cashUnitInfo[no]->bAppLock);
            printf("m_CashUnitInfo[%d]->bDevLock----------------->%d\n",i,cashUnitInfo[no]->bDevLock);
            printf("m_CashUnitInfo[%d]->cCurrencyID-------------->%s\n",i,cashUnitInfo[no]->cCurrencyID);
            printf("m_CashUnitInfo[%d]->cUnitID------------------>%s\n",i,cashUnitInfo[no]->cUnitID);
            printf("m_CashUnitInfo[%d]->lpszCashUnitName--------->%s\n",i,cashUnitInfo[no]->lpszCashUnitName);
            printf("m_CashUnitInfo[%d]->ulCount------------------>%ld\n",i,cashUnitInfo[no]->ulCount);
            printf("m_CashUnitInfo[%d]->ulInitialCount----------->%ld\n",i,cashUnitInfo[no]->ulInitialCount);
            printf("m_CashUnitInfo[%d]->ulMaximum---------------->%ld\n",i,cashUnitInfo[no]->ulMaximum);
            printf("m_CashUnitInfo[%d]->ulMinimum---------------->%ld\n",i,cashUnitInfo[no]->ulMinimum);
            printf("m_CashUnitInfo[%d]->ulRejectCount------------>%ld\n",i,cashUnitInfo[no]->ulRejectCount);
            printf("m_CashUnitInfo[%d]->ulValues----------------->%ld\n",i,cashUnitInfo[no]->ulValues);
            printf("m_CashUnitInfo[%d]->usNumber----------------->%hu\n",i,cashUnitInfo[no]->usNumber);
            printf("m_CashUnitInfo[%d]->usStatus----------------->%hu\n",i,cashUnitInfo[no]->usStatus);
            printf("m_CashUnitInfo[%d]->usType------------------->%hu\n",i,cashUnitInfo[no]->usType);
            printf("m_CashUnitInfo[%d]->usNumPhysicalCUs--------->%hu\n",i,cashUnitInfo[no]->usNumPhysicalCUs);
            printf("--------------------------------------------------------------------------------------------------\n");
        }
    }
    WFSFreeResult( result );
    printf("RESULT:%d\n",r);
    return r;
}

【讨论】:

    【解决方案2】:

    除了建议的答案之外,不要忘记分配足够的内存来打印结果,例如 r = WFMAllocateMore(sizeof(WFSCDMCASHUNIT), result, (void**)&cashUnitInfo[no]);

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-06-08
      • 2019-10-08
      • 1970-01-01
      • 2017-07-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多