bacnet/runtime/ai.h
changeset 2020 6dddf3070806
equal deleted inserted replaced
2019:92f02bb17c7e 2020:6dddf3070806
       
     1 /**************************************************************************
       
     2 *
       
     3 * Copyright (C) 2006 Steve Karg <skarg@users.sourceforge.net>
       
     4 * Copyright (C) 2011 Krzysztof Malorny <malornykrzysztof@gmail.com>
       
     5 * Copyright (C) 2017 Mario de Sousa <msousa@fe.up.pt>
       
     6 *
       
     7 * Permission is hereby granted, free of charge, to any person obtaining
       
     8 * a copy of this software and associated documentation files (the
       
     9 * "Software"), to deal in the Software without restriction, including
       
    10 * without limitation the rights to use, copy, modify, merge, publish,
       
    11 * distribute, sublicense, and/or sell copies of the Software, and to
       
    12 * permit persons to whom the Software is furnished to do so, subject to
       
    13 * the following conditions:
       
    14 *
       
    15 * The above copyright notice and this permission notice shall be included
       
    16 * in all copies or substantial portions of the Software.
       
    17 *
       
    18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
       
    19 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
       
    20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
       
    21 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
       
    22 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
       
    23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
       
    24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
       
    25 *
       
    26 *********************************************************************/
       
    27 #ifndef AI_H
       
    28 #define AI_H
       
    29 
       
    30 #include <stdbool.h>
       
    31 #include <stdint.h>
       
    32 #include "bacdef.h"
       
    33 #include "bacerror.h"
       
    34 #include "wp.h"
       
    35 #include "rp.h"
       
    36 
       
    37 #ifdef __cplusplus
       
    38 extern "C" {
       
    39 #endif /* __cplusplus */
       
    40 
       
    41     typedef struct Analog_Input_descr {
       
    42         /* pointer to IEC 61131-3 located variable that is mapped onto this BACnet object */
       
    43         float   *Located_Var_ptr;
       
    44         uint32_t Object_Identifier;  /* called object 'Instance' in the source code! */
       
    45         char    *Object_Name;   
       
    46         char    *Description;
       
    47         uint16_t Units;
       
    48       
       
    49         /* stores the current value */
       
    50         /* one entry per priority value */
       
    51         float Present_Value;
       
    52         unsigned Event_State:3;
       
    53         bool Out_Of_Service;
       
    54     } ANALOG_INPUT_DESCR;
       
    55 
       
    56 
       
    57     void Analog_Input_Property_Lists(
       
    58         const int **pRequired,
       
    59         const int **pOptional,
       
    60         const int **pProprietary);
       
    61     bool Analog_Input_Valid_Instance(
       
    62         uint32_t object_instance);
       
    63     unsigned Analog_Input_Count(
       
    64         void);
       
    65     uint32_t Analog_Input_Index_To_Instance(
       
    66         unsigned index);
       
    67     unsigned Analog_Input_Instance_To_Index(
       
    68         uint32_t object_instance);
       
    69 
       
    70     bool Analog_Input_Object_Name(
       
    71         uint32_t object_instance,
       
    72         BACNET_CHARACTER_STRING * object_name);
       
    73 
       
    74     int Analog_Input_Read_Property(
       
    75         BACNET_READ_PROPERTY_DATA * rpdata);
       
    76 
       
    77     bool Analog_Input_Write_Property(
       
    78         BACNET_WRITE_PROPERTY_DATA * wp_data);
       
    79 
       
    80     float Analog_Input_Present_Value(
       
    81         uint32_t object_instance);
       
    82 
       
    83     char *Analog_Input_Description(
       
    84         uint32_t instance);
       
    85 
       
    86     uint16_t Analog_Input_Units(
       
    87         uint32_t instance);
       
    88 
       
    89     bool Analog_Input_Out_Of_Service(
       
    90         uint32_t instance);
       
    91     void Analog_Input_Out_Of_Service_Set(
       
    92         uint32_t instance,
       
    93         bool oos_flag);
       
    94 
       
    95     void Analog_Input_Init(
       
    96         void);
       
    97 
       
    98 
       
    99 #ifdef __cplusplus
       
   100 }
       
   101 #endif /* __cplusplus */
       
   102 #endif