API-Definitions for the roomman library.
More...
|
roomman_result_t | roomman_set_username (char *username) |
| Set the name of the current user (required for room reservations).
|
|
roomman_result_t | roomman_create_room (char *building_name, char *room_name, uint16_t max_pers, roomman_id_t *rid) |
| Create a new room.
|
|
roomman_result_t | roomman_delete_room (roomman_id_t rid) |
| Delete a room.
|
|
roomman_result_t | roomman_update_capacity (roomman_id_t rid, uint16_t new_capacity) |
| Update the capacity of a room.
|
|
roomman_result_t | roomman_reserve_room (roomman_id_t rid) |
| Reserve a room.
|
|
roomman_result_t | roomman_clear_reservation (roomman_id_t rid) |
| Reserve a room.
|
|
roomman_result_t | roomman_add_persons (roomman_id_t rid, uint16_t persons) |
| Increase the number of persons currently using the room.
|
|
roomman_result_t | roomman_remove_persons (roomman_id_t rid, uint16_t persons) |
| Decrease the number of persons currently using the room.
|
|
roomman_result_t | roomman_readentry (roomman_id_t rid, char *building, char *name, uint16_t *occupied, uint16_t *capacity, char *reserved_by) |
| Get contents of an entry in the database.
|
|
roomman_result_t | roomman_lookup (const char *building, const char *room_name, roomman_id_t *rid) |
| Find room in the database.
|
|
roomman_result_t | roomman_directory (int32_t *fdptr, const char *building, const char *room_name, roomman_id_t *rid) |
| Get a directory of entries in the database.
|
|
API-Definitions for the roomman library.
This file is to be included by all applications making use of any of the room manager library's functions. It declares prototypes for all user-callable functions of the library. It does not contain library-internal definitions.
◆ roomman_add_persons()
Increase the number of persons currently using the room.
- Parameters
-
[in] | rid | ID of the room to update |
[in] | persons | Number of additional persons using the room |
- Returns
- ROOMMAN_SUCCESS If the room was successfully updated
-
On error a negative value (either ROOMMAN_ERR_INVALID_ROOM or ROOMMAN_ERR_EXCEED)
◆ roomman_clear_reservation()
Reserve a room.
- Note
- Clearing the reservation for an existing room should always succeed (unless errors with the database access occur).
- Parameters
-
[in] | rid | The ID of the room to be unreserved |
- Returns
- ROOMMAN_SUCCESS If the room was successfully updated
-
On error a negative value (ROOMMAN_ERR_INVALID_ROOM)
◆ roomman_create_room()
Create a new room.
- Note
- Rooms are created empty and not reserved.
- Parameters
-
[in] | building_name | The building's name |
[in] | room_name | The room's name |
[in] | max_pers | The maximum number of persons for this room. If 0 is provided the default capacity will be set. |
[out] | rid | The ID of the newly created room. Undefined if room creation fails. |
- Returns
- ROOMMAN_SUCCESS on success
-
On error a negative value (ROOMMAN_ERR_DUPLICATE_ROOM)
◆ roomman_delete_room()
◆ roomman_directory()
Get a directory of entries in the database.
This function enables a "wildcard search" of the database. It delivers UIDs of matching entries. The caller may specify a building name or a room name, thus specifying a particular entry (in this case the function is similar to roomman_lookup()). However, it is also possible to specify only an building name or only a room name by passing a NULL value for the name that should not be specified. In this case, the function delivers UIDs of all entries matching the specified name. If both names are passed as NULL, the function delivers the UIDs of all entries in the database.
The function delivers one UID per call. In order to keep the context across calls, the caller must pass a pointer to an int variable. This variable (not the pointer!) must be initialized with -1 before making the first call.
If there are no more remaining entries in the database the function will return ROOMMAN_ERR_INVALID_ROOM.
- Returns
- ROOMMAN_SUCCESS on success
-
An error code otherwise ROOMMAN_ERR_INVALID_ROOM or ROOMMAN_ERR_NAMETOOLONG)
- Parameters
-
| fdptr | [in/out] pointer where to store the open file handle across calls |
[in] | building | name of room's building or NULL if not specified |
[in] | room_name | name of room or NULL if not specified |
[out] | rid | The room ID for the next matching entry. (Undefined if room is not found.) |
◆ roomman_lookup()
Find room in the database.
This function locates an entry in the database. It returns a unique ID by which the room can be referenced. A room is uniquely identified by the combination of the building's name and the room's name.
- Returns
- ROOMMAN_SUCCESS on success
-
An error code otherwise ROOMMAN_ERR_INVALID_ROOM or ROOMMAN_ERR_NAMETOOLONG)
- Parameters
-
[in] | building | name of building |
[in] | room_name | name of room |
[out] | rid | The room ID for the requested room. (Undefined if room is not found.) |
◆ roomman_readentry()
roomman_result_t roomman_readentry |
( |
roomman_id_t | rid, |
|
|
char * | building, |
|
|
char * | name, |
|
|
uint16_t * | occupied, |
|
|
uint16_t * | capacity, |
|
|
char * | reserved_by ) |
Get contents of an entry in the database.
This function delivers details of a room identified by UID. The room is not changed by a call to this function.
- Returns
- ROOMMAN_SUCCESS if the entry for the given room has been found
-
a negative value if the room was not found (ROOMMAN_ERR_INVALID_ROOM)
- Parameters
-
[in] | rid | Room's unique ID |
[out] | building | Where to store name of building |
[out] | name | Where to store name of room |
[out] | occupied | Where to store the number of occupied places |
[out] | capacity | Where to store capacity |
[out] | reserved_by | Contains the name of the person currently reserving the room (if any) |
◆ roomman_remove_persons()
Decrease the number of persons currently using the room.
- Parameters
-
[in] | rid | ID of the room to update |
[in] | persons | Number of persons leaving the room |
- Returns
- ROOMMAN_SUCCESS If the room was successfully updated
-
On error a negative value (either ROOMMAN_ERR_INVALID_ROOM or ROOMMAN_ERR_EXCEED)
◆ roomman_reserve_room()
◆ roomman_set_username()
Set the name of the current user (required for room reservations).
- Parameters
-
[in] | username | Name of the user. |
- Returns
- ROOMMAN_SUCCESS on success
-
On error a negative value (either ROOMMAN_ERR_NAMETOOLONG)
◆ roomman_update_capacity()
Update the capacity of a room.
- Parameters
-
[in] | rid | ID of the room to update |
[in] | new_capacity | New capacity of the room |
- Returns
- ROOMMAN_SUCCESS If the room was successfully updated
-
On error a negative value (ROOMMAN_ERR_INVALID_ROOM)