update
This commit is contained in:
parent
80eceabf9a
commit
0ad7bba107
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
#define MASTER_TCI_ALIVE 0x55
|
#define MASTER_TCI_ALIVE 0x55
|
||||||
#define MASTER_TCI_SEND_INTERVAL (1000*200) //sleep(1)
|
#define MASTER_TCI_SEND_INTERVAL (1000*200) //sleep(1)
|
||||||
|
//#define MASTER_TCI_SEND_INTERVAL (1000*10) //sleep(1)
|
||||||
#define TCI_CHANGE_FULL_CRITICAL 5
|
#define TCI_CHANGE_FULL_CRITICAL 5
|
||||||
|
|
||||||
#define NORMAL_MACHINE 0
|
#define NORMAL_MACHINE 0
|
||||||
|
@ -2911,6 +2911,7 @@ bool CRYDevice::publishAnalogData(int uid)
|
|||||||
datatime *= 1000;
|
datatime *= 1000;
|
||||||
root["dataTime"] = datatime;
|
root["dataTime"] = datatime;
|
||||||
root["deviceId"] = static_units[uid].deviceId;
|
root["deviceId"] = static_units[uid].deviceId;
|
||||||
|
// root["isStore"] = config.units[uid].state & 0x20 ? false : true;
|
||||||
|
|
||||||
if (values.size()) {
|
if (values.size()) {
|
||||||
root["values"] = values;
|
root["values"] = values;
|
||||||
@ -3221,15 +3222,9 @@ bool CRYDevice::ry_run(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
publishdeviceEventData();
|
publishdeviceEventData();
|
||||||
// int i = 0;
|
|
||||||
#if 1
|
|
||||||
for (int i = 0; i < UNIT_NUM; i++)
|
for (int i = 0; i < UNIT_NUM; i++)
|
||||||
{
|
{
|
||||||
#else
|
|
||||||
i = m_nCurUnit;
|
|
||||||
m_nCurUnit++;
|
|
||||||
if (m_nCurUnit >= UNIT_NUM) m_nCurUnit = 0;
|
|
||||||
#endif
|
|
||||||
if ((config.units[i].state & 0x01) != TRUE) continue;
|
if ((config.units[i].state & 0x01) != TRUE) continue;
|
||||||
if (config.units[i].type != MASTER_UNIT) continue;
|
if (config.units[i].type != MASTER_UNIT) continue;
|
||||||
MakeYKFrame(i);
|
MakeYKFrame(i);
|
||||||
@ -3238,9 +3233,9 @@ bool CRYDevice::ry_run(void)
|
|||||||
publishAnalogData(i);
|
publishAnalogData(i);
|
||||||
publishStateData(i);
|
publishStateData(i);
|
||||||
}
|
}
|
||||||
#if 1
|
usleep(300);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
return m_dataAcquisitionReload;
|
return m_dataAcquisitionReload;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1741,7 +1741,14 @@ void CProcess::Destroy(void)
|
|||||||
{
|
{
|
||||||
m_bRunFlag = FALSE;
|
m_bRunFlag = FALSE;
|
||||||
|
|
||||||
vLog(LOG_DEBUG, "waiting for protocol thread %d destroy.\n", m_nProcess);
|
char name[16];
|
||||||
|
memset(name, '\0', sizeof(name));
|
||||||
|
if (pthread_getname_np(m_pid, name, sizeof(name)) != 0)
|
||||||
|
{
|
||||||
|
memset(name, '\0', sizeof(name));
|
||||||
|
}
|
||||||
|
|
||||||
|
vLog(LOG_DEBUG, "waiting for protocol thread [%d,%s] destroy.\n", m_nProcess, (name[0] != '\0') ? name : "unknow");
|
||||||
pthread_join(m_pid, NULL);
|
pthread_join(m_pid, NULL);
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
@ -1750,7 +1757,7 @@ void CProcess::Destroy(void)
|
|||||||
DestroyItem(i, FALSE);
|
DestroyItem(i, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
vLog(LOG_DEBUG, "current protocol thread [%d] is destroyed.\n", m_nProcess);
|
vLog(LOG_DEBUG, "current protocol thread [%d,%s] is destroyed.\n", m_nProcess, (name[0] != '\0') ? name : "unknow");
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOLEAN CProcess::Run(void)
|
BOOLEAN CProcess::Run(void)
|
||||||
|
@ -2468,8 +2468,15 @@ BOOLEAN destroy_thread(void)
|
|||||||
{
|
{
|
||||||
if (p_id[i] != 0)
|
if (p_id[i] != 0)
|
||||||
{
|
{
|
||||||
vLog(LOG_DEBUG, "waiting for system thread [%d] destroy.\n", i);
|
char name[16];
|
||||||
|
memset(name, '\0', sizeof(name));
|
||||||
|
if (pthread_getname_np(p_id[i], name, sizeof(name)) != 0)
|
||||||
|
{
|
||||||
|
memset(name, '\0', sizeof(name));
|
||||||
|
}
|
||||||
|
vLog(LOG_DEBUG, "waiting for system thread [%d,%s] destroy.\n", i, (name[0] != '\0') ? name : "unknow");
|
||||||
pthread_join(p_id[i], NULL);
|
pthread_join(p_id[i], NULL);
|
||||||
|
vLog(LOG_DEBUG, "system protocol thread [%d,%s] is destroyed.\n", i, (name[0] != '\0') ? name : "unknow");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -638,7 +638,7 @@ CHostADSBFProcess::CHostADSBFProcess()
|
|||||||
m_remoteNetId = "192.168.0.2.1.1";
|
m_remoteNetId = "192.168.0.2.1.1";
|
||||||
|
|
||||||
//websocket接口
|
//websocket接口
|
||||||
m_pid = 0;
|
m_cpid = 0;
|
||||||
//目录无效
|
//目录无效
|
||||||
m_iv = 1;
|
m_iv = 1;
|
||||||
m_currentDirNo = -1; //当前目录编号
|
m_currentDirNo = -1; //当前目录编号
|
||||||
@ -664,6 +664,15 @@ CHostADSBFProcess::~CHostADSBFProcess()
|
|||||||
fwrite(&m_currentDirStartFileNo, sizeof(LONG), 1, pf);
|
fwrite(&m_currentDirStartFileNo, sizeof(LONG), 1, pf);
|
||||||
fclose(pf);
|
fclose(pf);
|
||||||
}
|
}
|
||||||
|
char name[16];
|
||||||
|
memset(name, '\0', sizeof(name));
|
||||||
|
if (pthread_getname_np(m_cpid, name, sizeof(name)) != 0)
|
||||||
|
{
|
||||||
|
memset(name, '\0', sizeof(name));
|
||||||
|
}
|
||||||
|
vLog(LOG_DEBUG, "waiting for child thread [%s] destroy.\n", (name[0] != '\0') ? name : "unknow");
|
||||||
|
pthread_join(m_cpid, NULL);
|
||||||
|
vLog(LOG_DEBUG, "child protocol thread [%s] is destroyed.\n", (name[0] != '\0') ? name : "unknow");
|
||||||
}
|
}
|
||||||
#if 0
|
#if 0
|
||||||
if (m_threadRun) {
|
if (m_threadRun) {
|
||||||
@ -875,7 +884,7 @@ BOOLEAN CHostADSBFProcess::OnPreCreate(int id)
|
|||||||
|
|
||||||
|
|
||||||
//启动后,创建ftp线程
|
//启动后,创建ftp线程
|
||||||
if (m_pid <= 0) {
|
if (m_cpid <= 0) {
|
||||||
m_bFtpRun = TRUE;
|
m_bFtpRun = TRUE;
|
||||||
vLog(LOG_DEBUG, "ads create a ftp thread.\n");
|
vLog(LOG_DEBUG, "ads create a ftp thread.\n");
|
||||||
|
|
||||||
@ -884,13 +893,13 @@ BOOLEAN CHostADSBFProcess::OnPreCreate(int id)
|
|||||||
pthread_attr_setstacksize(&attr, MEMERY_1M);
|
pthread_attr_setstacksize(&attr, MEMERY_1M);
|
||||||
pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM);
|
pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM);
|
||||||
|
|
||||||
if (pthread_create(&m_pid, &attr, ryftp_process, this) < 0) {
|
if (pthread_create(&m_cpid, &attr, ryftp_process, this) < 0) {
|
||||||
vLog(LOG_ERROR, "ads create ryftp_process error(%d,%s).\n", errno, strerror(errno));
|
vLog(LOG_ERROR, "ads create ryftp_process error(%d,%s).\n", errno, strerror(errno));
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
char name[17];
|
char name[17];
|
||||||
snprintf(name, 16, "%s_ftp", m_pidName.c_str());
|
snprintf(name, 16, "%s_ftp", m_pidName.c_str());
|
||||||
pthread_setname_np(m_pid, name);
|
pthread_setname_np(m_cpid, name);
|
||||||
|
|
||||||
pthread_attr_destroy(&attr);
|
pthread_attr_destroy(&attr);
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ private:
|
|||||||
struRYADSOption m_nOptions;
|
struRYADSOption m_nOptions;
|
||||||
|
|
||||||
//增加websocket连接
|
//增加websocket连接
|
||||||
pthread_t m_pid;
|
pthread_t m_cpid;
|
||||||
|
|
||||||
std::string m_localIp; //本机IP地址
|
std::string m_localIp; //本机IP地址
|
||||||
std::string m_localNetId; //本机IP地址
|
std::string m_localNetId; //本机IP地址
|
||||||
|
@ -756,7 +756,7 @@ CHostModbusTcpBFProcess::CHostModbusTcpBFProcess()
|
|||||||
m_nNeedSend = FALSE;
|
m_nNeedSend = FALSE;
|
||||||
|
|
||||||
//websocket接口
|
//websocket接口
|
||||||
m_pid = 0;
|
m_cpid = 0;
|
||||||
|
|
||||||
//目录无效
|
//目录无效
|
||||||
m_iv = 1;
|
m_iv = 1;
|
||||||
@ -784,6 +784,16 @@ CHostModbusTcpBFProcess::~CHostModbusTcpBFProcess()
|
|||||||
fwrite(&m_currentDirStartFileNo, sizeof(LONG), 1, pf);
|
fwrite(&m_currentDirStartFileNo, sizeof(LONG), 1, pf);
|
||||||
fclose(pf);
|
fclose(pf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char name[16];
|
||||||
|
memset(name, '\0', sizeof(name));
|
||||||
|
if (pthread_getname_np(m_cpid, name, sizeof(name)) != 0)
|
||||||
|
{
|
||||||
|
memset(name, '\0', sizeof(name));
|
||||||
|
}
|
||||||
|
vLog(LOG_DEBUG, "waiting for child thread [%s] destroy.\n", (name[0] != '\0') ? name : "unknow");
|
||||||
|
pthread_join(m_cpid, NULL);
|
||||||
|
vLog(LOG_DEBUG, "child protocol thread [%s] is destroyed.\n", (name[0] != '\0') ? name : "unknow");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1147,7 +1157,7 @@ BOOLEAN CHostModbusTcpBFProcess::OnPreCreate(int id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//启动后,创建ftp线程
|
//启动后,创建ftp线程
|
||||||
if (m_pid <= 0) {
|
if (m_cpid <= 0) {
|
||||||
m_bFtpRun = TRUE;
|
m_bFtpRun = TRUE;
|
||||||
vLog(LOG_DEBUG, "rymodbus create a ftp thread.\n");
|
vLog(LOG_DEBUG, "rymodbus create a ftp thread.\n");
|
||||||
|
|
||||||
@ -1156,13 +1166,13 @@ BOOLEAN CHostModbusTcpBFProcess::OnPreCreate(int id)
|
|||||||
pthread_attr_setstacksize(&attr, MEMERY_1M);
|
pthread_attr_setstacksize(&attr, MEMERY_1M);
|
||||||
pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM);
|
pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM);
|
||||||
|
|
||||||
if (pthread_create(&m_pid, &attr, ryftp_process, this) < 0) {
|
if (pthread_create(&m_cpid, &attr, ryftp_process, this) < 0) {
|
||||||
vLog(LOG_ERROR, "rymodbus create ryftp_process error(%d,%s).\n", errno, strerror(errno));
|
vLog(LOG_ERROR, "rymodbus create ryftp_process error(%d,%s).\n", errno, strerror(errno));
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
char name[17];
|
char name[17];
|
||||||
snprintf(name, 16, "%s_ftp", m_pidName.c_str());
|
snprintf(name, 16, "%s_ftp", m_pidName.c_str());
|
||||||
pthread_setname_np(m_pid, name);
|
pthread_setname_np(m_cpid, name);
|
||||||
|
|
||||||
pthread_attr_destroy(&attr);
|
pthread_attr_destroy(&attr);
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ private:
|
|||||||
|
|
||||||
struRYModbusOption m_nOptions;
|
struRYModbusOption m_nOptions;
|
||||||
//增加websocket连接
|
//增加websocket连接
|
||||||
pthread_t m_pid;
|
pthread_t m_cpid;
|
||||||
//short m_uid;
|
//short m_uid;
|
||||||
time_t last_sec;
|
time_t last_sec;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user