Developer Portal Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 

    Is posible to disable an AddOn?

    Is posible to disable an AddOn?

    Despejo47
    Established Member

    Hello comununity,

    I'm tI'm wondering how i can disable the execution of ana AddOn.

    Units you can disable via UnitStateReq but not in AddOns. Even in the past I experienced that AddOns still run on a disable Unit. Is this still happens now?

    Is there no other way to disable the AddOn other than programming it specifically in the AddOn?

    Thanks.

    4 REPLIES 4

    nexidator
    Community Moderator
    Community Moderator

    You are right, add-ons don't have their own state machine. And they are always called even if the parent handler is disabled. The reason is that it is not easy to tell what would be the expected behavior for an add-on. Some add-ons should definitely consider the UnitState of their parent, but there are others that should just continue working even if the parent is disabled. So it is really the responsibility of the add-on programmer to decide this.

    MarvinW
    Long-established Member

    If I need to temporarily "disable" an add-on, then I go to the hosting handler's OnInitHierarchy and remove it from there. If it is not added to the handler, then it will never be executed. Since the code is inside the OES generated code, the next export will bring it back. For a slightly more permanent solution, you can wrap the OES part in an IF ( FALSE ) and copy-paste everything except the add-on below your END_IF. Never did it like this, but it should work. Then export will have no effect anymore, so other changes to children etc. will also not be updated. So it's also a temporary solution at best. Also, add a !!!BIG WARNING!!! pragma in that OnInitHierarchy to avoid bad accidents if the software unexpectedly changes hands.

    Despejo47
    Established Member

    Thanks,

    We do something like that but I expect something more "clean" than override OnIniHierarchy. We try to implement TwinCAT feature of Project Variant to recognice "almost twins Stations" betwen lines so this feature will be permanent on the code. We have to take care and review from time to time the InstancesId.  I don't like this way I wont sleep well if i release my SW with this tricks.

    Honestly i don't understand that we can disable almost everything but AddOns. And worst if Unit is disable, AddOns still running.

     

    MarvinW
    Long-established Member

    You can remove the addon from the handler again, which basically stops it from being called. I wouldn't call this "clean" either, since the Nexeed framework clearly does want you to do that. And depending on what the add-on is doing exactly, it may have some weird consequences. If you do it straight at the end of OnUnitInitialize (after the exported code), it should be fine in most cases though.

    You can also link this to the unit state if you wanted to, but that requires you to either manually add this to all your handlers or create new handlers that extend the Nexeed version, like we have in our ATMOx handlers anyway.

    I'll contact you separately how to do this, I don't really want to advertise this solution publically. Maybe the Nexeed developer team picks up on your requirement and adds this to the official framework someday.

    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