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.
69 lines
1.5 KiB
69 lines
1.5 KiB
#if 0
|
|
typedef struct {
|
|
uint8_t pid;
|
|
uint16_t bid;
|
|
|
|
int32_t oldPosX;
|
|
int32_t oldPosY;
|
|
|
|
bool isVis;
|
|
bool isPosInited;
|
|
bool isUsed;
|
|
} component_info_t;
|
|
|
|
component_info_t component_info[100] = {0};
|
|
|
|
static component_info_t* findComponent(uint8_t pid, uint16_t bid) {
|
|
for (size_t i = 0; i < 100; i++) {
|
|
if (component_info[i].isUsed && component_info[i].pid == pid && component_info[i].bid == bid) {
|
|
return &component_info[i];
|
|
}
|
|
}
|
|
return NULL;
|
|
}
|
|
|
|
static component_info_t* allocComponent(uint8_t pid, uint16_t bid) {
|
|
for (size_t i = 0; i < 100; i++) {
|
|
if (!component_info[i].isUsed) {
|
|
component_info[i].isUsed = true;
|
|
component_info[i].pid = pid;
|
|
component_info[i].bid = bid;
|
|
return &component_info[i];
|
|
}
|
|
}
|
|
return NULL;
|
|
}
|
|
|
|
static component_info_t* forceFindComponent(uint8_t pid, uint16_t bid) {
|
|
component_info_t* info = findComponent(pid, bid);
|
|
if (info == NULL) {
|
|
info = allocComponent(pid, bid);
|
|
}
|
|
return info;
|
|
}
|
|
|
|
bool UIControler::visEx(uint16_t pid, uint16_t bid, bool val) {
|
|
component_info_t* component = forceFindComponent(pid, bid);
|
|
if (component == NULL) {
|
|
ZLOGW(TAG, "visEx failed,component alloc failed");
|
|
return false;
|
|
}
|
|
|
|
bool suc = false;
|
|
|
|
do {
|
|
if (val) {
|
|
// ÏÔʾ
|
|
} else {
|
|
// Òþ²Ø
|
|
|
|
if (!component->isPosInited) {
|
|
suc = readInt(pid, bid, &component->oldPosX);
|
|
if (!suc) break;
|
|
|
|
suc = readInt(pid, bid + 1, &component->oldPosY);
|
|
}
|
|
}
|
|
} while (false);
|
|
}
|
|
#endif
|