forked from gzt/A8000
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
166 lines
4.0 KiB
166 lines
4.0 KiB
//声明设备控制系列接口
|
|
import apiClient from '../../utils/axios'
|
|
|
|
//开始
|
|
export const startWork = async () => {
|
|
try {
|
|
const res = await apiClient.post('/api/v1/app/deviceCtrl/startWork')
|
|
return res.data
|
|
} catch (error) {
|
|
console.log('设备启动报错', error)
|
|
}
|
|
}
|
|
|
|
//暂停
|
|
export const pauseWork = async () => {
|
|
try {
|
|
const res = await apiClient.post('/api/v1/app/deviceCtrl/pauseWork')
|
|
return res.data
|
|
} catch (error) {
|
|
console.log('设备暂停报错', error)
|
|
}
|
|
}
|
|
|
|
//继续
|
|
export const continueWork = async () => {
|
|
try {
|
|
const res = await apiClient.post('/api/v1/app/deviceCtrl/continueWork')
|
|
return res.data
|
|
} catch (error) {
|
|
console.log('设备继续报错', error)
|
|
}
|
|
}
|
|
|
|
//停止
|
|
export const stopWork = async () => {
|
|
try {
|
|
const res = await apiClient.post('/api/v1/app/deviceCtrl/stopWork')
|
|
return res.data
|
|
} catch (error) {
|
|
console.log('设备停止报错', error)
|
|
}
|
|
}
|
|
|
|
export const getDeviceWorkState = async () => {
|
|
try {
|
|
const res = await apiClient.post('/api/v1/app/deviceState/getDeviceWorkState')
|
|
return res.data
|
|
} catch (error) {
|
|
console.log('设备停止报错', error)
|
|
}
|
|
}
|
|
|
|
//获取设备信息
|
|
export const getDeviceIp = async () => {
|
|
try {
|
|
const res = await apiClient.post('/api/v1/app/osCtrl/getIp')
|
|
return res.data
|
|
} catch (error) {
|
|
console.log('设备信息获取报错', error)
|
|
}
|
|
}
|
|
export type DeviceInfo = {
|
|
appVersion: string;
|
|
mcuVersion: string;
|
|
sn: string;
|
|
ip: string;
|
|
assetId: string;
|
|
}
|
|
export const getDeviceInfo = async () => {
|
|
try {
|
|
const res = await apiClient.post('/api/v1/app/DeviceInfo/getDeviceInfo')
|
|
return res.data
|
|
} catch (error) {
|
|
console.log('设备信息获取报错', error)
|
|
}
|
|
}
|
|
|
|
//获取设备工作状态
|
|
export const getDeviceStatus = async () => {
|
|
try {
|
|
const res = await apiClient.post('/api/v1/app/osCtrl/getDeviceWorkState')
|
|
return res.data
|
|
} catch (error) {
|
|
console.log('设备状态获取报错', error)
|
|
}
|
|
}
|
|
|
|
//获取一个设备事件
|
|
export const pollAppEvent = async () => {
|
|
try {
|
|
const res = await apiClient.post('/api/v1/app/AppEventBus/pollAppEvent')
|
|
return res.data
|
|
} catch (error) {
|
|
console.log('单个设备事件获取报错', error)
|
|
}
|
|
}
|
|
|
|
//获取所有的事件
|
|
export const pollAllAppEvents = async () => {
|
|
try {
|
|
const res = await apiClient.post('/api/v1/app/AppEventBus/pollAllAppEvents')
|
|
return res.data
|
|
} catch (error) {
|
|
console.log('全部设备事件获取报错', error)
|
|
}
|
|
}
|
|
|
|
//蜂鸣器打开
|
|
export const openBuzzer = async () => {
|
|
try {
|
|
const res = await apiClient.post('/api/v1/app/osCtrl/startBeepWarning')
|
|
return res.data
|
|
} catch (error) {
|
|
console.log('蜂鸣器打开报错', error)
|
|
}
|
|
}
|
|
|
|
//蜂鸣器关闭
|
|
export const closeBuzzer = async () => {
|
|
try {
|
|
const res = await apiClient.post('/api/v1/app/osCtrl/stopBeepWarning')
|
|
return res.data
|
|
} catch (error) {
|
|
console.log('蜂鸣器关闭报错', error)
|
|
}
|
|
}
|
|
|
|
// 清除报警
|
|
export const clearFlagState = async (flagType: string) => {
|
|
try {
|
|
const res = await apiClient.post(`/api/v1/app/FlagStateMgr/clearFlagState?flagKey=${flagType}`)
|
|
return res.data
|
|
} catch (error) {
|
|
console.log('关闭报警失败', error)
|
|
}
|
|
}
|
|
|
|
// 清除所有报警
|
|
export const clearAllFlagState = async () => {
|
|
try {
|
|
const res = await apiClient.post(`/api/v1/app/FlagStateMgr/clearAllFlagState`)
|
|
return res.data
|
|
} catch (error) {
|
|
console.log('关闭报警失败', error)
|
|
}
|
|
}
|
|
|
|
//失通设备
|
|
export const disableDevice = async () => {
|
|
try {
|
|
const res = await apiClient.post(`/api/v1/app/deviceExCtrl/disableDevice`)
|
|
return res.data
|
|
} catch (error) {
|
|
console.log('失能设备失败', error)
|
|
}
|
|
}
|
|
|
|
// MCU详细版本信息
|
|
export const getMcuVersionDetailInfo = async () => {
|
|
try {
|
|
const res = await apiClient.post('/api/v1/app/DeviceInfo/getMcuVersionDetail')
|
|
return res.data
|
|
} catch (error) {
|
|
console.log('MCU详细版本信息获取报错', error)
|
|
}
|
|
}
|