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.
131 lines
2.5 KiB
131 lines
2.5 KiB
#pragma once
|
|
#include "uappbase/appcfg/appcfg.hpp"
|
|
#include "uappbase/appdep.hpp"
|
|
#include "uappbase/bean/bean.hpp"
|
|
//
|
|
#include "app_protocols/ble_through/ble_proto.h"
|
|
|
|
namespace iflytop {
|
|
using namespace std;
|
|
#define GSM GStateMgr::ins()
|
|
|
|
#define CH_NUM 4
|
|
|
|
class GStateMgr {
|
|
private:
|
|
bool m_powerOn = true;
|
|
|
|
/**
|
|
* @brief 用户状态
|
|
*/
|
|
char m_loginUsr[MAX_USR_NAME_SIZE + 1];
|
|
int m_loginUsrId = -1;
|
|
user_role_t m_loginUsrType = kuser;
|
|
bool m_isLogin = false;
|
|
|
|
/**
|
|
* @brief 遥控器状态
|
|
*/
|
|
int32_t m_RemoterS; // 遥控器状态 1:在线,0:离线
|
|
char m_RemoterName[20];
|
|
|
|
/**
|
|
* @brief 设备工作状态
|
|
*/
|
|
hand_acid_mode_t m_RunMode = khand_acid_m_jog_mode; // 运行模式
|
|
bool m_pumpSelectState[CH_NUM] = {false}; // 选择的泵
|
|
|
|
/**
|
|
* @brief 统计数据
|
|
*/
|
|
float acidUsed[CH_NUM] = {0.0};
|
|
float acidRemain[CH_NUM] = {0.0};
|
|
|
|
zmutex m_mutex = {"GStateMgr"};
|
|
public:
|
|
bool supperAdmin = false;
|
|
|
|
public:
|
|
static GStateMgr* ins() {
|
|
static GStateMgr instance;
|
|
return &instance;
|
|
}
|
|
|
|
void initialize();
|
|
|
|
/**
|
|
* @brief powerOn
|
|
*
|
|
*/
|
|
|
|
void setPowerOn(bool state) { m_powerOn = state; }
|
|
bool getPowerOn() { return m_powerOn; }
|
|
|
|
/**
|
|
* @brief 用户状态
|
|
*/
|
|
|
|
void setLogin(int loginUsrId, const char* usrName, user_role_t role);
|
|
void setUnLogin();
|
|
|
|
bool isLogin();
|
|
user_role_t getLoginUsrType();
|
|
const char* getLoginUsr();
|
|
int getUserId();
|
|
|
|
/**
|
|
* @brief 遥控器状态
|
|
*/
|
|
|
|
void setRemoterS(int32_t state, const char* name);
|
|
void setRemoterHeart(int32_t state, uint8_t * name);
|
|
const char* getRemoterName();
|
|
|
|
/**
|
|
* @brief 设备工作状态
|
|
*/
|
|
void setRunMode(hand_acid_mode_t mode);
|
|
void changeToNextRunMode();
|
|
void setPumpSelectState(int32_t index, bool state);
|
|
|
|
int32_t getRemoterS();
|
|
hand_acid_mode_t getRunMode();
|
|
bool isHasPumpSelect();
|
|
bool getPumpSelectState(int32_t index);
|
|
|
|
/**
|
|
* @brief 统计数据
|
|
*/
|
|
|
|
/**
|
|
* @brief
|
|
*
|
|
*
|
|
* 1.剩余量:
|
|
* .补酸时修改
|
|
* .用酸时修改
|
|
*
|
|
* 2.使用量:
|
|
* .登录时初始化为零
|
|
* .使用时候修改,实时存储
|
|
* .登出时清零,并存储
|
|
*
|
|
* 相关数据库
|
|
* .总量
|
|
* .使用记录
|
|
*
|
|
* 1.
|
|
*
|
|
*/
|
|
|
|
void setAcidRemain(int32_t index, float val);
|
|
void setAcidUsed(int32_t index, float val);
|
|
|
|
float getAcidRemain(int32_t index);
|
|
float getAcidUsed(int32_t index);
|
|
|
|
//
|
|
void placeHolder() {}
|
|
};
|
|
|
|
} // namespace iflytop
|