User Guide to Q4000/QPRO 12.2.5 Making “Hello, World!” The process of modifying an application, then downloading and running it on the modem, can be demonstrated by altering the Turnkey application to print “Hello, world!” to the Logger port. CONFIDENTIAL Information classified Confidential - Do not copy (See last page for obligations) 1. In the IAR workspace window, expand the Turnkey group by clicking on the ‘+’ and then double-clicking on APL.c.
User Guide to Q4000/QPRO 2. Use Ctrl/F to search for POWER_ON. In the function processEvent(), you should see the line case POWER_ON: Figure 12-18: Modify Turnkey APL.c by adding a printf statement 4. After making the modification, select Make (F7) to save the changes and rebuild the project. If there are errors shown in the bottom window, correct these and rebuild. This creates the new binary file, TurnKey.
User Guide to Q4000/QPRO Figure 12-19: Logger output with "Hello, World!" 12.2.6 Additional detail on Turnkey The Turnkey application allows the user to set configuration parameters to control when it sends a report and what is contained in the report data. The application can report a GPS position fix, DIO and Analog values, as well as CAN data. It accepts parameter changes received over the air or from a serial port. It can also accept an application update over GPRS.
User Guide to Q4000/QPRO Figure 12-20: Turnkey main task loop We have seen in the Turnkey application how processEvent() handles a power-on sequence. Depending on the settings of the configuration parameters, it initializes the satellite and GPRS modules, starts the GPS and sets timers to check for GPS and to transmit message timeouts. There is a single TIMER event which occurs when any of the timers has a timeout.
User Guide to Q4000/QPRO 12.3 QuickStart application The QuickStart application provides the minimum framework to build a custom application on the Q4000/QPRO. It starts the main application task and lists the events used by the foundation to signal actions to the application. 1. Close any APL.c file that is still open before opening the QuickStart APL.c, in order to avoid the confusion of having two APL.c files open at the same time.
User Guide to Q4000/QPRO Figure 12-22: QuickStart switch statement The instructions for building, loading and executing the code are the same as in Section 12, except that after building the application, the executable bin file is: …/QuickStart/exe/QuickStart.bin. Since QuickStart is simply a template and is included as a starting point for a user’s custom application, no examples of running the QuickStart application will be shown. 12.4 DemoApp applications To run the DemoApps, close any open APL.
User Guide to Q4000/QPRO 12.4.1 DemoAppGSM DemoAppGSM sets a timer to first send out a short message via GSM and then sets a timer to send out a short report via satellite. It uses network-specific calls to do this. It continues to alternate between GSM and satellite messages until the application is stopped. The timers are hardcoded to 60 seconds and are not adjustable from any program parameters. Figure 12-23: DemoAppGSM - Selecting the Workspace 2. Now build, load and execute DemoAppGSM.
User Guide to Q4000/QPRO CONFIDENTIAL Information classified Confidential - Do not copy (See last page for obligations) 3. After startup, check the Logger output for the line APL DEMO: GSM then Orbcomm. This indicates that the correct DemoApp is running. Figure 12-24: DemoAppGSM - Logger output that DemoAppGSM is running Document Number 1135-4713 Rev G Page 87 THIS DOCUMENT CONTAINS CONFIDENTIAL AND PROPRIETARY INFORMATION OF QUAKE GLOBAL CORPORATION.
User Guide to Q4000/QPRO Information classified Confidential - Do not copy (See last page for obligations) CONFIDENTIAL In the POWER_ON, case statement, the application calls TIMER_setDuration() and sets it to expire after GSM_DEMO_GSM_TIMEOUT_SECS. This causes a TIMER event to occur when the timer expires. Figure 12-25: DemoAppGSM - Setting the timer Document Number 1135-4713 Rev G Page 88 THIS DOCUMENT CONTAINS CONFIDENTIAL AND PROPRIETARY INFORMATION OF QUAKE GLOBAL CORPORATION.
User Guide to Q4000/QPRO CONFIDENTIAL Information classified Confidential - Do not copy (See last page for obligations) When the timer expires, the foundation code generates a TIMER event which triggers the application’s processEvent() function. APL.c then executes the case TIMER in the EVENT switch. There it checks the msgSentViaGSM flag to see if a message has been sent via the terrestrial network (GPRS). If not, it reads the DIO’s and sends a message via the GSM/GPRS network.
User Guide to Q4000/QPRO 12.4.2 DemoAppSERIAL This sample application demonstrates some of the Q4000/QPRO’s serial port and multitasking functionality. DemoAppSerial may be used with either the AUX port, or the MTS or Logger port. It is necessary to use a different method with the AUX port than with the MTS or Logger port. DemoAppSerial first shows the use of the AUX port to send data. Note that this sample application uses network-specific calls. The AUX port • maximum speed is 57600 bps.
User Guide to Q4000/QPRO 2. Now build, load and execute DemoAppSERIAL. The instructions for building, loading and executing the code are the same as in Section 12, except that after building the application, the executable bin file is: …/DemoAppSERIAL/exe/xxx-DemoAppSERIAL.bin. Figure 12-28: DemoAppSERIAL - Logger output that DemoAppSERIAL is running 4. It is necessary to open a Terminal Emulation program window to access the AUX port for this example.
User Guide to Q4000/QPRO the data are ready to be processed. When the Serial Port example begins, APL.c waits for data to be input to the AUX port. As it is typed in, it is echoed back to the port. The application waits for ten seconds, ten characters to be input, or a carriage return to be entered. Once any of those conditions occur, the modem sends the string via either satellite or GSM/GPRS to the configured address.
User Guide to Q4000/QPRO 12.4.2.2 Receiving data from the MTS or Logger port DemoAppSERIAL demonstrates how to receive data from the AUX port. In order to also receive data from either the Logger or MTS port, it is necessary to set the serial port mode in the application. There are two options for port mode: PORT_MODE_PROTOCOL and PORT_MODE_APL. • PORT_MODE_APL passes all serial port data to the application.
User Guide to Q4000/QPRO Information classified Confidential - Do not copy (See last page for obligations) CONFIDENTIAL 2. Figure 12-31 shows that in the main processing loop, a callback function, checkSerRxData(), is called when serial port data are received (case APL_SERRXDATA_MSG). Figure 12-31: DemoAppSERIAL - Setting serial data callback function Document Number 1135-4713 Rev G Page 94 THIS DOCUMENT CONTAINS CONFIDENTIAL AND PROPRIETARY INFORMATION OF QUAKE GLOBAL CORPORATION.