/* SPDX-License-Identifier: BSD-3-Clause */
/*
 * Copyright 2022 Raritan Inc. All rights reserved.
 */

#ifndef __DSAMDEVICE_IDL__
#define __DSAMDEVICE_IDL__

#include <DsamPort.idl>

module dsam {

    /** DSAM device interface */
    interface DsamDevice {

        /** Success code */
        constant int SUCCESS = 0;

        /** Firmware version */
        structure FirmwareVersion {
            int major;                          ///< major version number
            int minor;                          ///< minor version number
        };

        /** DSAm device info */
        structure Info {
            int dsamNumber;                     ///< DSAM number (1-based)
            string serialNumber;                ///< DSAM serial number
            int portCount;                      ///< Number of ports on the DSAM
            int hardwareVersion;                ///< Hardware version number
            FirmwareVersion firmwareVersion;    ///< Firmware version
        };

        /**
         * Get DSAM device info
         *
         * @return DSAM device info
         */
        Info getInfo();

        /**
         * Retrieve the current DSAM ports.
         *
         * @return Map with DSAM ports. Index is the port number (1-based).
         */
        map<int, DsamPort> getPorts();

        /**
         * Start firmware update on the DSAM device.
         *
         * @return SUCCESS if no error occured
         */
        int startFirmwareUpdate();
    };

}

#endif // __DSAMDEVICE_IDL__
