We strongly encourage users to use Package manager for sharing their code on Libstock website, because it boosts your efficiency and leaves the end user with no room for error. [more info]
Rating:
Author: MIKROE
Last Updated: 2019-09-20
Package Version: 1.0.0.0
mikroSDK Library: 1.0.0.0
Category: GSM+GPS
Downloaded: 3681 times
Not followed.
License: MIT license
Thingstream Click is a gateway Click board which provides a simple and reliable connection to the Thingstream Cloud platform, a cloud-based rapid prototyping environment, hosted by Thingstream AG.
Do you want to subscribe in order to receive notifications regarding "Thingstream Click" changes.
Do you want to unsubscribe in order to stop receiving notifications regarding "Thingstream Click" changes.
Do you want to report abuse regarding "Thingstream Click".
Library Description
Library provides functions for powering up device, sending commands and controlling device, and function for parsing data read from GPS module.
Key functions:
void thingstream_cmd_single ( char *p_cmd )
- Fucntion for sending commands to devicechar *thingstream_gps_parser (char *data_in, char *cmd, uint8_t data_pos)
- Function for parsing GPS datavoid thingstream_module_power ( uint8_t power_state )
- Function for powering up moduleExamples description
The application is composed of three sections :
void application_task ( )
{
char *p_data;
char rsp_com[ 50 ] = {0};
if ( gps_rsp_ready == 0 )
{
mikrobus_logWrite( " - Waiting to GPS to start... ", _LOG_LINE );
thingstream_cmd_single( &THINGSTREAM_GPS_INFO[ 0 ] );
p_data = thingstream_gps_parser( &demo_buf[ 0 ], &demo_cmd[ 0 ], 1 );
strcpy( &rsp_com[ 0 ], p_data );
while ( rsp_com[ 0 ] != '1' )
{
thingstream_cmd_single( &THINGSTREAM_GPS_INFO[ 0 ] );
p_data = thingstream_gps_parser( &demo_buf[ 0 ], &demo_cmd[ 0 ], 1 );
strcpy( &rsp_com[ 0 ], p_data );
Delay_ms( 1000 );
}
mikrobus_logWrite( " - GPS - ", _LOG_LINE );
gps_rsp_ready = 1;
int_flag = 0;
}
else
{
thingstream_cmd_single( &THINGSTREAM_GPS_INFO[ 0 ] );
while ( int_flag != 1 );
int_flag = 0;
}
mikrobus_logWrite( " ---------------------------------------- ", _LOG_LINE);
p_data = thingstream_gps_parser( &demo_buf[ 0 ], &demo_cmd[ 0 ], 3 );
if ( p_data == 0 )
{
mikrobus_logWrite( " Latitude : No data available!", _LOG_LINE);
}
else
{
strcpy( &rsp_com[ 0 ], p_data );
mikrobus_logWrite( " Latitude : ", _LOG_TEXT );
mikrobus_logWrite( rsp_com, _LOG_LINE );
}
Delay_ms( 500 );
p_data = thingstream_gps_parser( &demo_buf[ 0 ], &demo_cmd[ 0 ], 4 );
if ( p_data == 0 )
{
mikrobus_logWrite( " Longitude : No data available!", _LOG_LINE);
}
else
{
strcpy( &rsp_com[ 0 ], p_data );
mikrobus_logWrite( " Longitude : ", _LOG_TEXT );
mikrobus_logWrite( rsp_com, _LOG_LINE );
}
Delay_ms( 500 );
p_data = thingstream_gps_parser( &demo_buf[ 0 ], &demo_cmd[ 0 ], 5 );
if ( p_data == 0 )
{
mikrobus_logWrite( " Altitude : No data available!", _LOG_LINE);
}
else
{
strcpy( &rsp_com[ 0 ], p_data );
mikrobus_logWrite( " Altitude : ", _LOG_TEXT );
mikrobus_logWrite( rsp_com, _LOG_LINE );
}
mikrobus_logWrite( " ---------------------------------------- ", _LOG_LINE);
mikrobus_logWrite( " ", _LOG_LINE);
Delay_ms( 5000 );
}
Additional Functions :
All additional functions such as timer initialization and default handler.
Other mikroE Libraries used in the example:
Additional notes and informations
Depending on the development board you are using, you may need USB UART click, USB UART 2 click or RS232 click to connect to your PC, for development systems with no UART to USB interface available on the board. The terminal available in all MikroElektronika compilers, or any other terminal application of your choice, can be used to read the message.