JKI State Machine Objects

cancel
Showing results for 
Search instead for 
Did you mean: 

Calling APIs

Hi,

I was wondering how to best call APIs from anywhere in a program? Looking at the example below, from the TestLauncher it is clear, you wire the relevant smo class object to the API and it works, but do i have to maintain a SMO class wire for all objects which i want to use an API for? Or is there a better way to tell the API which smo object to use?

smo.png

Regards

Mas

0 Kudos
Message 1 of 6
(9,274 Views)

Hi Mas,

Thanks for the question. Each SMO will have its own API (collection of public methods that users of the class can call), so yes you will need to have the SMO class wire in order to be able to call API methods for that specific SMO.

I hope this helps,

Javier

Javier Ruiz - Partner at JKI
jki.net
vipm.io
0 Kudos
Message 2 of 6
(8,523 Views)

If i am using more then one instance of the same Smo and want to register events

In the same event structure it gets a little confusing as the event structure list exactly the same events multiple times. Is there any more "elegant" way to deal with it?

Also is it possible (or usefull) to somehow pass reference to smo as a part of event data?

Thanks

Vlad

Sent from Samsung tablet

0 Kudos
Message 3 of 6
(8,523 Views)

I see,

Lets say I want to use APIs from one smo in two other smo's what would be the best way to pass the smo referance to both of those smo's?

Is it the same if those two smo's are lunched at seperat times?

Thanks

Mas

0 Kudos
Message 4 of 6
(8,523 Views)

Hi losikv

About the event structure, you could change the name of the events wire using the Variant to Data primitive, so that they don't have the same name:

EventsName.png

Passing the reference of the SMO in the event data is possible. I would recommend that you carefully think of your specific application so that you don't create a "leaky abstraction".

Javier Ruiz - Partner at JKI
jki.net
vipm.io
0 Kudos
Message 5 of 6
(8,523 Views)

Mas,

You can do this by creating a method for each of your "other" SMOs that takes another SMO.YourSMO as input and call that method before Starting the other SMOs. It does not matter if the other SMOs are started at different times as long as the wire that you pass from your SMO.YourSMO is taken after the CREATE method.

I hope this helps.

Javier Ruiz - Partner at JKI
jki.net
vipm.io
0 Kudos
Message 6 of 6
(8,523 Views)