add test for devices_manager_get_by_id & devices_manager_update
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
NADAL Jean-Baptiste
2020-01-07 17:29:55 +01:00
parent 87751f24b7
commit b5405fbe81
18 changed files with 573 additions and 364 deletions

View File

@@ -0,0 +1,67 @@
/*!
* devices_manager_internal.h
*
* Copyright (c) 2015-2020, NADAL Jean-Baptiste. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*
* @Author: NADAL Jean-Baptiste
* @Date: 07/01/2020
*
*/
#ifndef _DEVICES_MANAGER_INTERNAL_H
#define _DEVICES_MANAGER_INTERNAL_H
/*------------------------------- INCLUDES ----------------------------------*/
#include <stdint.h>
#include "devices_manager.h"
struct json_object;
/*--------------------------- PUBLIC FUNCTIONS -------------------------------*/
/*-------------------------------- OUTLETS -----------------------------------*/
extern int load_outlets(devices_manager_t *dm, struct json_object *node);
extern struct json_object *save_outlets(devices_manager_t *dm);
extern int create_outlet(devices_manager_t *dm, struct json_object *node);
extern int remove_outlet(devices_manager_t *dm, uint16_t id);
extern int update_outlet(devices_manager_t *dm, uint16_t id, struct json_object *node);
extern int set_outlet_state(devices_manager_t *dm, uint16_t id, bool state);
extern outlet_dio_t *get_outlet_by_id(devices_manager_t *dm, uint16_t id);
/*-------------------------------- SHUTTERS -----------------------------------*/
extern int load_shutters(devices_manager_t *dm, struct json_object *node);
extern struct json_object *save_shutters(devices_manager_t *dm);
extern int create_shutter(devices_manager_t *dm, struct json_object *node);
extern int remove_shutter(devices_manager_t *dm, uint16_t id);
extern int update_shutter(devices_manager_t *dm, uint16_t id, struct json_object *node);
extern int set_shutter_state(devices_manager_t *dm, uint16_t id, bool state);
extern shutter_t *get_shutter_by_id(devices_manager_t *dm, uint16_t id);
/*------------------------------- SPRINKLERS ----------------------------------*/
extern int load_sprinklers(devices_manager_t *dm, struct json_object *node);
extern struct json_object *save_sprinklers(devices_manager_t *dm);
extern int create_sprinkler(devices_manager_t *dm, struct json_object *node);
extern int remove_sprinkler(devices_manager_t *dm, uint16_t id);
extern int update_sprinkler(devices_manager_t *dm, uint16_t id, struct json_object *node);
extern int set_sprinkler_state(devices_manager_t *dm, uint16_t id, bool state);
extern sprinkler_t *get_sprinkler_by_id(devices_manager_t *dm, uint16_t id);
#endif /* _DEVICES_MANAGER_INTERNAL_H */