2- Programs in Niagara framework iot. Action Slots | Importing Modules | Niagara Developer tutorial

In IoT Development


2- Programs in Niagara framework iot. Action Slots | Importing Modules | Niagara Developer tutorial - read the full article about IoT Development, IoT Development and Internet of Things technologies from Iot Easily on Qualified.One
alt
Iot Easily
Youtube Blogger
alt

hello everybody welcomes back to the  Niagara framework developer tutorial today we are going to talk more about the  program in Niagara, by the way, I will keep my videos to be short and brief hopefully  you will like it actually I received many useful comments since I posted my first video so  here I thank all of you guys for your supporting and I quoted one of the reviews which I found it  useful for todays topic here is some brief points first, we dont need to package the program object unless we plan to deploy in a jar file or  even there is a need to add permissions actually jarring is good as it uses less resources  as the program become standard components and also remember that once the program in  a jar its a component and we cant use the program editor on that component so in order  to make changes we need to go back to the program module and re-build a new  jar again and then re-deploy it also, we need to pay attention not to loop  or hang in programs as a program object runs on the engine thread which could cause an engine  watchdog timeout if they hang up the engine thread today we will talk about action slots as we have  seen before in the previous video the program contains three methods which are generated  automatically the first one is onStart this will be triggered after the component created  or in one stage of starting the station the second one is onStop this will  be triggered when the component is deleted or when the station is turning off and  the last one is onExecute which will be triggered automatically when any input has been changed how  about if we would like to add a new action slot actually we can add another  action slot by selecting slot tab and add slot choosing the program from  the type list and after then we take the class of programAction, let me rename this  slot and let me say its for createPoints now we need to implement the function for  this action slot by going back to the editor the function name will follow the structure of  adding "on" than the name of that action slot and we need to care that the first letter is  a capital letter so here we take this name and will be like on created points and then for example if we would  like to add a control point programmatically to a specific location this location can be made by adding an ord object which is an object resolution  descriptor for that path and in my case, I set the path under the station  under the config so how we get this path we can easily go to the config and check the path so you  can see this is a pass for the config station slot and in order to use ord object,  we have to import that the class by going back to the imports and then import  type and select under the baja we select Ord after that we need to resolve that location by  calling get, so to add control point we need to import from control module first by going  back to the import and selecting import type selected from the control module and under  the control module we can find a BooleanPoint and by going back to the editors we can  add the boolean point to that location we can see here in this function actually its  easy to know what is the documentation or what is a description for that function so for  instance if we need to check about this "add" function for a component we can easily go back  to the help and check the help documentation and when im clicking help content and  if we go to search about BComponent so we can find this action or this function  inside these functions take two parameters the first is the name for that element  you need to add and the element itself and if you can see the element here  is BValue and in our case, its a ControlPoint which is BBooleanPoint so  let me check about this BBooleanPoint.

and as you can see here in the documentation  for BBooleanPoint its extended from this class and if we going through its hierarchy we can  see like its really come from the BValue and extend from BComponent  BComplex until we reach that BValue by the way, the action slots are designed  to be invoked mainly so if we compile this code and by going and run this code we can see the point is created programmatically thats all for today thank you and  I hope my video helped you guys and again if you have any question  or suggestion about my future videos welcome to leave your comments  below see you in the next video

Iot Easily: 2- Programs in Niagara framework iot. Action Slots | Importing Modules | Niagara Developer tutorial - IoT Development