interface.js 4.63 KB
/**
 * @fileOverview 指令配置文件
 * @author qiqi.zhou@yoho.cn
 * @module interface
 */

/**
 * @var {Object} 通用返回信息
 */
var commonMessage = {
    '00': {
        code: 1,
        message: '操作成功'
    },
    'ffff': {
        code: 0,
        message: '没有响应'
    },
    'fffe': {
        code: 3,
        message: '读写器正忙'
    },
    'ff0': {
        code: -1,
        message: '操作失败'
    }
};

/**
 * 指令集枚举
 * @exports default
 */
export default {
    openUhf: {
        directive: 'uhf',
        input: 'A000000000',
        output: {
            'a0200': commonMessage['00'],
            'a02ff0': commonMessage.ff0,
            'a02f00': {
                code: 2,
                message: 'UHF模块已打开'
            }
        }
    },
    closeUhf: {
        directive: 'uhf',
        input: 'A100000000',
        output: {
            'a1200': commonMessage['00'],
            'a12ff0': commonMessage.ff0
        }
    },
    setPower: {
        directive: 'config',
        input: 'F3',
        output: {
            'f3200': commonMessage['00'],
            'f32ffff': commonMessage.ffff,
            'f32fffe': commonMessage.fffe,
            'f32ff0': commonMessage.ff0
        }
    },
    setFilter: {
        directive: 'config',
        input: 'B7',
        output: {
            'b7200': commonMessage['00'],
            'b72ffff': commonMessage.ffff,
            'b72fffe': commonMessage.fffe,
            'b72ff0': commonMessage.ff0
        }
    },
    setAntStayTime: {
        directive: 'config',
        input: 'CA',
        output: {
            'ca200': commonMessage['00'],
            'ca2ffff': commonMessage.ffff,
            'ca2fffe': commonMessage.fffe,
            'ca2ff0': commonMessage.ff0
        }
    },
    setFrequency: {
        directive: 'config',
        input: 'BF',
        output: {
            'bf200': commonMessage['00'],
            'bf2ffff': commonMessage.ffff,
            'bf2fffe': commonMessage.fffe,
            'bf2ff0': commonMessage.ff0
        }
    },
    setFrequencyRegion: {
        directive: 'config',
        input: 'F5',
        output: {
            'f5200': commonMessage['00'],
            'f52ffff': commonMessage.ffff,
            'f52fffe': commonMessage.fffe,
            'f52ff0': commonMessage.ff0
        }
    },
    setSpeedMode: {
        directive: 'config',
        input: 'FA',
        output: {
            'fa200': commonMessage['00'],
            'fa2ffff': commonMessage.ffff,
            'fa2fffe': commonMessage.fffe,
            'fa2ff0': commonMessage.ff0
        }
    },
    setTagGroup: {
        directive: 'config',
        input: 'B6',
        output: {
            'b6200': commonMessage['00'],
            'b62ffff': commonMessage.ffff,
            'b62fffe': commonMessage.fffe,
            'b62ff0': commonMessage.ff0
        }
    },
    getConfig: {
        directive: 'uhf',
        input: 'B300000000',
        output: {
            'b3200': commonMessage['00'],
            'b32ffff': commonMessage.ffff,
            'b32fffe': commonMessage.fffe,
            'b316': {
                code: 1,
                message: '返回信息'
            }
        }
    },
    getVersion: {
        directive: 'uhf',
        input: 'B400000000',
        output: {
            'b4400': commonMessage['00'],
            'b44ffff': commonMessage.ffff,
            'b44fffe': commonMessage.fffe,
            'b44ff0': commonMessage.ff0
        }
    },
    startInventory: {
        directive: 'inventory',
        input: 'F100000000',
        output: {
            'f1200': commonMessage['00'],
            'f12ffff': commonMessage.ffff,
            'f12fffe': commonMessage.fffe,
            'f1': {
                code: 2,
                message: '返回信息'
            },
            '41': {
                code: 3,
                message: '不明飞行物'
            },
            'f1239': {
                code: 889,
                message: '未知错误'
            },
            'f12014': {
                code: 890,
                message: '连接失败'
            }
        }

    },
    stopInventory: {
        directive: 'inventory',
        input: 'F200000000',
        output: {
            'f2200': commonMessage['00'],
            'f22ffff': commonMessage.ffff,
            'f22fffe': commonMessage.fffe,
            'f22ff0': commonMessage.ff0
        }
    },
    setInventoryTime: {
        directive: 'inventory',
        input: 'B0',
        output: {
            'b0200': commonMessage['00'],
            'b02ffff': commonMessage.ffff,
            'b02fffe': commonMessage.fffe,
            'b02ff0': commonMessage.ff0
        }
    }
};