Module server examplecgpsexample.php v30 (requires cgps.php v82 or greater)
cgps.php v85 (supports module firmware up to version: Rev9:864 / Rev5..8:all)

This functional example server program shows you how to:
- receive the data and respond to it when a module transmits to your computer.
- use the CGPS class to extract information from received module data and how to upload things like commands/data to a module.
- store incoming module transmissions in a database (including a simple user interface to create/display/search/.. a database).
- forward incoming data in a dedicated format to a device, server script or program that can not make use of the CGPS class directly.

Read the documentation that is mixed in the source code of this program in a text editor (or a PHP editor but do NOT use a Word processor)
and make just a few custom changes where marked to make this server program functional for your computer and turn it into server.
But that is only a small part of the code, the biggest part is removable and exists only for you to easily experiment with
data and database creation/storage/decoding/manipulation, including uploading commands/settings/firmware/... to the module.


These links can be used to manually simulate a module transmission to your server (their date/time is updated on each browser refresh).
Your server will receive and handle the incoming data and return a response, which your browser will display as something like: *A#G OK
www.YourServer.com/YourScript.php?YourVariableName=1234567|ceH-9w0DNJM1SL3G4Tfj9w01k1E7d0r0--0G0qvfJu42
www.YourServer.com/YourScript.php?YourVariableName=1234567|ceH-9w0FGMs1SO22u2dzBw0JjTaelMd02x0S04hCKu42
www.YourServer.com/YourScript.php?YourVariableName=1234567|ceH-9w0ZDv4O05GB00Tgp0shyfs000000000008V2c02|ceH-9w0l10Q1LTiO07VzQw10mo2elMd42BkS02JCKuk2|ceH-9E5cwv0Q-Y3-M35N3v-0kU2BvM-3J000002P0c02|ceH-9w0BaVQ1MGObliNFK_00dL1ZF0beJ00Ew2GZBY02|ceH-9yzGXq5v50000exx0iwRfvM0000jn04N00380c00|ceH-9yzGXq602w000exD0g0000000000000000000c00|ceH-9BhEqndD5i1FsO1x87dBsCBxr21QpndQ00210c00|ceH-9AhOqnpM6mlOey1arSxKeO1jt65QtncW84NLos06|ceH-9ChFrCtN6i1zon9DrPIwimVSrSBzpjEwcj8Pdc06|ceH-9zkSdPxO1000001N500Hkcn22000J00y002Z0c06|ceH-9H003glEqNtZvQIg0c0bvlH50g40001g0gc0SY43
With the extra decoding feature, you can manually decode module data strings. Click one to see the decoding result of various CGPS class functions.
1234567|ceH-9w0DNJM1SL3G4Tfj9w01k1E7d0r0--0G0qvfJu42
1234567|ceH-9w0FGMs1SO22u2dzBw0JjTaelMd02x0S04hCKu42
1234567|ceH-9w0ZDv4O05GB00Tgp0shyfs000000000008V2c02|ceH-9w0l10Q1LTiO07VzQw10mo2elMd42BkS02JCKuk2|ceH-9E5cwv0Q-Y3-M35N3v-0kU2BvM-3J000002P0c02|ceH-9w0BaVQ1MGObliNFK_00dL1ZF0beJ00Ew2GZBY02|ceH-9yzGXq5v50000exx0iwRfvM0000jn04N00380c00|ceH-9yzGXq602w000exD0g0000000000000000000c00|ceH-9BhEqndD5i1FsO1x87dBsCBxr21QpndQ00210c00|ceH-9AhOqnpM6mlOey1arSxKeO1jt65QtncW84NLos06|ceH-9ChFrCtN6i1zon9DrPIwimVSrSBzpjEwcj8Pdc06|ceH-9zkSdPxO1000001N500Hkcn22000J00y002Z0c06|ceH-9H003glEqNtZvQIg0c0bvlH50g40001g0gc0SY43
Additional functions: view available info per Switch Value   view recent error log part   view full error log   create/erase error log

Database SQL query examples

Create database: CREATE DATABASE DataBaseName    Create table: CREATE TABLE TableName ( Recor...    Delete table: DROP TABLE TableName    Delete database: DROP DATABASE DataBaseName
Receptions: SELECT * FROM TableName ORDER BY Record DESC LIMIT 50
Positions: SELECT * FROM TableName WHERE Switch>=SV_LowestPositionSwitch AND Switch<=SV_HighestPositionSwitch GROUP BY Data ORDER BY DateTime DESC, Record DESC LIMIT 50
Positions2: SELECT * FROM TableName WHERE EventID!=0 GROUP BY Data ORDER BY Record DESC LIMIT 50
Start+stop+counters: SELECT * FROM TableName WHERE (((EventID&1023)=40) OR ((EventID&1023)=41) OR (Switch=SV_Counters) OR (Switch=SV_CountersHighestSpeed) OR (Switch=SV_RestartAnnouncement) OR (Switch=SV_PowerUp) OR (Switch=SV_SettingsAccepted)) GROUP BY Data ORDER BY DateTime DESC, Record DESC LIMIT 50
Photos/data: SELECT * FROM TableName WHERE (Switch>=SV_Photo AND Switch<=SV_PhotoGps) OR (Switch=SV_LogDataHeader) GROUP BY Data ORDER BY Record DESC LIMIT 50
Other than positions and photos: SELECT * FROM TableName WHERE (Switch<SV_Photo OR Switch>SV_PhotoLogData) AND Switch!=SV_LogData AND EventID=0 ORDER BY Record DESC LIMIT 50

SQL: real