Telit AppZone Programming Tips



Similar documents
GSM. Quectel Cellular Engine. GSM TCPIP Application Notes GSM_TCPIP_AN_V1.1

Quectel Cellular Engine

JAVA Program For Processing SMS Messages

SMTP-32 Library. Simple Mail Transfer Protocol Dynamic Link Library for Microsoft Windows. Version 5.2

GSM. Quectel Cellular Engine. HTTP Service AT Commands GSM_HTTP_ATC_V1.2

ADH8060/8066 GSM/GPRS Module

ADL User Guide for Open AT V4.10

Now you can compile and upload your code supporting highier buffered serial input data. */

Session NM059. TCP/IP Programming on VMS. Geoff Bryant Process Software

µtasker Document FTP Client

Lab 4: Socket Programming: netcat part

Servo Motor API nxt_motor_get_count nxt_motor_set_count nxt_motor_set_speed

ACTi SDK C Library Edition v1.2 SP1. API Reference Guide

Implementing SPI Master and Slave Functionality Using the Z8 Encore! F083A

LAB 1. Familiarization of Rational Rose Environment And UML for small Java Application Development

Quectel Cellular Engine

! " # $ %& %' ( ) ) *%%+, -..*/ *%%+ - 0 ) 1 2 1

Linux Driver Devices. Why, When, Which, How?

Introduction to Object-Oriented Programming

Wireless Communication With Arduino

Division of Informatics, University of Edinburgh

Introduction to Synoptic

Yun Shield Quick Start Guide VERSION: 1.0 Version Description Date 1.0 Release 2014-Jul-08 Yun Shield Quick Start Guide 1 / 14

Quectel Cellular Engine

Hardware Prerequisites Atmel SAM W25 Xplained Pro Evaluation Kit Atmel IO1 extension Micro-USB Cable (Micro-A / Micro-B)

How To Use An Adh8012 Gsm Gprs Module With A Gsm (Gsm) Gpros (Gsp) Gpls (Geo) Gsp (Gpl) Gs

First Java Programs. V. Paúl Pauca. CSC 111D Fall, Department of Computer Science Wake Forest University. Introduction to Computer Science

TivaWare Utilities Library

App Note. VoxStack GSM Gateway API

Easy Script in Python ST10020a Rev

System Calls Related to File Manipulation

Capabilities of a Java Test Execution Framework by Erick Griffin

Chapter 46 Terminal Server

CS170 Lab 11 Abstract Data Types & Objects

GSM Click - Cross-Platform Development Quick Start Guide

Control III Programming in C (small PLC)

Exceptions in MIPS. know the exception mechanism in MIPS be able to write a simple exception handler for a MIPS machine

VoxStack GSM Gateway API. Version: Author: Joe.Yung

CSE 308. Coding Conventions. Reference

Using AT commands to control TCP/IP stack on SM5100B-D modules

CSI 402 Lecture 13 (Unix Process Related System Calls) 13 1 / 17

Illustration 1: Diagram of program function and data flow

Operating System Structure

13. Publishing Component Information to Embedded Software

SIMCom_3G_SSL_Application Note_V1.10

Virtuozzo Virtualization SDK

U-HID Pac-LED64 PacDrive U-HID LEDs

FREQUENTLY ASKED QUESTIONS FOR THE WI-FI SOFTWARE DEVELOPER'S KIT (SDK)

Jorix kernel: real-time scheduling

ECE 122. Engineering Problem Solving with Java

CC-Link Network Monitor Function

XMOS Programming Guide

Importing Excel File using Microsoft Access in SAS Ajay Gupta, PPD Inc, Morrisville, NC

Freescale Semiconductor, I

Chapter 5 Real time clock by John Leung

TCPIP Application Note for WCDMA Solution V2.0

MXwendler Javascript Interface Description Version 2.3

COSC 6397 Big Data Analytics. Distributed File Systems (II) Edgar Gabriel Spring HDFS Basics

GM862 Arduino Shield

Appendix B RCS11 Remote Communications

WIRELESS ALARM MONITORING. User Manual V1.2

RN-131-PICTAIL & RN-171-PICTAIL Evaluation Boards

WiFly Command Reference, Advanced Features & Applications User s Guide

What is an RTOS? Introduction to Real-Time Operating Systems. So what is an RTOS?(contd)

Table of Contents. Cisco How to Download a Software Image to a Cisco 2600 via TFTP Using the tftpdnld ROMmon Command

