Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Transport Class and Events

  1. #1
    Join Date
    May 2004
    Location
    Dallas, TX
    Posts
    1,032

    Default Transport Class and Events

    Hopefully this makes sense.

    I am trying to send an event from my transport class to the provider class using self:Event(self.Events.AnEvent), the event is never seen. If I send the same from my component class, then my provider class sees the event.

    How do I do the same from my transport class?
    Rick

    Girder 5.0 - Elk M1 Gold - JRMC 11.1 w/ M-Audio Delta 410 - NetRemote 2.0 - Panasonic KX-TA624 Phone System - ZoneMinder DVR
    Girder 5 Plugins - Elk M1/EZ8, Email Manager, Girder Backup, Ocelot, xAP Speedfan, xAP Ping, xAP Zoneminder and many more.


    Visit My Showcase

  2. #2
    Join Date
    May 2004
    Location
    Cardigan, UK
    Posts
    9,278

    Default

    I think the first parameter should probably be self.Events.Update for it to be passed up the chain. It all depends what's subscribed to the transport.

    How is your transport class created?
    --Rob

  3. #3
    Join Date
    May 2004
    Location
    Dallas, TX
    Posts
    1,032

    Default

    In the component file I have the following
    Code:
    Enable = function (self)
        print ("ElkM1EZ8:Enable()")
        local b = Super.Enable (self)
    
        --table.print (self.Settings)
        if self.Settings.Communications.Type then
            self.ElkM1EZ8 = Classes.ElkM1EZ8Class:New (table.copy(self.Settings))
        end
    
        return b
    end,
    Rick

    Girder 5.0 - Elk M1 Gold - JRMC 11.1 w/ M-Audio Delta 410 - NetRemote 2.0 - Panasonic KX-TA624 Phone System - ZoneMinder DVR
    Girder 5 Plugins - Elk M1/EZ8, Email Manager, Girder Backup, Ocelot, xAP Speedfan, xAP Ping, xAP Zoneminder and many more.


    Visit My Showcase

  4. #4
    Join Date
    May 2004
    Location
    Cardigan, UK
    Posts
    9,278

    Default

    Is anything actually calling your Subscribe method?
    --Rob

  5. #5
    Join Date
    May 2004
    Location
    Dallas, TX
    Posts
    1,032

    Default

    My transport class is based on the MediaBridge class, it does not contain an Event, Subscribe or Unsubscribe methods. I am sure there is something missing in the chain just not sure what.
    Rick

    Girder 5.0 - Elk M1 Gold - JRMC 11.1 w/ M-Audio Delta 410 - NetRemote 2.0 - Panasonic KX-TA624 Phone System - ZoneMinder DVR
    Girder 5 Plugins - Elk M1/EZ8, Email Manager, Girder Backup, Ocelot, xAP Speedfan, xAP Ping, xAP Zoneminder and many more.


    Visit My Showcase

  6. #6
    Join Date
    May 2004
    Location
    Dallas, TX
    Posts
    1,032

    Default

    Here is a sample which illustrates the behaviour.
    Attached Files Attached Files
    Rick

    Girder 5.0 - Elk M1 Gold - JRMC 11.1 w/ M-Audio Delta 410 - NetRemote 2.0 - Panasonic KX-TA624 Phone System - ZoneMinder DVR
    Girder 5 Plugins - Elk M1/EZ8, Email Manager, Girder Backup, Ocelot, xAP Speedfan, xAP Ping, xAP Zoneminder and many more.


    Visit My Showcase

  7. #7
    Join Date
    May 2004
    Location
    Cardigan, UK
    Posts
    9,278

    Default

    The MediaBridge component is based on Components.Classes.InstancesContainer which handles subscribing to the instances' publishers. Your component is based on Components.Classes.Provider which doesn't call Subscribe. So the events are going nowhere as far as I can tell.

    Not sure at the moment what the solution is - I'm taking ibuprofen for muscle pain and it always makes my brain a bit fuzzy.
    --Rob

  8. #8
    Join Date
    May 2004
    Location
    Dallas, TX
    Posts
    1,032

    Default

    Not sure how/if this matters, but if I do a self:Event(self.Events.AnEvent) from the component file, the provider file sees the event, it just does not see it if it comes from the transport class file.

    Do I need to add the subscribe, unsubscribe and event methods to my component file?
    Rick

    Girder 5.0 - Elk M1 Gold - JRMC 11.1 w/ M-Audio Delta 410 - NetRemote 2.0 - Panasonic KX-TA624 Phone System - ZoneMinder DVR
    Girder 5 Plugins - Elk M1/EZ8, Email Manager, Girder Backup, Ocelot, xAP Speedfan, xAP Ping, xAP Zoneminder and many more.


    Visit My Showcase

  9. #9
    Join Date
    May 2004
    Location
    Cardigan, UK
    Posts
    9,278

    Default

    The base component already has those methods, but you'll probably want to add some code to your enable function to subscribe to the transport's publisher - something like :-
    Code:
    if self.ElkM1EZ8 then
        self.ElkM1EZ8:Subscribe(function(self, ...) self:Event(unpack(arg)) end)
    end
    --Rob

  10. #10
    Join Date
    May 2004
    Location
    Dallas, TX
    Posts
    1,032

    Default

    Added this and it appears to work.
    Code:
    if self.ElkM1EZ8 then
        self.ElkM1EZ8:Subscribe(function(...) self:Event(unpack(arg)) end)
    end
    Thanks Rob.
    Rick

    Girder 5.0 - Elk M1 Gold - JRMC 11.1 w/ M-Audio Delta 410 - NetRemote 2.0 - Panasonic KX-TA624 Phone System - ZoneMinder DVR
    Girder 5 Plugins - Elk M1/EZ8, Email Manager, Girder Backup, Ocelot, xAP Speedfan, xAP Ping, xAP Zoneminder and many more.


    Visit My Showcase

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •