aqhome: removed unused and unneeded code.

This commit is contained in:
Martin Preuss
2023-07-14 00:02:21 +02:00
parent 0fd58567fe
commit f30c4895fa
7 changed files with 4 additions and 156 deletions

View File

@@ -67,7 +67,6 @@ void GWENHYWFAR_CB _freeData(GWEN_UNUSED void *bp, void *p)
xep=(AQH_ENDPOINT_MQTT*) p;
free(xep->clientId);
free(xep->topicPrefix);
GWEN_FREE_OBJECT(xep);
}
@@ -103,36 +102,6 @@ void AQH_MqttEndpoint_SetClientId(GWEN_MSG_ENDPOINT *ep, const char *s)
const char *AQH_MqttEndpoint_GetTopicPrefix(const GWEN_MSG_ENDPOINT *ep)
{
if (ep) {
AQH_ENDPOINT_MQTT *xep;
xep=GWEN_INHERIT_GETDATA(GWEN_MSG_ENDPOINT, AQH_ENDPOINT_MQTT, ep);
if (xep) {
return xep->topicPrefix;
}
}
return NULL;
}
void AQH_MqttEndpoint_SetTopicPrefix(GWEN_MSG_ENDPOINT *ep, const char *s)
{
if (ep) {
AQH_ENDPOINT_MQTT *xep;
xep=GWEN_INHERIT_GETDATA(GWEN_MSG_ENDPOINT, AQH_ENDPOINT_MQTT, ep);
if (xep) {
free(xep->topicPrefix);
xep->topicPrefix=s?strdup(s):NULL;
}
}
}
uint16_t AQH_MqttEndpoint_GetNextPacketId(const GWEN_MSG_ENDPOINT *ep)
{
if (ep) {
@@ -255,67 +224,3 @@ GWEN_MSG *AQH_MqttEndpoint_CreateMsgConnect(GWEN_MSG_ENDPOINT *ep)
GWEN_MSG *AQH_MqttEndpoint_CreateMsgPublishDouble(GWEN_MSG_ENDPOINT *ep, uint32_t uid, int valueId, const char *valuePath, double v)
{
char numBuf[16];
snprintf(numBuf, sizeof(numBuf)-1, "%f", v);
numBuf[sizeof(numBuf)-1]=0;
return AQH_MqttEndpoint_CreateMsgPublishString(ep, uid, valueId, valuePath, numBuf);
}
GWEN_MSG *AQH_MqttEndpoint_CreateMsgPublishInt(GWEN_MSG_ENDPOINT *ep, uint32_t uid, int valueId, const char *valuePath, int v)
{
char numBuf[16];
snprintf(numBuf, sizeof(numBuf)-1, "%d", v);
numBuf[sizeof(numBuf)-1]=0;
return AQH_MqttEndpoint_CreateMsgPublishString(ep, uid, valueId, valuePath, numBuf);
}
GWEN_MSG *AQH_MqttEndpoint_CreateMsgPublishString(GWEN_MSG_ENDPOINT *ep,
uint32_t uid,
int valueId,
const char *valuePath,
const char *v)
{
if (ep) {
AQH_ENDPOINT_MQTT *xep;
xep=GWEN_INHERIT_GETDATA(GWEN_MSG_ENDPOINT, AQH_ENDPOINT_MQTT, ep);
if (xep) {
GWEN_BUFFER *bufTopic;
GWEN_MSG *pubMsg;
bufTopic=GWEN_Buffer_new(0, 64, 0, 1);
if (valueId>0)
GWEN_Buffer_AppendArgs(bufTopic, "%s/%08x/%d/%s",
xep->topicPrefix,
uid,
valueId,
valuePath);
else
GWEN_Buffer_AppendArgs(bufTopic, "%s/%08x/%s",
xep->topicPrefix,
uid,
valuePath);
DBG_INFO(AQH_LOGDOMAIN, "MQTT PUBLISH %s: %s", GWEN_Buffer_GetStart(bufTopic), v);
pubMsg=AQH_PublishMqttMsg_new(0, 0, GWEN_Buffer_GetStart(bufTopic), (const uint8_t*) v, strlen(v));
GWEN_Buffer_free(bufTopic);
if (pubMsg==NULL) {
DBG_INFO(AQH_LOGDOMAIN, "here");
}
return pubMsg;
}
}
return NULL;
}