Elvey is a leading distributor of electronic security equipment in Africa. Our vision is to assist in the protection of people and property by

System Data V/IPedge Feature Description IPedge Feature Desc. 6/25/13

SQLITE C/C++ TUTORIAL

SIM800 Series_IP_Application Note_V1.02

TLM-2.0 in Action: An Example-based Approach to Transaction-level Modeling and the New World of Model Interoperability

Parameter Passing. Standard mechanisms. Call by value-result Call by name, result

SuperGuard Tracking Center TSSR 3.1 Server Software

How To Run A Test File Extension On A Rexx (Unix) On A Microsoft Linux (Amd64) (Orchestra) (For Windows) (

1) Which of the following is a constant, according to Java naming conventions? a. PI b. Test c. x d. radius

Security OpenSSL SSL. Roberta Daidone.

Operating System Manual. Realtime Communication System for netx. Kernel API Function Reference.

Basic Java Syntax. Program Structure

USER MANUAL V5.0 VT300

Building Conferencing Applications Using Intel NetStructure Host Media Processing Software

Advanced Scripting Techniques for Automating Regression Tests and Measurements with the Code Composer Studio Scripting Utility

Event Monitor Application Note 80000NT10028a Rev

MPLAB Harmony System Service Libraries Help

CSE 1223: Introduction to Computer Programming in Java Chapter 2 Java Fundamentals

MODBUS MASTER/SLAVE Serial and Ethernet Communication Server

DEVICE DRIVERS AND TERRUPTS SERVICE MECHANISM Lesson-14: Device types, Physical and Virtual device functions

OpenAMP Framework for Zynq Devices

Last Class: OS and Computer Architecture. Last Class: OS and Computer Architecture

CSC230 Getting Starting in C. Tyler Bletsch

Event Log Messages. 2. ports: port <id> is now off-line

- Redundancy and Load Balancing -

NS3 Lab 1 TCP/IP Network Programming in C

Channel Access Client Programming. Andrew Johnson Computer Scientist, AES-SSG

How To Port A Program To Dynamic C (C) (C-Based) (Program) (For A Non Portable Program) (Un Portable) (Permanent) (Non Portable) C-Based (Programs) (Powerpoint)

GPS+GSM+GPRS. AVL Automatic Vehicle Tracker PST-AVL01

Siemens S7 MPI Driver Help Kepware Technologies

Network packet capture in Linux kernelspace

Programmation RMI Sécurisée

Transcription:

Telit AppZone Programming Tips Table of Contents Basic Operations... 2 1. Print messages to UART... 2 2. Working with processes... 3 3. File System... 4 4. Timers... 5 5. SMS... 6 6. AT Commands... 7 7. PDP Context... 7 Page 1 of 7

Basic Operations 1. Print messages to UART In order to print messeges to the UART use 1 of the 2 functions: void PrintToUart(const char *fmt,...); M2M_T_HW_UART_RESULT m2m_hw_uart_write (M2M_T_HW_UART_HANDLE handle, char *buffer, int len, int *len_sent); PrintToUart("hello world"); int sent; M2M_T_HW_UART_HANDLE local_fd; local_fd = m2m_hw_uart_open(); if (M2M_HW_UART_HANDLE_INVALID!= local_fd) m2m_hw_uart_write(local_fd, "hello world", strlen("hello world"), &sent); m2m_hw_uart_close(local_fd); * extern void PrintToUart(const char *fmt,...); should be written in the functions prototypes section. Page 2 of 7

2. Working with processes In order to start a process work, use the following function: void m2m_os_send_message_to_task(short task_number, int type, long param1, long param2); Where the task_number is the number of the process and the other parameters represents the actions to be performed at the process. This function invokes the function: int M2M_msgProc1(int type, long param1, long param2) That is in M2M_proc1. m2m_os_send_message_to_task (1, 0, 0, 0); int M2M_msgProc1(int type, long param1, long param2) // the code to be executed in process 1 Page 3 of 7

