Giter Club home page Giter Club logo

Comments (2)

skarg avatar skarg commented on June 21, 2024

Has COV been enabled in your device for the particular object instance you are trying to SubscribeCOV? COV for an object results in the server sending COVnotification service with the Present_Value and Status_Flags property values from a specific object instance a) upon subscription and b) any time present-value or status-flags change.

To enable COV for an object in the BACnet stack library in v0.8.x for a particular product:

  1. add extra files to your build: cov.c, h_cov.c, h_ccov.c, and there might be others (but the linker will warn if the functions are

missing).

  1. reference demo/object/bi.c - three functions are used by device.c module to a) detect when Present_Value or Status_Flags values change, and b) encode the present-value and status-flags property values to send in the COVnotification.
bool Binary_Input_Change_Of_Value(
    uint32_t object_instance);
void Binary_Input_Change_Of_Value_Clear(
    uint32_t object_instance);
bool Binary_Input_Encode_Value_List(
    uint32_t object_instance,
    BACNET_PROPERTY_VALUE * value_list);

If there are other object types that your device needs to support for COV, reference the master branch of the 1.x BACnet stack for object examples - they should be similar - and the encoding for binary has been refactored into bacnet/cov.c module. See cov_data_value_list_link(), cov_value_list_encode_real(), cov_value_list_encode_enumerated(), and cov_value_list_encode_unsigned().

These unique object functions - for each object that supports COV - are added to the device.c module in the Object_Table.

For Analog objects, additional requirement of the COV Increment property value which is normally non-volatile.

    float Analog_Input_COV_Increment(
        uint32_t instance);
    void Analog_Input_COV_Increment_Set(
        uint32_t instance,
        float value);

Add the COV Increment property to the optional list:

static const int Analog_Input_Properties_Optional[] = { 
    PROP_COV_INCREMENT, -1 };

Add COV Increment property to Analog_Input_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata) function:

        case PROP_COV_INCREMENT:
            apdu_len = encode_application_real(
                &apdu[0], Analog_Input_COV_Increment(rpdata->object_instance));
            break;

Add COV Increment property to Analog_Input_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data) function:

        case PROP_COV_INCREMENT:
            status = write_property_type_valid(
                wp_data, &value, BACNET_APPLICATION_TAG_REAL);
            if (status) {
                status =
                    Analog_Input_COV_Increment_Write(wp_data->object_instance,
                        value.type.Real, wp_data->priority,
                        &wp_data->error_class, &wp_data->error_code);
            }
            break;
  1. reference demo/server/main.c for example APDU handler setup and tasks. Add an APDU handler to support COV subscription. This handles subscriptions to the object instances.
    apdu_set_confirmed_handler(SERVICE_CONFIRMED_SUBSCRIBE_COV,  handler_cov_subscribe);  
  1. reference demo/handler/h_cov.c - contains handler_cov_task() that is called in main loop manages the sending of the COV notification when objects indicate that their present-value or status-flags have changed.

  2. reference demo/handler/h_cov.c - contains handler_cov_timer_seconds() that is called every second to manage the subscription timeouts.

  3. The maximum number COV subscriptions are configured by these defines (in h_cov.c module):

#define MAX_COV_SUBCRIPTIONS 128
#define MAX_COV_ADDRESSES 16
  1. The h_ccov.c file also needs at least one TSM (transaction state machine) buffer, defined in the Makefile or project precompiler defines as MAX_TSM_TRANSACTIONS=1 or some other value larger than 0.

from bacnet-stack.

cyberumut avatar cyberumut commented on June 21, 2024

thanks for answer Steve

from bacnet-stack.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.