PDA

View Full Version : Problem with Instances



dsmes
May 19th, 2007, 02:13 PM
I have a simple CCF that is intended to trigger events in G4. The CCF is in NRD version 1.0 file format because it runs on a Win-98 tablet running NR v1.1.0.44. On that tablet, NR Properties/Plugins/Girder instance pointing to the G4 machine was assigned an instance of -1000. Girder sees the NR instance and is able to set NR variables on the tablet. So communication seems OK.

Here's the problem: When I press a button with "Send Event To Girder" as the action, Girder doesn't see it. In NRD, the button has action IDs of -1,0,1 and -2001,0,1 (two actions for the same button). -2001 points to the G4 instance I want to receive the action. But in NR on the Win-98 tablet, the Girder instance is -1000 which is why I suspect Girder doesn't see the button press. But I thought the -1 instance action was sent to all girders. How do I get this to work? I can't find a way to change the instance number from -1000 to -2001 or vice versa.

If I run the CCF on the same machine as Girder with NR v2.0.0.90, the button messages do make it to Girder. That is, everything works.

I don't know if this is related, but I'm running NRD v1.1.0.42 with the image degradation fix and when I right-click on the CCF System/Properties, I get a "unhandled exception" error saying "Could not load type com.promixis.FileVersionInfo from assembly NetRemoteControl, Version=1.0.2676.40395, Culture=neutral, PublicKeyToken=null." I also get the same error if I click on the "New" button.

Ben S
May 19th, 2007, 08:18 PM
-1 sends to the -current- instance, whereas the other instance ID sends to that -specific- instance.

If you go into the plugin properties in NetRemote you can right click on an option (or tap and hold in PPC) and choose "Set ID".

dsmes
May 20th, 2007, 07:39 AM
Thanks Ben, that got it working!

dsmes
March 7th, 2009, 06:54 AM
In G5 I changed the port number and strengthened the password on the Communication Server to increase security. In NR I created new Girder instances in the Settings/Plugins/Girder setup. Now, like before, NR buttons that send an event to Girder no longer work. I forgot about the method above of right-clicking on the instance setting in NR and changing its ID. Instead, I started going into NRD and changing the button actions to send the girder event to the new instance. That worked, but...

There must be a better way! Is there a NRD "Send event to Girder" action that is sent to ALL listening Girder instances?

Rob H
March 7th, 2009, 07:31 AM
No, I'm afraid not - it is possible to do this using Lua by iterating over all the Girder plugin instances though.

dsmes
March 7th, 2009, 09:17 PM
it is possible to do this using Lua by iterating over all the Girder plugin instances though.I'll give that a try. What method do I use?

Rob H
March 8th, 2009, 05:01 AM
Something like this



function GirderBroadcast(command)
local girder = NetRemote.GetPlugin('Girder')
assert(girder, 'Girder plugin not found!!!!')
local instances = girder:GetInstances()
assert(instances and type(instances) == 'table' and table.getn(instances) > 0, 'No Girder instances found!!!')
local sent = false
table.foreach(instances,
function(id, instance)
if id ~= -1 then -- we don't want to send to the default instance twice
instance:ExecuteAction(0, 1, command)
sent = true
end
end)
if not sent then
-- could happen if there is one Girder plugin instance with a real id of -1
local instance = girder:GetCurrentInstance()
if instance then
instance:ExecuteAction(0, 1, command)
end
end
end