import { getClient, createConnection, clientPublish, clientSubscribe } from '@/utils/mqtt';

export const debug_mode_openOptions = {
  canceled: '取消或终止',
  failed: '失败',
  in_progress: '执行中',
  ok: '执行成功',
  paused: '暂停',
  rejected: '拒绝',
  sent: '已下发',
  timeout: '超时',
};
export const cover_stateOptions = { '0': '关闭', '1': '打开', '2': '半开', '3': '舱盖状态异常' };
export const cover_opensStatus = {
  canceled: '取消或终止',
  failed: '失败',
  in_progress: '执行中',
  ok: '执行成功',
  paused: '暂停',
  rejected: '拒绝',
  sent: '已下发',
  timeout: '超时',
};
export const servicesTopic = (data) => {
  // 发送消息
  clientPublish('thing/product/8UUXN5400A079H/services', data);
};
export const services_replyTopic = () => {
  // 订阅消息
  clientSubscribe('thing/product/8UUXN5400A079H/services_reply');
};
// 无人机
export const servicesUAVTopic = (data) => {
  // 发送消息
  clientPublish('thing/product/1581F8HGX254V00A0BUY/services', data);
};
export const services_replyUAVTopic = () => {
  // 订阅消息
  clientSubscribe('thing/product/1581F8HGX254V00A0BUY/services_reply');
};
export const eventsTopic = (data) => {
  // 发送消息
  clientPublish('thing/product/8UUXN5400A079H/events', data);
};
export const events_replyTopic = () => {
  // 订阅消息
  clientSubscribe('thing/product/8UUXN5400A079H/events_reply');
};
export const drcDownTopic = (data) => {
  // 发送消息thing/product/{gateway_sn}/drc/down
  clientPublish('thing/product/8UUXN5400A079H/drc/down', data);
};

export const eventsTopicSubscribe = () => {
  // 发送消息
  clientSubscribe('thing/product/8UUXN5400A079H/events');
};
