bacnet/runtime/msi.h
author Edouard Tisserant
Fri, 02 Sep 2022 10:46:05 +0200
changeset 3596 9c725829d8f0
parent 2020 6dddf3070806
permissions -rw-r--r--
SVGHMI: continue rework of Jump widget to cope with Enable Expressions.

Questioning widget's activity and disability all together.
Now active/inactive/disable masquarade is all managed in widgets_common.
Propagated changes to widget already using activity (buttons)
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
     1
/**************************************************************************
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
     2
*
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
     3
* Copyright (C) 2012 Steve Karg <skarg@users.sourceforge.net>
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
     4
* Copyright (C) 2017 Mario de Sousa <msousa@fe.up.pt>
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
     5
*
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
     6
* Permission is hereby granted, free of charge, to any person obtaining
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
     7
* a copy of this software and associated documentation files (the
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
     8
* "Software"), to deal in the Software without restriction, including
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
     9
* without limitation the rights to use, copy, modify, merge, publish,
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    10
* distribute, sublicense, and/or sell copies of the Software, and to
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    11
* permit persons to whom the Software is furnished to do so, subject to
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    12
* the following conditions:
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    13
*
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    14
* The above copyright notice and this permission notice shall be included
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    15
* in all copies or substantial portions of the Software.
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    16
*
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    17
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    18
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    19
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    20
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    21
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    22
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    23
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    24
*
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    25
*********************************************************************/
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    26
#ifndef MULTISTATE_INPUT_H
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    27
#define MULTISTATE_INPUT_H
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    28
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    29
#include <stdbool.h>
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    30
#include <stdint.h>
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    31
#include "bacdef.h"
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    32
#include "bacerror.h"
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    33
#include "rp.h"
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    34
#include "wp.h"
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    35
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    36
#ifdef __cplusplus
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    37
extern "C" {
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    38
#endif /* __cplusplus */
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    39
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    40
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    41
/* MultiState Inputs are encoded in unsigned integer
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    42
 * (in BACnet => uint8_t), and can not be 0.
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    43
 * See ASHRAE 135-2016, section 12.20.4
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    44
 */
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    45
#define MULTISTATE_MAX_NUMBER_OF_STATES (255)
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    46
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    47
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    48
    typedef struct Multistate_Input_descr {
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    49
        /* pointer to IEC 61131-3 located variable that is mapped onto this BACnet object */
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    50
        uint8_t *Located_Var_ptr;
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    51
        uint32_t Object_Identifier;  /* called object 'Instance' in the source code! */
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    52
        char    *Object_Name;   
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    53
        char    *Description;
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    54
        uint8_t  Number_Of_States;
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    55
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    56
        /* stores the current value */
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    57
        uint8_t Present_Value;
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    58
        /* Writable out-of-service allows others to manipulate our Present Value */
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    59
        bool Out_Of_Service;
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    60
        char State_Text[MULTISTATE_MAX_NUMBER_OF_STATES][64];
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    61
    } MULTISTATE_INPUT_DESCR;
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    62
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    63
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    64
    void Multistate_Input_Property_Lists(
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    65
        const int **pRequired,
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    66
        const int **pOptional,
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    67
        const int **pProprietary);
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    68
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    69
    bool Multistate_Input_Valid_Instance(
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    70
        uint32_t object_instance);
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    71
    unsigned Multistate_Input_Count(
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    72
        void);
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    73
    uint32_t Multistate_Input_Index_To_Instance(
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    74
        unsigned index);
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    75
    unsigned Multistate_Input_Instance_To_Index(
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    76
        uint32_t instance);
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    77
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    78
    int Multistate_Input_Read_Property(
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    79
        BACNET_READ_PROPERTY_DATA * rpdata);
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    80
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    81
    bool Multistate_Input_Write_Property(
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    82
        BACNET_WRITE_PROPERTY_DATA * wp_data);
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    83
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    84
    /* optional API */
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    85
    bool Multistate_Input_Object_Name(
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    86
        uint32_t object_instance,
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    87
        BACNET_CHARACTER_STRING * object_name);
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    88
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    89
    uint32_t Multistate_Input_Present_Value(
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    90
        uint32_t object_instance);
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    91
    bool Multistate_Input_Present_Value_Set(
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    92
        uint32_t object_instance,
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    93
        uint32_t value);
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    94
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    95
    bool Multistate_Input_Out_Of_Service(
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    96
        uint32_t object_instance);
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    97
    void Multistate_Input_Out_Of_Service_Set(
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    98
        uint32_t object_instance,
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    99
        bool value);
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   100
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   101
    void Multistate_Input_Init(
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   102
        void);
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   103
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   104
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   105
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   106
#ifdef __cplusplus
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   107
}
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   108
#endif /* __cplusplus */
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   109
#endif