Developer Portal Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 

    Request: Make SetExtEvent of OpconAddonEvHdl PUBLIC and SetExtEventFromDeviceError visible

    Request: Make SetExtEvent of OpconAddonEvHdl PUBLIC and SetExtEventFromDeviceError visible

    MarvinW
    Long-established Member

    In OpconUnit the methods SetEvent, SetExtEvent, ClearEvent and UnlockEvent are all PUBLIC. In OpconAddonEvHdl only ClearEvent is PUBLIC, the other methods are PROTECTED.

    While I understand that they should be PROTECTED if possible, I would like to make the request to make them PUBLIC anyway. I guess for units they are public so that chains can access them but add-ons don't have this requirement in the Nexeed framework. We in BMG are currently working on creating some plugins (utility classes) that make event handling more convenient. For Units (and this includes handlers) we can do this without problems, but for Addons I am hitting the limitation that SetExtEvent is PROTECTED. I only need ClearEvent (already PUBLIC) and SetExtEvent so far. Maybe I can come up with some tricks to bypass this restriction but I would appreciate it if I don't have to 🙂

    Another thing that I was wondering for quite some time, so I may as well address it here: The method SetExtEventFromDeviceError is useful in quite a few places but it is not visible. I guess it is using {attribute 'hide'}. Only people who know that it exists or who ever found it using THIS^. or SUPER^. will be able to use it. I think it would be a good idea to make it visible to everybody. I think in most (station program) situations where people are using SetExtEvent they could actually benefit from directly using SetExtEventFromDeviceError instead, because most external events you want to throw are device error events from BinIo in my experience.

    2 REPLIES 2

    SteffenR-
    Community Moderator
    Community Moderator

    It is planned to provide a successor method for CheckUnitDone and CheckAddonDone, in which accessing SetExtEvent would also be helpful to show an error message if the provided unit/addon is not RUNNING (= coding error in application code). Therefore we have internally the same request like you.

    What's your use case?

    MarvinW
    Long-established Member

    We have several convenience event handling methods, for example SetEventOnce which checks if an event was set before to make it very simple to avoid setting events multiple times, even without event handle variables. Or ClearEventByNumber which works similar to the old clear event function in Opcon.

    These functions should be available in Units, ExecUnits, ExecHandlers (and its derivatives), AddonEvHdls and AddonExecs. But I don't want to implement these methods 5 or more times in derived FBs, so I put them into a separate FB (called Plugin) that handles all of that. Now my derived FBs just instantiate the Plugin, register themselves with it and then they can use the Plugin to call these convenience methods. Since the plugin is a separate FB and not derived from OpconUnit or OpconEvHdl, it can only access their public methods.

    Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist