Giter Club home page Giter Club logo

Comments (3)

JoelBender avatar JoelBender commented on September 25, 2024

It seems like there should be a way to go through the classes in the bacpypes.apdu.confirmed_request_types dictionary items and see if the application has a matching method, then build the protocol services supported bit string from those. The same mechanism should also work for unconfirmed request types.

The twist on this is that there is no mapping between the class and the enumeration values of ServicesSupported. For example, if WhoHasRequest is the class and do_WhoHasRequest is an implemented method, there needs to be something like this:

class WhoHasRequest(UnconfirmedRequestSequence):
    serviceChoice = 7
    serviceSupported = 'whoHas'
    sequenceElements = \
        [ Element('limits', WhoHasLimits, None, True)
        , Element('object', WhoHasObject)
        ]

Nemine contradicente.

from bacpypes.

JoelBender avatar JoelBender commented on September 25, 2024

Rather then adding those statements to the confirmed and unconfirmed request classes, I decided to use the serviceChoice to look up the correct bit name.

When building an application stack, the Application class needs an instance of a DeviceObject (usually a LocalDeviceObject in the sample applications), and the device object doesn't know what services the application supports. So there is a new function get_services_supported() of the application and the output of that is given to the device object.

I briefly experimented with the idea of modifying the device object inside the Application.__init__() method but that seemed too intrusive. What if the application developer doesn't want that bit list created, but wanted the application to operate on just the information that it put in the device object?

The first iteration of the sample code is b54610f, and the next step is to update and test the rest of the samples.

from bacpypes.

JoelBender avatar JoelBender commented on September 25, 2024

I'm happy with the results, so I'm closing the issue and merging it into stage.

from bacpypes.

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.