3. File System The Telit AppZone allows you to get access to the module's file system and execute different operations on its files. There are several functions that can be used in order to work with the FS: int m2m_fs_clear(void); M2M_T_FS_HANDLE m2m_fs_open(char *filename, int mode); int m2m_fs_close(m2m_t_fs_handle filehandle); and many more. char FileName[20] = "An example file.txt"; m2m_fs_clear();//deletes all files from M2M file system PrintToUart("I'm running help function "Create_file()" now."); m2m_os_sleep_ms(2000); Create_file(FileName); /*Help function that include: 1)m2m_fs_create 2)m2m_fs_write 3)m2m_fs_close */ void Create_file (char *filename) M2M_T_FS_HANDLE file_handle = NULL; //Create handle by name file_handle. char buf[] = "Hello world!"; //Text that will be written in the created file. if(m2m_fs_success == m2m_fs_create(filename)) //Checks if file was created properly file_handle = m2m_fs_open(filename, M2M_FS_OPEN_APPEND);// On failure m2m_fs_open will return NULL. if(null!= file_handle) m2m_fs_write(file_handle, buf, sizeof(buf)); // Write "Hello world!" to the file. m2m_fs_close(file_handle); // Close the file. PrintToUart("Warning:For some reason the file couldn't be open."); PrintToUart("Warning:File wasn't created properly."); * It is a good practice to put the process to sleep for a few seconds between the functions calls, using the function: void m2m_os_sleep_ms(unsigned long ms); Page 4 of 7

4. Timers The Telit AppZone supports both software and hardware timer. There are 2 HW timers to customer and up to 30 SW timers available for use. SW Timer In order to work with sw timer, use the following functions: M2M_T_TIMER_HANDLE m2m_timer_create(m2m_t_timer_timeout cb, void *arg); void m2m_timer_start(m2m_t_timer_handle timer, unsigned long msecs); To create the timer and start its work. M2M_T_TIMER_HANDLE user_timer; user_timer = m2m_timer_create(timer_handler_function, NULL); m2m_timer_start(user_timer,5000); //start the timer after 5 seconds void timer_handler_function(void *arg) PrintToUart("hello"); // hello will be printed to the UART every second m2m_timer_start(user_timer,1000); // recall the timer every second HW Timer In order to work with hw timer use the following function: int m2m_hw_timer1_start(unsigned int span); On timeout, the G30 will call the onhwtimer1() callback function. m2m_hw_timer1_start(1000); // will call the M2M_onHWTimer1 function void M2M_onHWTimer1(void) // the code to be executed in timer 1 Page 5 of 7

5. SMS To send SMS message, use the function: int m2m_sms_send_sms(char* address, char* message); int M2M_msgProc1(int type, long param1, long param2) int smsresult; //Touch unused variables to avoid warnings (void)type; (void)param1; (void)param2; m2m_sms_set_text_mode_format(); PrintToUart("SET TEXT FORMAT"); m2m_os_sleep_ms(5000); PrintToUart("Sending Message: Hello World!! To: +9725461693045"); smsresult = m2m_sms_send_sms("+9725461693045", "Hello World!!"); m2m_os_sleep_ms(5000); if (1 == smsresult) // success PrintToUart("SMS WAS SENT"); PrintToUart("SMS WAS NOT SENT"); return 0; * It is a good practice give the application couple of seconds delay, using timer, before accessing process 1. void init_timeout_handler(void *arg) PrintToUart("Start SMS Application"); m2m_os_send_message_to_task(1,0,0,0); (void) arg; user_timer = m2m_timer_create(init_timeout_handler, NULL); m2m_timer_start(user_timer, 10000); Page 6 of 7

6. AT Commands To send AT commands to your module, use the function: int m2m_os_iat_send_at_command(char *atcmd); void SendATE1() int atresult; \\ sends ate1 command to the module atresult = m2m_os_iat_send_at_command("ate1\r\n"); if (1 == atresult) // success PrintToUart("AT command WAS SENT"); PrintToUart("AT command WAS NOT SENT"); * make sure to add the "\r\n" suffix to the at command string you are sending. 7. PDP Context The PDP related functions are: int m2m_pdp_activate(char *apn, char *name, char *pwd); \\ Activates a PDP context. int m2m_pdp_deactive(void); \\ Deactivates a PDP context. int m2m_pdp_get_status(void); \\ Gets the status of the PDP connection unsigned long m2m_pdp_get_my_ip(void); \\ Gets the IP addr of the PDP connection. void Activate_PDP() int res = 0; PrintToUart("START ACTIVATE PDP"); m2m_os_sleep_ms(3000); if (M2M_PDP_STATE_ACTIVE!= m2m_pdp_get_status()) res = m2m_pdp_activate(gprs_apn, NULL, NULL); //PrintToUart ("PDP ACTIVATE res=%d",res); if (M2M_PDP_STATE_FAILURE == res) PrintToUart ("PDP ACTIVATE FAIL"); return; PrintToUart ("PDP IS ALREADY ACTIVATE "); Page 7 of 7