Files
FireAlarmCtrlCn/MyCode/Gui/CanNetworkRegister.h
2026-04-06 19:02:09 +08:00

231 lines
8.3 KiB
C++

#ifndef CNANETWORKREGISTER_H_
#define CNANETWORKREGISTER_H_
#include "gType.h"
#include "GraphBase.h"
#include "string.h"
#include "my_string.h"
#include "Device.h"
#include "EpDevice.h"
#include "StaticText.h"
#include "CtlPanel1.h"
class TCanNetworkRegister{
public:
static constexpr unsigned short hList[12] = {36,36,72,72, 72,72,34,34, 34,34,34,34};
static constexpr unsigned short wList[12] = {800,800,800,290, 290,290,290,290, 290,290,290,290};
static constexpr TLv Lv = {
.Caption.Left = 0,
.Caption.Top = 36,
.Caption.Width = 800,
.Caption.Heigh = 32,
.Caption.Right = 800 -0 -1,
.Caption.Bottom = 36 + 32,
.Grid.Left = {0,0,0,0, 0,0,0,0, 0,0,0,0},
.Grid.Right = {wList[0]-1,wList[1]-1,wList[2]-1,wList[3]-1, wList[4]-1,wList[5]-1,wList[6]-1,wList[7]-1, wList[8]-1,wList[9]-1,wList[10]-1,wList[11]-1},
.Grid.Top[0] = (36 + 32 +2),
.Grid.Top[1] = (36 + 32 +2) + (2 + hList[0]),
.Grid.Top[2] = (36 + 32 +2) + (2 + hList[0]) + (2 + hList[1]),
.Grid.Top[3] = (36 + 32 +2) + (2 + hList[0]) + (2 + hList[1]) + (2 + hList[2]),
.Grid.Top[4] = (36 + 32 +2) + (2 + hList[0]) + (2 + hList[1]) + (2 + hList[2]) + (2 + hList[3]),
.Grid.Top[5] = (36 + 32 +2) + (2 + hList[0]) + (2 + hList[1]) + (2 + hList[2]) + (2 + hList[3]) + (2 + hList[4]),
.Grid.Top[6] = (36 + 32 +2) + (2 + hList[0]) + (2 + hList[1]) + (2 + hList[2]) + (2 + hList[3]) + (2 + hList[4]) + (2 + hList[5]),
.Grid.Top[7] = (36 + 32 +2) + (2 + hList[0]) + (2 + hList[1]) + (2 + hList[2]) + (2 + hList[3]) + (2 + hList[4]) + (2 + hList[5]) + (2 + hList[6]),
.Grid.Top[8] = (36 + 32 +2) + (2 + hList[0]) + (2 + hList[1]) + (2 + hList[2]) + (2 + hList[3]) + (2 + hList[4]) + (2 + hList[5]) + (2 + hList[6]) + (2 + hList[7]),
.Grid.Top[9] = (36 + 32 +2) + (2 + hList[0]) + (2 + hList[1]) + (2 + hList[2]) + (2 + hList[3]) + (2 + hList[4]) + (2 + hList[5]) + (2 + hList[6]) + (2 + hList[7]) + (2 + hList[8]),
.Grid.Top[10] = (36 + 32 +2) + (2 + hList[0]) + (2 + hList[1]) + (2 + hList[2]) + (2 + hList[3]) + (2 + hList[4]) + (2 + hList[5]) + (2 + hList[6]) + (2 + hList[7]) + (2 + hList[8]) + (2 + hList[9]),
.Grid.Top[11] = (36 + 32 +2) + (2 + hList[0]) + (2 + hList[1]) + (2 + hList[2]) + (2 + hList[3]) + (2 + hList[4]) + (2 + hList[5]) + (2 + hList[6]) + (2 + hList[7]) + (2 + hList[8]) + (2 + hList[9]) + (2 + hList[10]),
.Grid.Bottom[0] = (36 + 32 +2) + hList[0],
.Grid.Bottom[1] = (36 + 32 +2) + (2 + hList[0]) + hList[1],
.Grid.Bottom[2] = (36 + 32 +2) + (2 + hList[0]) + (2 + hList[1]) + hList[2],
.Grid.Bottom[3] = (36 + 32 +2) + (2 + hList[0]) + (2 + hList[1]) + (2 + hList[2]) + hList[3],
.Grid.Bottom[4] = (36 + 32 +2) + (2 + hList[0]) + (2 + hList[1]) + (2 + hList[2]) + (2 + hList[3]) + hList[4],
.Grid.Bottom[5] = (36 + 32 +2) + (2 + hList[0]) + (2 + hList[1]) + (2 + hList[2]) + (2 + hList[3]) + (2 + hList[4]) + hList[5],
.Grid.Bottom[6] = (36 + 32 +2) + (2 + hList[0]) + (2 + hList[1]) + (2 + hList[2]) + (2 + hList[3]) + (2 + hList[4]) + (2 + hList[5]) + hList[6],
.Grid.Bottom[7] = (36 + 32 +2) + (2 + hList[0]) + (2 + hList[1]) + (2 + hList[2]) + (2 + hList[3]) + (2 + hList[4]) + (2 + hList[5]) + (2 + hList[6]) + hList[7],
.Grid.Bottom[8] = (36 + 32 +2) + (2 + hList[0]) + (2 + hList[1]) + (2 + hList[2]) + (2 + hList[3]) + (2 + hList[4]) + (2 + hList[5]) + (2 + hList[6]) + (2 + hList[7]) + hList[8],
.Grid.Bottom[9] = (36 + 32 +2) + (2 + hList[0]) + (2 + hList[1]) + (2 + hList[2]) + (2 + hList[3]) + (2 + hList[4]) + (2 + hList[5]) + (2 + hList[6]) + (2 + hList[7]) + (2 + hList[8]) + hList[9],
.Grid.Bottom[10] = (36 + 32 +2) + (2 + hList[0]) + (2 + hList[1]) + (2 + hList[2]) + (2 + hList[3]) + (2 + hList[4]) + (2 + hList[5]) + (2 + hList[6]) + (2 + hList[7]) + (2 + hList[8]) + (2 + hList[9]) + hList[10],
.Grid.Bottom[11] = (36 + 32 +2) + (2 + hList[0]) + (2 + hList[1]) + (2 + hList[2]) + (2 + hList[3]) + (2 + hList[4]) + (2 + hList[5]) + (2 + hList[6]) + (2 + hList[7]) + (2 + hList[8]) + (2 + hList[9]) + (2 + hList[10]) + hList[11],
.Grid.UsingCount = 3,
.Panel.Active = 1,
.Panel.ItemType = piMemo,
.Panel.Left = 0 + 2,
.Panel.Top = (36 + 36 +2) + (2 + hList[0]) + (2 + hList[1]) + hList[2] +2,
.Panel.Width = 796,
.Panel.Heigh = 216,
.Panel.Right = 0 + 2 + 796 -1,
.Panel.Bottom = (36 + 36 +2) + (2 + hList[0]) + (2 + hList[1]) + hList[2] +2 + 216 -1,
.PanelSmall.Active = 0,
.PanelSmall.Left = 0 + 6,
.PanelSmall.Top = (36 + 36 +2) + hList[0] +6 + 220 -1 + 3,
.PanelSmall.Width = 788,
.PanelSmall.Heigh = 70,
.PanelSmall.Right = 0 + 6 + 788 -1,
.PanelSmall.Bottom = (36 + 36 +2) + hList[0] +6 + 220 -1 + 1 + 70 -1,
};
static constexpr TPoint ResultTipPoint = {
.x = Lv.Grid.Left[6] + 10,
.y = Lv.Grid.Top[6] + 8,
};
typedef enum{
Idle =0,
Searching =1,
QueMaster =2,
QueSlaver =3,
}TListWhat;
public:
int IsShowing;
int IsOnSearching;
class TItemList *IList;
unsigned char CtlIndex;
unsigned char ListX;
unsigned char ListY;
unsigned char IsPermission;
unsigned char PermissionCmd;
unsigned char MyNum;
unsigned char SearchStartNum;
unsigned char SearchEndNum;
unsigned char GoStartNum;
unsigned char GoEndNum;
unsigned char GoCount;
unsigned char MyNumValid;
unsigned char Start2EndNumValid;
unsigned char Count;
unsigned char CountMater;
unsigned char CountSlave;
unsigned char Done;
unsigned char TxDataByNetworkFind[12];
unsigned char RecData[12];
unsigned char Path;
unsigned char aNewGot;
unsigned char SearchNumExist;
unsigned char FoundIndex;
unsigned char SearchingNum;
unsigned char SearchingTick;
unsigned char RecBlock;
unsigned char IncMaster;
unsigned char LoadingIndex;
unsigned char LoadingNum;
unsigned char CtlList[dNETWORK_MACHINE_COUNT];
unsigned char CtlSelectedList[dNETWORK_MACHINE_COUNT];
unsigned char MasterList[dNETWORK_MACHINE_MASTER_COUNT];
unsigned char MasterListRec[dNETWORK_MACHINE_MASTER_COUNT];
unsigned char MasterListCount;
unsigned char MasterListCountRec;
unsigned char MasterListRecPiece;
char Text[68];
char ShowingSavingMyNum;
char JustShowingSaving;
char SelectedList;
unsigned char ListDrewIndex;
unsigned char GroupSelected;
TListWhat ListWhat;
public:
TCanNetworkRegister(){};
void Init();
void SetAndShowCaption(unsigned char aType);
void RenderBackGround(void);
void RenderBackGround(unsigned int aClr);
void DrawSelf(void);
void DrawCtlNum();
void DrawNetworkMode();
void ClearOutText();
static void sDelayMs(unsigned int aMs);
void Show(void);
void ShowCaption();
void ReDraw(void);
void FullRedraw(int Prm);
void DrawIdfText();
void DrawFixText();
void DrawListDeSelected();
void DrawListSelected();
void RedrawList();
void DrawListTitle();
void DrawSearchingItem(int aInx);
void DrawMasterItem(int aInx);
void DrawSlaverItem(int aInx);
void DrawSearchingList(int MaxInx=(dNETWORK_MACHINE_COUNT));
void DrawMasterList(int MaxInx=(dNETWORK_MACHINE_COUNT));
void DrawSlaverList(int MaxInx=(dNETWORK_MACHINE_COUNT));
void ShowSearchCompleted();
void ShowSaveMyNum(int aPrm);
void DoListSelectAll(unsigned char aCtlType);
void DoGroupSelect();
void SetGroupSelected(unsigned char aCtlType);
void ClearData();
void LoadData2Last();
void SendAskType(unsigned char aNum);
void SendAskDescp(unsigned char aNum);
TGuiMsgReturn KeyIn(unsigned char aKey);
void ClearSelected();
void Check4Selected(void);
unsigned char GetRecType(unsigned char aNum);
unsigned char CheckRecTypeAva(unsigned char aNum);
unsigned char CheckDescpAva(unsigned char aNum);
unsigned char GetCtlCount();
void Task1000Ms();
void SendfNetMsg(unsigned char aSubCmd, unsigned char *data, int Len);
void PushfNetMsg(unsigned char aSubCmd, unsigned char *data, int Len);
void PortExistGet(unsigned char aNum, unsigned char aP0, unsigned char aExist);
int CheckData(int SaveWhat);
void PermissionCmdReturnDraw();
void PermissionCmdGO();
void SaveMasterList(unsigned char aCnt, unsigned char *aList);
void SaveSlaverList();
void SendMasterList(unsigned char aCnt, unsigned char *aList);
void SendClearMasterList(unsigned char aCnt, unsigned char *aList);
void SendNwList();
static void sReadNetMode();
int CheckStart2EndNumValid();
static void sRecoverSetDefault();
int ExtRequst(unsigned char Prm);
};
#endif