Skip to content

readHardwareConfig

Read the hardware configuration

kotlin
// serial driver
private lateinit var driver: UBoard

fun your_method() {
    cc.uling.usdk.board.mdb.para.HCReplyPara().apply {
        driver.readHardwareConfig(this)
    }.let {
        if (it.isOK) {
            println("isWithCoin: ${it.isWithCoin}, isWithCash: ${it.isWithCash}, isWithPOS: ${it.isWithPOS}, isWithPulse: ${it.isWithPulse}, isWithIdentify: ${it.isWithIdentify}, code: ${it.code}")
        }
    }
}

HCReplyPara Attribute Description

AttributeTypeDefault ValueDescription
versionIntHardware Version
withCoinboolCoin Acceptor
withCashboolBill Validator
withPOSboolPOS Machine
withPulseboolPulse Payment
withIdentifyboolIdentity Recognition
codeboolCurrency Code, e.g., Chinese Yuan (CNY) 0086, US Dollar (USD) 0001.

Note: Fields starting with with* may have a value of false, indicating that the current vending machine is not equipped with this hardware device.

If the payment hardware device is not equipped, you can use a QR code or other payment systems.

ReadHardwareConfig

Query the hardware version of the driver board.

kotlin
// The slave addr, by default, is 1. 
// If you have a vending machine is combo type, the addr may vary.
var addr = 1
HCReplyPara(addr).apply {
    driver.ReadHardwareConfig(this)
}.apply {
    if (this.isOK) {
        println("row: ${this.row}, col: ${this.col}")
    }
}

HCReplyPara Attribute Description

AttributeTypeDefault ValueDescription
versionstringHardware Version Number
rowintNumber of Channels
columnintNumber of Columns

This refers to the maximum number of channels supported by the current hardware. By default, it starts from 0, and the maximum value is (row * column -1).

eg: row is 10, column is 10, it starts from 0, the maximum value is 99.

Channels List
Layer 10123456789
Layer 210111213141516171819
Layer 320212223242526272829
Layer 430313233343536373839
Layer 540414243444546474849
Layer 650515253545556575859
Layer 760616263646566676869
Layer 870717273747576777879
Layer 980818283848586878889
Layer 1090919293949596979899

© All rights reserved. Dingshang Metal Products Co., Ltd.