aqhome-apps: decreased verbosity.

This commit is contained in:
Martin Preuss
2025-03-10 00:02:26 +01:00
parent cf9408b594
commit 5011e7e123
12 changed files with 52 additions and 42 deletions

View File

@@ -460,7 +460,7 @@ int _startBroker(AQH_OBJECT *o, AQH_MQTTLOG_SERVER *xo)
DBG_ERROR(NULL, "Error connecting to broker server %s:%d", xo->brokerAddress, xo->brokerPort);
return GWEN_ERROR_IO;
}
DBG_ERROR(NULL, "Physically connected to broker server %s:%d", xo->brokerAddress, xo->brokerPort);
DBG_INFO(NULL, "Physically connected to broker server %s:%d", xo->brokerAddress, xo->brokerPort);
ep=AQH_IpcClientObject_new(AQH_Object_GetEventLoop(o), fd);
assert(ep);
@@ -474,7 +474,7 @@ int _startBroker(AQH_OBJECT *o, AQH_MQTTLOG_SERVER *xo)
DBG_ERROR(NULL, "Error connecting to broker: %d", rv);
return (rv<0)?rv:GWEN_ERROR_PERMISSIONS;
}
DBG_ERROR(NULL, "Connected to broker at %s:%d", xo->brokerAddress, xo->brokerPort);
DBG_NOTICE(NULL, "Connected to broker at %s:%d", xo->brokerAddress, xo->brokerPort);
return 0;
}
else {
@@ -523,7 +523,7 @@ int _startMqtt(AQH_OBJECT *o, AQH_MQTTLOG_SERVER *xo)
DBG_ERROR(NULL, "Error connecting to MQTT server %s:%d", xo->mqttAddress, xo->mqttPort);
return GWEN_ERROR_IO;
}
DBG_ERROR(NULL, "Physically connected to MQTT server %s:%d", xo->mqttAddress, xo->mqttPort);
DBG_INFO(NULL, "Physically connected to MQTT server %s:%d", xo->mqttAddress, xo->mqttPort);
ep=AQH_MqttClientObject_new(AQH_Object_GetEventLoop(o), fd);
assert(ep);
@@ -544,7 +544,7 @@ int _startMqtt(AQH_OBJECT *o, AQH_MQTTLOG_SERVER *xo)
return (rv<0)?rv:GWEN_ERROR_PERMISSIONS;
}
DBG_ERROR(NULL, "Connected to MQTT at %s:%d", xo->mqttAddress, xo->mqttPort);
DBG_NOTICE(NULL, "Connected to MQTT at %s:%d", xo->mqttAddress, xo->mqttPort);
return 0;
}
else {
@@ -612,7 +612,7 @@ int _exchangeMqttSubscribe(AQH_MQTTLOG_SERVER *xo)
}
}
else {
DBG_ERROR(NULL, "No CONNACK message received.");
DBG_ERROR(NULL, "No SUBACK message received.");
return GWEN_ERROR_GENERIC;
}
}
@@ -628,6 +628,15 @@ int _exchangeMqttSubscribe(AQH_MQTTLOG_SERVER *xo)
void AQH_MqttLogServer_Fini(AQH_OBJECT *o)
{
if (o) {
AQH_MQTTLOG_SERVER *xo;
xo=GWEN_INHERIT_GETDATA(AQH_OBJECT, AQH_MQTTLOG_SERVER, o);
if (xo) {
if (xo->pidFile)
remove(xo->pidFile);
}
}
}
@@ -669,7 +678,7 @@ void _handleMsgFromBroker(AQH_OBJECT *o, AQH_OBJECT *ep, const AQH_MESSAGE *msg)
code=AQH_IpcMessage_GetCode(msg);
protoId=AQH_IpcMessage_GetProtoId(msg);
if (protoId==AQH_IPC_PROTOCOL_DATA_ID) {
DBG_ERROR(NULL, "Received IPC packet %d (%x)", (int) code, code);
DBG_INFO(NULL, "Received IPC packet %d (%x)", (int) code, code);
switch(code) {
case AQH_MSGTYPE_IPC_DATA_SETDATA: AQH_MqttLogServer_HandleSetData(o, msg, tagList); break;
default: break;
@@ -693,7 +702,7 @@ void AQH_MqttLogServer_CheckBrokerConnection(AQH_OBJECT *o)
if (xo->brokerEndpoint) {
if (AQH_Object_GetFlags(xo->brokerEndpoint) & AQH_OBJECT_FLAGS_DELETE) {
DBG_ERROR(NULL, "Deleting broker connection");
DBG_INFO(NULL, "Deleting broker connection");
AQH_Object_Disable(xo->brokerEndpoint);
AQH_Object_free(xo->brokerEndpoint);
xo->brokerEndpoint=NULL;
@@ -707,7 +716,7 @@ void AQH_MqttLogServer_CheckBrokerConnection(AQH_OBJECT *o)
if (_diffInSeconds(now, xo->timestampBrokerDown)>AQH_MQTTLOG_SERVER_BROKER_RESTARTTIME) {
int rv;
DBG_ERROR(NULL, "Restarting broker connection");
DBG_INFO(NULL, "Restarting broker connection");
rv=_startBroker(o, xo);
if (rv<0) {
DBG_ERROR(NULL, "here (%d)", rv);
@@ -762,7 +771,7 @@ void _handleMsgFromMqtt(AQH_OBJECT *o, AQH_OBJECT *ep, const AQH_MESSAGE *msg)
void _handleMqttMsgPingRsp(AQH_OBJECT *o, AQH_OBJECT *ep, const AQH_MESSAGE *msg)
{
DBG_ERROR(NULL, "PING response received");
DBG_INFO(NULL, "PING response received");
}
@@ -775,7 +784,7 @@ void AQH_MqttLogServer_CheckMqttConnection(AQH_OBJECT *o)
if (xo) {
if (xo->mqttEndpoint) {
if (AQH_Object_GetFlags(xo->mqttEndpoint) & AQH_OBJECT_FLAGS_DELETE) {
DBG_ERROR(NULL, "Deleting mqtt connection");
DBG_INFO(NULL, "Deleting mqtt connection");
AQH_Object_Disable(xo->mqttEndpoint);
AQH_Object_free(xo->mqttEndpoint);
xo->mqttEndpoint=NULL;
@@ -789,7 +798,7 @@ void AQH_MqttLogServer_CheckMqttConnection(AQH_OBJECT *o)
if (_diffInSeconds(now, xo->timestampMqttDown)>AQH_MQTTLOG_SERVER_MQTT_RESTARTTIME) {
int rv;
DBG_ERROR(NULL, "Restarting MQTT connection");
DBG_INFO(NULL, "Restarting MQTT connection");
rv=_startMqtt(o, xo);
if (rv<0) {
DBG_ERROR(NULL, "here (%d)", rv);
@@ -809,7 +818,7 @@ int AQH_MqttLogServer_SendPing(AQH_OBJECT *o)
if (xo) {
AQH_MESSAGE *msgOut;
DBG_ERROR(NULL, "Sending PING");
DBG_INFO(NULL, "Sending PING");
msgOut=AQH_MqttMessage_new(AQH_MQTTMSG_MSGTYPE_PINGREQ, 0, NULL);
AQH_Endpoint_AddMsgOut(xo->mqttEndpoint, msgOut);
return 0;
@@ -932,7 +941,7 @@ void AQH_MqttLogServer_ReloadDeviceFiles(AQH_OBJECT *o)
if (xo) {
AQHMQTT_DEVICE_LIST *deviceList;
DBG_ERROR(NULL, "Loading devices description files");
DBG_INFO(NULL, "Loading devices description files");
deviceList=AQH_MqttLogServer_ReadDataDeviceFiles(o);
if (deviceList)
AQH_MqttLogServer_SetAvailableDeviceList(o, deviceList);
@@ -951,7 +960,7 @@ void AQH_MqttLogServer_LoadRuntimeDeviceFiles(AQH_OBJECT *o)
if (xo) {
AQHMQTT_DEVICE_LIST *deviceList;
DBG_ERROR(NULL, "Loading registered devices from file \"%s\"", xo->deviceFile);
DBG_INFO(NULL, "Loading registered devices from file \"%s\"", xo->deviceFile);
deviceList=AQH_MqttLogServer_ReadDeviceFile(o, xo->deviceFile);
if (deviceList)
AQH_MqttLogServer_SetRegisteredDeviceList(o, deviceList);
@@ -1012,7 +1021,7 @@ int _handleSignal(AQH_OBJECT *o, uint32_t slotId, AQH_OBJECT *senderObject, GWEN
int _handleBrokerDown(AQH_MQTTLOG_SERVER *xo)
{
if (xo->brokerEndpoint) {
DBG_ERROR(NULL, "Broker connection down");
DBG_WARN(NULL, "Broker connection down");
AQH_Object_AddFlags(xo->brokerEndpoint, AQH_OBJECT_FLAGS_DELETE);
xo->timestampBrokerDown=time(NULL);
}
@@ -1024,7 +1033,7 @@ int _handleBrokerDown(AQH_MQTTLOG_SERVER *xo)
int _handleMqttDown(AQH_MQTTLOG_SERVER *xo)
{
if (xo->mqttEndpoint) {
DBG_ERROR(NULL, "MQTT connection down");
DBG_WARN(NULL, "MQTT connection down");
AQH_Object_AddFlags(xo->mqttEndpoint, AQH_OBJECT_FLAGS_DELETE);
xo->timestampMqttDown=time(NULL);
}