Add test for shutter objects.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -84,7 +84,7 @@ void devices_manager_free(devices_manager_t *devices_manager)
|
||||
i = 0;
|
||||
while (qlist_getnext(devices_manager->outlets, &obj, true))
|
||||
{
|
||||
sprinkler_free(obj.data);
|
||||
outlet_dio_free(obj.data);
|
||||
i++;
|
||||
}
|
||||
qlist_free(devices_manager->outlets);
|
||||
@@ -94,7 +94,7 @@ void devices_manager_free(devices_manager_t *devices_manager)
|
||||
i = 0;
|
||||
while (qlist_getnext(devices_manager->shutters, &obj, true))
|
||||
{
|
||||
sprinkler_free(obj.data);
|
||||
shutter_free(obj.data);
|
||||
i++;
|
||||
}
|
||||
qlist_free(devices_manager->shutters);
|
||||
@@ -206,10 +206,31 @@ char *devices_manager_get_by_id(devices_manager_t *dm, const char *capability, u
|
||||
|
||||
if (capability == kOutletEntry)
|
||||
{
|
||||
|
||||
outlet_dio_t *outlet_dio;
|
||||
outlet_dio = get_outlet_by_id(dm, id);
|
||||
if (outlet_dio != NULL)
|
||||
{
|
||||
json_object *output_node = outlet_dio_to_json_object(outlet_dio);
|
||||
if (output_node != NULL)
|
||||
{
|
||||
output = strdup(json_object_to_json_string(output_node));
|
||||
json_object_put(output_node);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (capability == kShutterEntry)
|
||||
{
|
||||
shutter_t *shutter;
|
||||
shutter = get_shutter_by_id(dm, id);
|
||||
if (shutter != NULL)
|
||||
{
|
||||
json_object *output_node = shutter_to_json_object(shutter);
|
||||
if (output_node != NULL)
|
||||
{
|
||||
output = strdup(json_object_to_json_string(output_node));
|
||||
json_object_put(output_node);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (capability == kSprinklerEntry)
|
||||
{
|
||||
@@ -221,7 +242,6 @@ char *devices_manager_get_by_id(devices_manager_t *dm, const char *capability, u
|
||||
if (output_node != NULL)
|
||||
{
|
||||
output = strdup(json_object_to_json_string(output_node));
|
||||
|
||||
json_object_put(output_node);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user