prepared for u_mqtttopic module.

This commit is contained in:
Martin Preuss
2023-08-10 22:26:30 +02:00
parent 487e506a01
commit 96c2b9a649
3 changed files with 45 additions and 11 deletions

View File

@@ -145,6 +145,7 @@ void _setFromObject(AQH_DEVICE *device, const AQH_DEVICE *srcDevice)
{ {
AQH_Device_SetRoomId(device, AQH_Device_GetRoomId(srcDevice)); AQH_Device_SetRoomId(device, AQH_Device_GetRoomId(srcDevice));
AQH_Device_SetName(device, AQH_Device_GetName(srcDevice)); AQH_Device_SetName(device, AQH_Device_GetName(srcDevice));
AQH_Device_SetDeviceType(device, AQH_Device_GetDeviceType(srcDevice));
AQH_Device_SetLocation(device, AQH_Device_GetLocation(srcDevice)); AQH_Device_SetLocation(device, AQH_Device_GetLocation(srcDevice));
AQH_Device_SetDescription(device, AQH_Device_GetDescription(srcDevice)); AQH_Device_SetDescription(device, AQH_Device_GetDescription(srcDevice));
} }
@@ -252,18 +253,26 @@ void _writeEditingTable(AQH_HTTP_URLHANDLER *uh, GWEN_DB_NODE *dbValues, GWEN_BU
} }
GWEN_Buffer_AppendString(pageBuf, "</select></td></tr>"); GWEN_Buffer_AppendString(pageBuf, "</select></td></tr>");
GWEN_Buffer_AppendArgs(pageBuf,
" <tr>"
" <td><label for=\"deviceType\">%s: </label></td>"
" <td><input type=\"text\" name=\"deviceType\" value=\"%s\"></td>"
" </tr>",
I18N("Type"),
dbValues?GWEN_DB_GetCharValue(dbValues, "deviceType", 0, ""):"");
GWEN_Buffer_AppendArgs(pageBuf, GWEN_Buffer_AppendArgs(pageBuf,
" <tr>" " <tr>"
" <td><label for=\"location\">%s: </label></td>" " <td><label for=\"location\">%s: </label></td>"
" <td><input type=\"text\" name=\"location\" value=\"%s\" required></td>" " <td><input type=\"text\" name=\"location\" value=\"%s\"></td>"
" </tr>" " </tr>",
I18N("Location"),
dbValues?GWEN_DB_GetCharValue(dbValues, "location", 0, ""):"");
GWEN_Buffer_AppendArgs(pageBuf,
" <tr>" " <tr>"
" <td><label for=\"description\">%s: </label></td>" " <td><label for=\"description\">%s: </label></td>"
" <td><input type=\"text\" name=\"description\" value=\"%s\"></td>" " <td><input type=\"text\" name=\"description\" value=\"%s\"></td>"
" </tr>" " </tr>"
" </table>", " </table>",
I18N("Location"),
dbValues?GWEN_DB_GetCharValue(dbValues, "location", 0, ""):"",
I18N("Description"), I18N("Description"),
dbValues?GWEN_DB_GetCharValue(dbValues, "description", 0, ""):""); dbValues?GWEN_DB_GetCharValue(dbValues, "description", 0, ""):"");
} }
@@ -283,11 +292,12 @@ void _listObjectsIntoBuffer(AQH_HTTP_URLHANDLER *uh, GWEN_BUFFER *pageBuf)
"<h2>%s</h2>" "<h2>%s</h2>"
"<table class=\"dataTable\">" "<table class=\"dataTable\">"
"<thead>" "<thead>"
" <tr><th>%s</th><th>%s</th><th>%s</th><th>%s</th><th></th></tr>" " <tr><th>%s</th><th>%s</th><th>%s</th><th>%s</th><th>%s</th><th></th></tr>"
"</thead>", "</thead>",
I18N("Devices"), I18N("Devices"),
I18N("Name"), I18N("Name"),
I18N("Room"), I18N("Room"),
I18N("Type"),
I18N("Location"), I18N("Location"),
I18N("Description")); I18N("Description"));
GWEN_Buffer_AppendString(pageBuf, "<tbody>"); GWEN_Buffer_AppendString(pageBuf, "<tbody>");
@@ -301,6 +311,7 @@ void _listObjectsIntoBuffer(AQH_HTTP_URLHANDLER *uh, GWEN_BUFFER *pageBuf)
int roomId; int roomId;
const char *name; const char *name;
const char *roomName=NULL; const char *roomName=NULL;
const char *devType;
const char *descr; const char *descr;
const char *location; const char *location;
const AQH_ROOM *r=NULL; const AQH_ROOM *r=NULL;
@@ -313,15 +324,17 @@ void _listObjectsIntoBuffer(AQH_HTTP_URLHANDLER *uh, GWEN_BUFFER *pageBuf)
roomName=AQH_Room_GetName(r); roomName=AQH_Room_GetName(r);
name=AQH_Device_GetName(device); name=AQH_Device_GetName(device);
devType=AQH_Device_GetDeviceType(device);
descr=AQH_Device_GetDescription(device); descr=AQH_Device_GetDescription(device);
location=AQH_Device_GetLocation(device); location=AQH_Device_GetLocation(device);
GWEN_Buffer_AppendArgs(pageBuf, GWEN_Buffer_AppendArgs(pageBuf,
"<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td>" "<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td>"
"<td><a href=\"/devices/edit/%lu\">" "<td><a href=\"/devices/edit/%lu\">"
"<IMG src=\"/pics/edit.png\" width=32 height=32 align=left border=0></a></td>" "<IMG src=\"/pics/edit.png\" width=32 height=32 align=left border=0></a></td>"
"</tr>", "</tr>",
name?name:"", name?name:"",
roomName?roomName:"", roomName?roomName:"",
devType?devType:"",
location?location:"", location?location:"",
descr?descr:"", id); descr?descr:"", id);

View File

@@ -51,6 +51,13 @@
<flags>own with_getbymember</flags> <flags>own with_getbymember</flags>
</member> </member>
<member name="deviceType" type="char_ptr" maxlen="64">
<default>0</default>
<preset>0</preset>
<access>public</access>
<flags>own</flags>
</member>
<member name="location" type="char_ptr" maxlen="32"> <member name="location" type="char_ptr" maxlen="32">
<default>0</default> <default>0</default>
<preset>0</preset> <preset>0</preset>

View File

@@ -23,11 +23,25 @@
<inlines> <inlines>
</inlines> </inlines>
</lang> </lang>
<enums>
<enum id="AQH_MQTT_TOPIC_TYPE" prefix="AQH_MqttTopicType_">
<item name="num">
<descr>numeric type</descr>
</item>
<item name="json">
<descr>json data</descr>
</item>
</enum>
</enums>
<members> <members>
<member name="id" type="uint64_t" maxlen="8"> <member name="id" type="uint64_t" maxlen="8">