In general, the integration of the protocol needs: 1) a start/stop control and 2) a dialog window to introduce the parameters of the protocol. In order to do so, several modifications of the code have to be done.
- Creation of new variables.
- Define all the additional variables required to hold the parameters of the protocol (e.g., speed, force limit, waiting time, etc.) in the structure data-instrument located at the file ltdata.h.
- In case these new defined variables need default values, initialize them in the function InitInstrument() located at the file ltdata.h.
- Define an event variable that starts the protocol in the enumeration of events located in the file ltcontrol.h.
- Define an event variable that opens the dialog window. This variable has to be included in the enumerated list of window events located in the file ltcontrol.h.
- Changes in the nib file. The main.nib file contains the information about the user interface, which can be easily modified using the application Interface Builder. The nib file has to be modified in order to include the new graphical objects (e.g., windows, buttons, sliders, text boxes, etc.) required to control the protocol.
- The graphical interface is organized so that all the start/stop controls of the protocols are located in a radio button. So a new option in the radio button that selects our new designed protocol has to be created.
- Create the graphical design of the dialog window (labels, text boxes, enter button, etc.) where the user introduces the values of the parameters of the protocol.
- Changes in already existing functions.
- Define mouse clicks that activate the protocol as a new case in the AppEventHandler() function located in the ltosx.c.
- Define mouse clicks that make the dialog window as a new case in the AppEventHandler() function located in the ltosx.c.
- Include the instructions to make the dialog window in the UtilityWindow() function in the ltosx.c file. The instructions are: 1) read and create the window from the nib file, 2) install the event handler, 3) show the window, and 4) dispose other windows.
- Include the calling of the protocol algorithm in the ControlTimer() function in the ltcontrol.c file.
- Include the event that creates the dialog window in the ControlEvent() function in the ltcontrol.c file.
- Include the event that starts the protocol in the ControlEvent() function in the ltcontrol.c file. Other automatic orders that have to be simultaneously started along with the protocol (e.g., write a comment, switch writing speed, etc.) are included here.
- Definition of new functions.
- Define the get values dialog function in the ltosx.c file. This function reads the values of the parameters located in the text boxes of the dialog window and stores them in the variables defined in the data-instrument structure. This function is activated when the protocol starts or the enter button is pushed.
- Define the update dialog function in the ltosx.c file. This function reads the values stored in the data-instrument structure and updates the dialog box accordingly.
- Define the event handler (i.e., a C function) for the dialog window in the ltosx.c file. This function detects the events produced within the window and calls the two previous functions to get or update the values.
After all these changes have been made to the code, this has to be recompiled in order to make them functional.