Page 3
Chapter 1 Table of contents Chapter 1 Table of contents Cover Chapter 1 Table of contents Chapter 2 Declaration of conformity Chapter 3 Specifications Chapter 4 General specifications 4.1 Translation 4.2 Copyright 4.3 General descriptive names 4.4 Safety instructions 4.4.1 Use of the hazard warnings 4.4.2 General safety instructions 4.4.3 Safety and preventative measures for handling GSM/GPRS modems 4.4.3.1 Safety and precautionary measures for the GSM/GPRS modem installation...
Page 4
6.3 Storage 6.4 Transport 6.5 Return Chapter 7 Installation 7.1 Dimensions 7.2 Installing the rapidM2M T32x 7.2.1 Installation on magnetic surfaces 7.2.2 Installation using adhesive pad 7.2.3 Installation using screws 7.2.4 Installation using an Action-Cam bracket 7.3 Safety instructions for connecting additional sensors and the alternative power supply 7.3.1 Information on preventing electrostatic discharges (ESD)
Page 5
Chapter 1 Table of contents 9.1 User interface on the rapidM2M T32x 9.1.1 Operating elements 9.1.1.1 Solenoid switch 9.1.1.2 RGB-LED 9.1.1.3 Micro vibration motor 9.2 User interface on the myDatanet server 9.2.1 Site configuration 9.2.1.1 Site 9.2.1.2 Comments 9.2.1.3 Control 9.2.1.4 Configuration 0 - Configuration 9...
Page 6
11.3 "Site" area at customer level 11.3.1 Reports 11.3.2 Map view 11.4 Recommended procedure 11.4.1 Creating the site Chapter 12 rapidM2M Studio 12.1 General 12.2 Prerequisites 12.3 Project dashboard 12.4 CODEbed 12.5 TESTbed Chapter 13 Device Logic (Pawn) 13.1 General 13.1.1 Direct entry of a device logic 13.1.2 Uploading a binary file 13.1.3 Using the CODEbed of the web-based development environment rapidM2M Studio...
Page 7
Chapter 1 Table of contents 13.2.5.3 Functions 13.2.6 Position 13.2.6.1 Arrays with symbolic indices 13.2.6.2 Constants 13.2.6.3 Functions 13.2.7 Math 13.2.8 Char & String 13.2.9 CRC & hash 13.2.9.1 Arrays with symbolic indices 13.2.9.2 Functions 13.2.10 Various 13.2.10.1 Arrays with symbolic indices 13.2.10.2 Constants 13.2.10.3 Functions 13.2.11 Console...
Page 9
Chapter 1 Table of contents 13.4.4.2 Initialisation 13.4.4.3 Progressive initialisation for arrays 13.4.4.4 Multi-dimensional arrays 13.4.4.5 Arrays and the "sizeof" operator 13.4.5 Operators and expressions 13.4.5.1 Notational conventions 13.4.5.2 Expressions 13.4.5.3 Arithmetic 13.4.5.4 Bit manipulation 13.4.5.5 Assignment 13.4.5.6 Comparative operators 13.4.5.7 Boolean 13.4.5.8 Other 13.4.5.9 Priority of the operators...
Page 10
13.4.7.3 Standard values of function arguments 13.5 Differences to C Chapter 14 Data Descriptor 14.1 Data structure 14.1.1 Division of a structured measurement data channel into individual data fields 14.1.2 Division of a configuration memory block into individual data fields 14.1.3 Division of the aloha data into individual data fields 14.1.4 Attributes of the field definition 14.2 Example...
Page 11
Chapter 2 Declaration of conformity Chapter 2 Declaration of conformity Rev. 01...
Page 13
Chapter 3 Specifications Chapter 3 Specifications Voltage supply Rechargeable battery: LiPo cell with 500mAh Alternative ext. power 3...5VDC supply Charging voltage 5VDC via USB-C connector Housing Material: MJF-PA12 Weight: Degree of protection: IP64 Dimensions (WHD): 66 x 52 x 21mm Operating temperature -20...+60°C Air humidity...
Page 14
The DeviceConfig configuration program must be installed on the PC or the web-based development environment rapidM2M Studio must be used to enable communication with the rapidM2M T32x . Additional information is provided in "Technical details about the USB interface"...
Page 15
4.4 Safety instructions For the connection, commissioning and operation of the rapidM2M T32x , the following information and higher legal regulations of the country (e.g. ÖVE), such as valid EX regulations as well as the applicable safety and accident prevention regulations for the respective application case must be observed.
Page 16
4.4.1 Use of the hazard warnings DANGER: Indicates a potential or threatening hazardous situation that will result in death or serious injuries if not avoided. WARNING: Indicates a potential or threatening hazardous situation that can result in death or serious injuries if not avoided.
Page 17
Chapter 4 General specifications In addition to the following safety considerations, all directives of the country in which the device is installed must be complied with. Important note: No liability shall be assumed at any time and under no circumstances for connections via a GSM/GPRS modem for which wireless signals and networks are utilized.
Page 18
4.5 Overview Top of the rapidM2M T32x Left side of the rapidM2M T32x 1 RGB-LED (freely usable) 2 Pressure compensation 3 USB-C connector (only for charging the rechargeable battery, debugging and device logic development/update) Rev. 01...
Page 19
A Managed Service contract with Microtronics Engineering GmbH is required for use of the mobile data transmission (see www.microtronics.com/managedservice). This includes the provisioning of the mobile communications connection via the network of the service provider included in the above-mentioned list.
Page 20
The rapidM2M T32x provides the user with a memory area for their data (3MB ) as well as 10 independent memory blocks each with 4000 Byte for the configuration data. In addition to the 4 registration memory blocks each with 1kB , that are saved in the flash, the rapidM2M T32x has another one that can optionally be initialised via the "rM2M_RegInit()"...
Page 21
Chapter 4 General specifications 4.8 Device labelling The specifications in this user manual apply exclusively to the rapidM2M T32x device type. The type plate is located on the left side of the device and contains the following specifications: Type designation...
Page 22
4.10 Storage of the product To safeguard the rapidM2M T32x , ensure that all of the relevant data has been transferred to the myDatanet server. If necessary, initiate a transmission directly on the device using the solenoid contact (see "Solenoid switch"...
Page 23
For safety and warranty reasons, all internal work on the instruments beyond from that involved in normal installation and connection, must be carried out only by qualified Microtronics personnel or persons or companies authorised by Microtronics .
Page 24
4.14 Personnel requirements Installation, commissioning and maintenance may only be completed by personnel who meet the following conditions: Qualified specialist personnel with the relevant training Authorised by the facility operator Note: Qualified personnel In the context of these instructions and the warnings on the product itself, individuals responsible for the setup, installation, commissioning and operation of the product must have gained relevant qualifications relating to their activities, including, for example: Training, instruction and authorisation to activate/deactivate, ground and label electric circuits and...
Page 25
Functional principle only accessible when the housing is open 1 rapidM2M T32x with integrated managed service SIM chip (including data transmission) 2 Application created by the customer (device logic) that collects and records the data (see"Device Logic (Pawn)" on page 89)
Page 26
The data blocks, on the other hand, are stored by the firmware of the rapidM2M T32x (see "rM2M_ RecData()"). The time of the synchronisation and the type of connection must also be determined by the application created by the customer.
Page 27
393.216 Byte The internal data memory of the rapidM2M T32x is designed as a circular buffer with 8 sectors. If the entire memory (3MB ) is full, the sector with the oldest data is deleted fully before new data can be saved in this sector again.
Page 28
Note: Additional explanation regarding the functionality of the circular buffer Data memory after the first data is recorded: Data memory once 3MB has been recorded Data memory if further data is recorded once 3MB has already been recorded Note: Additional explanation on calculating the data volume to be saved: To provide a clear and simple overview, the following example assumes that the sectors can only record two complete data records.
Page 29
This memory block is only available if it was initialised via the "rM2M_RegInit()" function. The size of the PAWN binary must not exceed 256kB for the transmission to the rapidM2M T32x . If necessary, the data area of the PAWN binary can be compressed using a compiler instruction (#pragma amxcompress <0-3>).
Page 30
5.4 Procedure in case of connection aborts If the connection is terminated, another attempt to establish a connection is made after 2min. for all connections, except for "online" mode. Up to 2 attempts to establish a connection are made. Connection could be established during first retry. Connection could not be established despite 2 retries.
Page 31
5.5 Automatic selection of the GSM network The GSM network to which the device should register must be selected, as the rapidM2M T32x is equipped with a SIM chip that provides a mobile connection via a variety of international service providers (see www.microtronics.com/footprint ).
Page 32
5.8 Registration memory blocks In addition to 4 1kB blocks, that are saved in the flash, another one, that is saved in the RAM, can optionally be initialised via the "rM2M_RegInit()" function. Its size can be specified during initialisation, although it is limited to a maximum of 1kB .
Page 33
Chapter 5 Functional principle pipCtx Name of the site that should be created/used [2-50 characters]. pipAppId ID of the IoT application based on which the site should be created [max. 50 characters]. pipAppVer (optional) Version of the Device Logic currently installed on the device (e.g. 7) [Integer]. pipCtxAutocreate (optional) Indicates whether the site (if it does not exist yet) should be created ("0"...
Page 34
5.10 Meaning of the SIM state The device receives information about the permissible use of the SIM chip from the myDatanet server. The following states are defined for this SIM status: Transmission via Device SIM state Explanation Logic RM2M_SIM_STATE_NONE Initial state RM2M_SIM_STATE_ New device is in stock PRODUCTION...
Page 35
Store the measurement technology so that it is protected against corrosive and organic solvent vapours, radioactive emissions and strong electromagnetic radiation. 6.4 Transport Protect the rapidM2M T32x against heavy shocks, bumps, impacts or vibrations. The original packaging must always be used for transport. 6.5 Return Every return must be accompanied by a fully field-out return form.
Page 37
7.1 Dimensions Dimensions: Width and height Dimensions: Depth 7.2 Installing the rapidM2M T32x Important note: Ensure installation is completed correctly. Comply with existing legal and/or operational directives. Improper handling can cause injuries and/or damage to the devices.
Page 38
T32x has been inserted into the bracket. This can be advantageous for applications where it must be determined if the rapidM2M T32x is located in the bracket (e.g. theft detector). However, it can be problematic for application where the solenoid switch is used for operation.
Page 39
Chapter 7 Installation 2. Insert the bottom of the rapidM2M T32x into the bracket (2) first. The logo on the rapidM2M T32x should be facing to the front (see "Inserting the rapidM2M T32x - step 1" on page 39). Turn slightly around the horizontal axis so that the rapidM2M T32x clicks into the bracket.
Page 40
You can use the "T32x Bracket with magnet (301146)" for applications where it must be determined if the rapidM2M T32x is located in the bracket (e.g. theft detector). In this case, use the adhesive pad instead of the neoprene pad to install the bracket (see "Installation on magnetic surfaces" on page 38).
Page 41
Chapter 7 Installation 2. Insert the bottom of the rapidM2M T32x into the bracket (2) first. The logo on the rapidM2M T32x should be facing to the front (see "Inserting the rapidM2M T32x - step 1" on page 41). Turn slightly around the horizontal axis so that the rapidM2M T32x clicks into the bracket.
Page 42
You can use the "T32x Bracket with magnet (301146)" for applications where it must be determined if the rapidM2M T32x is located in the bracket (e.g. theft detector). The position and size of the holes for the screws is identical for the brackets.
Page 43
Chapter 7 Installation 3. Insert the bottom of the rapidM2M T32x into the bracket (1) first. The logo on the rapidM2M T32x should be facing to the front (see "Inserting the rapidM2M T32x - step 1" on page 43). Turn slightly around the horizontal axis so that the rapidM2M T32x clicks into the bracket.
Page 44
If additional sensors or an alternative power supply are going to be connected to the rapidM2M T32x , the following warnings and information must also be observed, such as the warnings and information found in the individual chapters on installation.
Page 45
Chapter 7 Installation 7.4 Electrical installation Important note: Only qualified personnel should undertake the installation described in this chapter of the operating instructions to avoid any damage to the device. 7.4.1 Connection of additional sensors and the alternative power supply Important note: All soldering and wiring work must be performed in the de-energised state.
Page 46
1. As illustrated in the following figure, insert a small slotted screwdriver into the notch on the bottom of the rapidM2M T32x and release the cover by moving the screwdriver up and down. Opening the housing 1 Housing cover 2 Slotted screwdriver 2.
Page 47
Chapter 7 Installation 4. If they are small enough, position your additional sensors in the intended area and connect the sensors with the corresponding pins of the extension interface. On the inside of the housing cover, you will also find a description of the assignment of the extension interface. Use a suitable method to secure the additional sensors and simultaneously insulate them electrically from the electronic system (e.g.
Page 48
Then apply pressure to all four of the corners of the rapidM2M T32x until the housing cover is fully engaged. You will hear a little clicking noise.
Page 49
Explanations regarding the functionality of the DeviceConfig configuration program is provided in the chapter "DeviceConfig " on page 63. Access to the web-based development environment rapidM2M Studio is included in the Microtronics Partner Program, for which you can register free of charge at the following address: https://partner.microtronics.com...
Page 51
Study the manual thoroughly before placing into operation to prevent faulty or incorrect configuration. Utilise the manual to familiarise yourself with the operation of the rapidM2M T32x and the input screens of the myDatanet server before you begin with the configuration.
Page 52
T32x . If no device logic has been loaded into the device yet, you can use rapidM2M Studio to transfer the command to establish a connection to the rapidM2M T32x via the USB connection, wait until the next cyclic transmission (every 24h ) or open the housing and briefly disconnect the battery from the electronic system and then connect it again (see "Connection of additional sensors and the alternative...
Page 53
With the exception of the "Online" connection type (see "rM2M_TxSetMode()"), the time during which the rapidM2M T32x is connected to the server is very short. It can therefore also be checked whether the time stamp of the last connection (under the green status symbol) has been updated.
Page 55
Chapter 9 User interfaces Chapter 9 User interfaces The configuration of the rapidM2M T32x is carried out via the web interface on the myDatanet server (see "User interface on the myDatanet server" on page 56), which your responsible sales partner will provide to you.
Page 56
9.1.1.2 RGB-LED The state of the RGB-LED can be controlled by the "T32_LedOn ()"and "T32_LedOff()" device logic functions. 9.1.1.3 Micro vibration motor The micro vibration motor can be controlled by the "T32_VibeOn ()"and "T32_VibeOff()" device logic functions. 9.2 User interface on the myDatanet server 9.2.1 Site configuration Note: Depending on the respective user level, some of the configuration fields mentioned in the following sub- chapters may be hidden.
Page 57
Device logic Device logic deactivated type Pawn Activates device logic processing and informs the rapidM2M T32x that the device logic is a "Pawn script". Device logic Pawn source Device logic Input window for editing the device logic that is loaded into...
Page 58
9.2.1.5 Alarm settings Acknowledgement Standard The global server setting is used to determine whether alarms must be acknowledged automatically or manually. automatic Alarms are acknowledged automatically as soon as all of the messages have been sent. If SMS that have a tariff with a delivery confirmation function have also been sent, acknowledgement is provided after delivery confirmation.
Page 59
Chapter 9 User interfaces 9.2.1.6 Basic settings Time zone Regional settings (not relevant for raw measurement data as this is stored in UTC) Daylight saving time Configuration for automatic time adjustment Standard The configuration for the time adjustment is adopted by the global server setting.
Page 60
9.2.2 Device configuration Note: Several of the configuration fields in the following sub chapters may possibly be hidden depending on the respective user level. In this case, contact the myDatanet server administrator. You can reach the input screen for configuring the device by clicking on the serial number in the site list (see "myDatanet Server Manual "...
Page 61
(malfunctions may occur). Identification String specifying the hardware platform implemented in the device and the corresponding hardware version (i.e. the rapidM2M module identification). Hardware version Hardware version of the rapidM2M T32x 9.2.2.3 GPRS SIM tariff Selected SIM tariff...
Page 63
10.1 General The DeviceConfig configuration program can be downloaded free of charge from the following website: www.microtronics.com/deviceconfig The tool is used for configuration, maintenance, fault analysis and synchronisation purposes. It is compatible with all myDatanet devices equipped with a USB interface, wireless M-bus interface or Bluetooth Low Energy.
Page 64
The configuration program DeviceConfig communicates directly with the rapidM2M T32x via a USB connection. The functions provided with the DeviceConfig configuration program include: Read out and analysis of the device log (see ""Log" tab" on page 71) Update the firmware(see ""Firmware"...
Page 65
10.4 Installation The following chapter describes the installation process in Windows 7. 1. Execute the "InstDeviceConfig.exe" file to start the installation process. Note: Only connect the device or USB BLE-Adapter (300685) to your PC once the installation process has completed as the required drivers are only installed during this process. DeviceConfig setup wizard Rev.
Page 66
2. Follow the instructions of the setup wizard until the following screen is displayed. The following drivers must be installed to ensure correct operation. Installation of the USB drivers for the devices Installation of the drivers for the USB BLE-Adapter Installation of the USB drivers for the devices on a M1 basis Installation of the USB drivers for the devices on a M2/M3 basis Rev.
Page 67
3. Once the following screen is displayed, close the installation process by clicking on the "Finish" button. Complete the setup 10.5 Menu of the DeviceConfig 10.5.1 Settings "Settings" menu item 10.5.1.1 Options The settings for the COM ports to which the USB radio transmitter (206.657) or the USB BLE-Adapter (300685) are connected can be specified and the automatic search for the available firmware versions can be activated or deactivated via the "Settings ->...
Page 68
"Settings -> Options" menu item 1 Activates/deactivates the automatic search for the 4 COM port that is connected with the USB radio USB radio transmitter (206.657) on all of the transmitter (206.657) (only visible when the available COM ports automatic search is deactivated) 2 Activates/deactivates the automatic search for the 5 COM port that is connected with the USB BLE- USB BLE-Adapter (300685) on all of the available...
Page 69
10.6 Connecting a Device via USB 1. Start the DeviceConfig configuration program. DeviceConfig 2. Connect the rapidM2M T32x to the PC using a USB cable. 3. Select your device based on the serial number from the list of devices found. List of devices found...
Page 70
4. Wait until the DeviceConfig has received the configuration of the device. Depending on the device, additional tabs may be displayed. "Sync" tab when actively connected to the rapidM2M T32x Rev. 01...
Page 71
10.7 "Log" tab This tab is designed to manage log entries. It enables the entries to be loaded from the rapidM2M T32x , to be saved as a *.tsv file and entries to be deleted from the memory of the rapidM2M T32x .
Page 72
Colour Evaluation White Information regarding the current operating state Green Light blue Blue Purple Grey Yellow Uncritical error Critical error "Log" tab with detailed view activated 1 Activates the detailed display of the log entries 3 Log entry that is always displayed 2 Informative log entry that is only visible if the detailed display is activated Rev.
Page 73
10.8 "Firmware" tab This tab enables firmware to be installed directly via the USB interface or the Bluetooth Low Energy interface. There are two available ways to update the firmware: Using a previously downloaded firmware package By directly loading from the myDatanet server "Firmware"...
Page 75
Chapter 11 myDatanet server Chapter 11 myDatanet server Note: All of the screenshots show version 49v011 of the myDatanet server using the standard colour scheme. Newer versions may include minor changes to the appearance of the server. 11.1 Overview Overview of the myDatanet server 1 Freely selectable logo 5 Opens the screen to input the global settings for the server...
Page 76
11.2 "Customer" area Overview of the "Customer" area 1 Area where an image file can be displayed as a "Map" and/or the OpenStreetMaps map can be displayed The sites can be manually placed on the image file used as a "map". In the OpenStreetMaps map, the sites are only displayed once GPS coordinates have been assigned to the site.
Page 77
Chapter 11 myDatanet server 3 List of tags that are assigned to at least one of the customers displayed in the list of customers. If the list of customers was limited by the search field or selection of a tag, this is taken into consideration when creating the list of tags.
Page 78
11.3 "Site" area at customer level Overview of the "Sites" area at customer level 1 Area where an image file can be displayed as a "Map" and/or the OpenStreetMaps map can be displayed The sites can be manually placed on the image file used as a "map". In the OpenStreetMaps map, the sites are only displayed once GPS coordinates have been assigned to the site.
Page 79
Chapter 11 myDatanet server 4 Symbol that represents a site on the "Map" 5 Symbol via which a OpenStreetMaps map, on which the sites are displayed, can be loaded. (see "Map view" on page 79) 6 Symbol via which an image file can be loaded on to the server as a "Map" To remove the "Map"...
Page 80
2. Click on the "Customer" menu item of the myDatanet server to call up the list of available customers. Select an existing customer or create a new customer. Selecting the customer 1 Menu item to call up the list of customers 3 List of available customers 2 Creating a new customer 3.
Page 81
Chapter 11 myDatanet server 4. If necessary, change the suggested name of the site, select the desired site type or the desired application from the drop-down list and then click the "Add" button. Completing site creation 1 Name of the site (freely selectable) 3 "Add"...
Page 83
It is a web-based IDE that is designed to support customers with the creation of IoT applications for the rapidM2M T32x . This covers the entire development process - from editing the source code, to testing as part of the creation process to publishing the finished IoT application in the rapidM2M Store . All elements which make up an IoT application are summarised in a single project.
Page 84
12.2 Prerequisites Interfaces 1 x USB Operating system Windows 7 Windows 10 (recommended) MacOS 10.12 or higher Linux (Fedora 32, Ubuntu 20.04, Archlinux 2020.06.01) Internet Required connection Required disk No installation required space Browser Google Chrome only Rev. 01...
Page 85
7 Tile that contains all important information about an IoT project 8 List of the "Collections" All projects that are not assigned to another "Collection" Favourite projects Sample libraries provided by Microtronics Samples provided by Microtronics "Collection" created by user 9 Button for creating a new "Collection"...
Page 86
12.4 CODEbed CODEbed of the rapidM2M Studio 1 Navigation panel 2 Back to the project dashboard 3 Editor panel 4 Compiler results incl. warnings and errors 5 Memory usage 6 Context-sensitive help 7 Installs the current binaries of the project on the device and backend (i.e. on the myDatanet server) and opens the TESTbed Rev.
Page 87
12.5 TESTbed TESTbed of the rapidM2M Studio 1 Debug console 2 First opens the window for selecting and connecting the "Device under test" and then the window for entering the access data for the "Backend under test" 3 Information on the "Device under test" 4 Watch panel 5 Information on the "Backend under test"...
Page 89
IoT application. The functional scope of the rapidM2M Studio also includes transfer of the compiled device logic into the rapidM2M T32x via a USB connection and copying of the data descriptor to the development site with which the rapidM2M T32x is linked.
Page 90
13.2 rapidM2M Device API 13.2.1 Constants Return codes for general purposes = 0, ERROR = -1, ERROR_PARAM = -2, // Parameter error ERROR_UNKNOWN_HDL = -3, // Unknown handler, handle or resource error ERROR_ALREADY_SUBSCRIBED = -4, // Already subscribed service or resource error ERROR_NOT_SUBSCRIBED = -5, // Not subscribed service error...
Page 91
Chapter 13 Device Logic (Pawn) 13.2.2 Timer, date & time 13.2.2.1 Arrays with symbolic indices TrM2M_DateTime Detailed breakdown of the date and time // year Year specified relates to the 21st century, i.e. 14 refers to the year 2014 // month Month // day // hour...
Page 92
native rM2M_GetDate(&year=0, &month=0, &day=0, timestamp=0); If no time stamp was transferred (timestamp=0), the date (year, month, day) is determined for the current system time (in UTC). Alternatively, the date (year, month, day) is determined for the transferred time stamp. Parameter Explanation year Variable to store the year - OPTIONAL...
Page 93
Chapter 13 Device Logic (Pawn) native rM2M_SetDateTime(datetime[TrM2M_DateTime], flags=0); Sets the system date and time to the values contained in the transferred structure Parameter Explanation datetime Structure that contains a detailed breakdown of the date and time (see "TrM2M_ DateTime" in chapter "Arrays with symbolic indices" on page 91). .timestamp = 0: The values contained in .year, .month, .day, .hour, .minute and .second are used to set the date/time.
Page 94
native rM2M_TimerAdd(funcidx); Generates a new 1s timer Parameter Explanation funcidx Index of the public function that should be called up following expiry of the timer Type of function: public func(); Explanation Return value OK, if successful ERROR if no valid index was transferred, in the event of an internal error or if no further timers can be created (maximum number reached) <...
Page 95
Chapter 13 Device Logic (Pawn) native rM2M_TimerAddExt(funcidx, bool:cyclic, time); Generates a new ms timer Parameter Explanation funcidx Index of the public function that should be called up following expiry of the timer Type of function: public func(); cyclic Setting for the behaviour following expiry of the timer interval: true: The timer must be restarted following expiry of the interval.
Page 96
13.2.3 Uplink 13.2.3.1 Arrays with symbolic indices TrM2M_GSMInfo Information regarding the GSM modem, SIM chip and the GSM network used during the last connection // cgmi Manufacturer identification of the modem // cgmm Modem model information // cgmr Modem revision information // imei International mobile equipment identity of the modem // imsi...
Chapter 13 Device Logic (Pawn) Connection flags Control flags for the rM2M_TxStart() function RM2M_TX_POSUPDATE = 0b00000001, /* Update of the GSM position data when establishing a connection RM2M_TX_REFRESH_CONFIG = 0b00000100, /* Additionally establishing a connection to the maintenance server RM2M_TX_SUPPRESS_POSUPDATE = 0b00001000,/* Suppress update of the GSM position data when establishing a connection RM2M_TX_POSUPDATE_ONLY...
Page 98
// general errors RM2M_TXERR_CONNECTION_TIMEOUT, // connection timed out RM2M_TXERR_NEWDATA_TIMEOUT, // timeout during server sync in online mode RM2M_TXERR_IRREGULAR_OFF, // irregularly closed connection RM2M_TXERR_SERVER_NOT_AVAILABLE, // server not available RM2M_TXERR_SERVER_COMMUNICATION, // error during communication with server // general modem errors RM2M_TXERR_MODEM = 10, // unspecified modem error RM2M_TXERR_MODEM_TIMEOUT, // timeout modem communication...
Page 99
Chapter 13 Device Logic (Pawn) RM2M_TXERR_WIFI_AP_SETTINGS, // access point settings not plausible RM2M_TXERR_WIFI_AP_CONNECT, // error connecting to access point RM2M_TXERR_WIFI_AP_NOT_FOUND, // access point not found during scan // TCP related WIFI errors RM2M_TXERR_WIFI_TCP = 240, // unspecified TCP related WIFI error RM2M_TXERR_WIFI_TCP_OPEN_TO, // timeout opening TCP connection RM2M_TXERR_WIFI_TCP_SEND_TO,...
Page 100
13.2.3.3 Callback functions public func(const data[], len, timestamp); Function to be provided by the script developer, that is called once a data record has been read (using the "rM2M_ReadData()" function) from the internal flash memory. Parameter Explanation data Array that contains the data of the read data record Length of the data area of the read data record in bytes (max.
Chapter 13 Device Logic (Pawn) 13.2.3.4 Functions native rM2M_TxStart(flags=0); triggers a connection to the server with subsequent synchronisation of all memory areas (measurement data, configuration, position data, device log, files,...) between the device and the server. Only those memory areas are transmitted whose content has been changed. If the device is in "online" mode and an active connection to the server is established then this function only triggers synchronisation.
Page 102
native rM2M_TxSetMode(mode, flags=0); Sets the connection type to be used. If the connection type is changed to "Online" or "Interval & wakeup", this is immediately followed by a connection being established incl. a synchronisation with the server, as long as this is not suppressed by the "RM2M_TXMODE_SUPPRESS_SYNC" flags being set.
Chapter 13 Device Logic (Pawn) Note: Additional explanation about the connection types Connection type Energy consumption Data volumes Response time online Interval & wakeup Interval native rM2M_TxGetStatus(&errorcode=0); Returns the current connection status Parameter Explanation errorcode Variable to store the error code that occurred during the last connection attempt RM2M_TXERR_NONE: Last connection establishment successful >...
Page 104
native rM2M_TxSelectItf(itf); Selects the communication interface to be used for the uplink Parameter Explanation Selection of the communication interface RM2M_TXITF_NONE: No uplink, communication with the server not possible RM2M_TXITF_MODEM: Mobile network modem RM2M_TXITF_WIFI: WiFi module RM2M_TXITF_LAN: LAN interface Explanation Return value OK, if successful ERROR, if the selected communication interface is not supported by the device or another error occurs...
Page 105
Chapter 13 Device Logic (Pawn) native rM2M_GSMGetInfo(info[TrM2M_GSMInfo], len=sizeof info); Returns information on the GSM modem, SIM chip and the GSM network used during the last connection Parameter Explanation info Structure for storing the information (see "TrM2M_GSMInfo" in chapter "Arrays with symbolic indices" on page 96) Size (in cells) of the structure to store the information - OPTIONAL Explanation Return value...
Page 106
native rM2M_RecData(timestamp, const data{}, len); Saves a data record in the internal flash memory. Use the "rM2M_Pack", "rM2M_SetPacked" or "rM2M_SetPackedB" functions to generate the data area. Parameter Explanation timestamp Time stamp that should be used for the recording = 0: The current system time is used as the time stamp. >...
Page 107
Chapter 13 Device Logic (Pawn) native rM2M_CfgInit(cfg, flags); Sets the configuration for a configuration memory block. Calling the function is only necessary if one of the configuration flags should be set. Parameter Explanation Number of the configuration memory block starting with 0 for the first memory block.
Page 108
native rM2M_CfgWrite(cfg, pos, const data{}, size); Saves the transferred data block at the specified position in a configuration memory block. Note that the configuration memory block is either saved in the RAM in a volatile manner (Bit0 = RM2M_CFG_ VOLATILE) or in the FLASH in a non-volatile manner (Bit0 = 0, default) depending on the type of storage selected via the "rM2M_CfgInit"...
Page 109
Chapter 13 Device Logic (Pawn) native rM2M_CfgRead(cfg, pos, data{}, size); Reads a data block from the specified position in a configuration memory block. The function is also informed which of the 10 available memory blocks in the internal flash memory should be read. Use the "rM2M_Pack", "rM2M_GetPacked"...
Page 110
native rM2M_CfgOnChg(funcidx); Specifies the function that should be called if one of the configuration memory blocks has changed Parameter Explanation funcidx Index of the public function that should be called if the configuration has changed Type of function: public func(cfg); Explanation Return value OK, if successful...
Page 111
Chapter 13 Device Logic (Pawn) 13.2.4.2 Functions native rM2M_SetPacked(data{}, pos, &{Float,Fixed,_}:value, size=4, bool:bigendian=false); Writes the transferred value to a specified position in an array Important note: Although this function will still be supported for the purpose of downward compatibility, it should no longer be used for new projects as the unsigned data types might lead to problems.
Page 112
native rM2M_SetPackedB(data{}, pos, const block[], size); Writes the transferred data block to the specified position in an array Parameter Explanation data Array that should be used as a data area for a data record or a configuration Byte offset within the array to determine the position where the data block should be written block Data block that should be written in the array...
Page 113
Chapter 13 Device Logic (Pawn) native rM2M_GetPacked(const data{}, pos, &{Float,Fixed,_}:value, size=4, bool:bigendian=false); Supplies the value that is located at the specified position in an array Important note: Although this function will still be supported for the purpose of downward compatibility, it should no longer be used for new projects as the unsigned data types might lead to problems.
Page 114
native rM2M_GetPackedB(const data{}, pos, block[], size); Reads a data block that is located at the specified position in an array Parameter Explanation data Array that should be used as a data area for a data record or a configuration Byte offset within the array to determine the position from which the data should be read block Array to store the data to be read...
Page 115
Chapter 13 Device Logic (Pawn) native rM2M_Pack(const data{}, pos, &{Float,Fixed,_}:value, type); Function to access packed data. If the Bit0 (RM2M_PACK_GET) of the "type" parameter was set, the function returns the value that is located at the specified position in the array. Otherwise the function writes the transferred value to the specified position in the array.
Page 116
13.2.5 Registry 13.2.5.1 Constants Indices of the registration memory blocks that can be accessed via the "rM2M_RegGetString()", "rM2M_RegGetValue()", "rM2M_ RegSetString()", "rM2M_RegSetValue()", "rM2M_RegDelValue()" and "rM2M_RegDelKey()" functions. Detailed information on the registration memory blocks is provided in chapter "Registration memory blocks" on page 32. //System-specific data RM2M_REG_SYS_OTP = 0, // once during production (recommended)
Page 117
Chapter 13 Device Logic (Pawn) 13.2.5.2 Callback functions public func(reg); Function to be provided by the script developer, that is called up if the registration has changed Parameter Explanation Index of the registration memory block (see "Indices of the registration memory blocks"...
Page 118
native rM2M_RegGetString(reg, const name[], string[], len=sizeof string); Reads a character string from a registration memory block. Detailed information on the registration memory blocks is provided in chapter "Registration memory blocks" on page 32. Parameter Explanation Index of the registration memory block (see "Indices of the registration memory blocks"...
Page 119
Chapter 13 Device Logic (Pawn) native rM2M_RegSetString(reg, const name[], const string[]); Writes a character string into a registration memory block. Detailed information on the registration memory blocks is provided in chapter "Registration memory blocks" on page 32. Parameter Explanation Index of the registration memory block (see "Indices of the registration memory blocks"...
Page 120
native rM2M_RegDelValue(reg, const name[]); Searches for an entry based on its name and sets the value of this entry (regardless of whether it is a string or value) to "null". Detailed information on the registration memory blocks is provided in chapter "Registration memory blocks"...
Page 121
Chapter 13 Device Logic (Pawn) native rM2M_RegOnChg(funcidx); Specifies the function that should be called up if one of the registration memory blocks has changed. Detailed information on the registration memory blocks is provided in chapter "Registration memory blocks" on page 32. Parameter Explanation funcidx...
Page 122
TrM2M_PosUpdateUMTS Information about a UMTS cell in the receiving range // type specifies the type of the entry (RM2M_POSUPDATE_TYPE_UMTS) // stamp Time when data was recorded // mcc MCC (Mobile Country Code) of the GSM cell // mnc MNC (Mobile Network Code) of the GSM cell // lac LAC (Location Area Code) of the GSM cell // cid...
Page 123
Chapter 13 Device Logic (Pawn) 13.2.6.2 Constants List of the supported types of cell/network information entries Possible types of cell/network information entries that can be read by the system via the function "rM2M_EnumPosUpdate()" RM2M_POSUPDATE_TYPE_ERR = 0, //invalid entry RM2M_POSUPDATE_TYPE_GSM = 1, //Information about a GSM cell RM2M_POSUPDATE_TYPE_UMTS = 2, //Information about a UMTS cell RM2M_POSUPDATE_TYPE_LTE = 3, //Information about an LTE cell...
Page 124
13.2.6.3 Functions native rM2M_SetPos(Lat, Long, Elev, Qual, SatUsed); Saves the GPS position information in the device. A historical record is not maintained. This means that the current position information always overwrites the last known position. The information is transmitted to the myDatanet server and can, for example, be read out via the API (see "API" on page 199).
Page 125
Chapter 13 Device Logic (Pawn) native rM2M_DecodeNMEA(const sentence{}, data[], len=sizeof data); Decodes a transferred NMEA data record Parameter Explanation sentence NMEA data record from a GPS receiver starting with the '$' character. Important note: The strings must be terminated ('\0') immediately after the checksum.
Page 126
native rM2M_SetPosNMEA(const Sentence{}); Takes the GPS position information from the transferred NMEA data record and saves it in the device. A historical record is not maintained. This means that the current position information always overwrites the last known position. The information is transmitted to the myDatanet server and can, for example, be read out via the API (see "API"...
Page 127
Chapter 13 Device Logic (Pawn) native rM2M_GetPos(&Lat, &Long, &Elev, &Qual=0, &SatUsed=0); Reads out the GPS position information saved to the device Parameter Explanation Variable to store the geographical latitude in degrees (resolution: 0.000001°) -90 000 000 = South pole 90° south 0 = Equator +90 000 000 = North pole 90°...
Page 128
native rM2M_EnumPosUpdate(...); lists the information saved in the device about the GSM/UMTS/LTE cells and WiFi networks in the receiving range. With this function a variable list of parameters is used. The parameters to be passed depend on the purpose. The following procedure is recommended: 1.
Page 129
Chapter 13 Device Logic (Pawn) native rM2M_GetGSMPos(posidx, pos[TrM2M_GSMPos]=0); Returns the number of GSM/UMTS/LTE cells for which valid information is saved to the device (posidx < 0) or reads out the information saved to the device about a GSM/UMTS/LTE cell in the receiving range (posidx >= 0) Note: Use the "rM2M_EnumPosUpdate()"...
Page 131
Chapter 13 Device Logic (Pawn) native max(value1, value2); Supplies the larger of the two transferred values Parameter Explanation value1 Two values of which the larger one is to be determined value1 Explanation Return value The larger of the two transferred values native clamp(value, min=cellmin, max=cellmax);...
Page 132
native Float:asin(Float:x); Arcsine(x) in the range [-π/2, π/2], x element of [-1, 1] native Float:acos(Float:x); Arccosine(x) in the range [0, π], x element of [-1, 1] native Float:atan(Float:x); Arctangent(x) in the range [-π/2, π/2] native Float:atan2(Float:y, Float:x); Arctangent(y/x) in the range [-π, π] native Float:sinh(Float:x);...
Page 133
Chapter 13 Device Logic (Pawn) 13.2.8 Char & String The mode of operation of the following functions essentially corresponds to that of the standard ANSI-C implementation: native strlen(const string[]); Supplies the length of the string (without '\0') Parameter Explanation string Character string for which the length has to be determined Explanation Return value...
Page 134
native strcat(dest[], const source[], maxlength=sizeof dest); Adds the source character string to the dest character string (including '\0') Parameter Explanation dest Array to store the result. This array already comprises one character string to which the source character string should be added. source Character string that should be added to the character string included in the array dest...
Page 135
Chapter 13 Device Logic (Pawn) native strrchr(const string[], char); Searches for a character (last occurrence) in a character string Parameter Explanation string Character string that should be searched Important note: Strings > 128 bytes are not supported! char Character that the search is looking for Explanation Return value -1, if the character that the search is looking for is not included in the...
Page 136
native strcspn(const string1[], const string2[]); Searches for the position of the first character in string1 that is also included in the character string of permitted characters (string2) Parameter Explanation string1 Character string that should be searched Important note: Strings > 128 bytes are not supported! string2 Character string of permitted characters Important note: Strings >...
Page 137
Chapter 13 Device Logic (Pawn) native strstr(const string1[], const string2[]); Searches character string2 in character string1 Parameter Explanation string1 Character string that should be searched Important note: Strings > 128 bytes are not supported! string2 Character string that the search should be for Important note: Strings >...
Page 138
native tolower(c); Converts a character into lower case Parameter Explanation Character that should be converted to lower case Explanation Return value The lower case variant of the transferred character, if available, or the unchanged character code of "c" if the letter "c" does not have a lower case equivalent. native toupper(c);...
Page 139
Chapter 13 Device Logic (Pawn) 13.2.9.2 Functions native CRC16(data{}, len, initial=0xFFFF); Returns the calculated modbus CRC16 of the transferred data Parameter Explanation data Array that contains the data for which the CRC16 should be calculated Number of bytes that must be taken into consideration during the calculation initial Initial value for calculating the CRC16 - OPTIONAL Explanation...
Page 140
13.2.10 Various 13.2.10.1 Arrays with symbolic indices TablePoint Two-column reference point table, integer data type // key Column that is searched // value Column with the result values that need to be returned #define TablePoint[.key, .value] TablePointF Two-column reference point table, float data type // key Column that is searched // value...
Page 141
Chapter 13 Device Logic (Pawn) 13.2.10.2 Constants Error codes for the "CalcTable" and "CalcTableF" functions const TAB_ERR_FLOOR = -1, // searched value lower than the first table entry TAB_ERR_CEIL = -2, // searched value higher than the last table entry 13.2.10.3 Functions native getapilevel();...
Page 142
native rtm_start(measurement[TRTM_Data]); Starts a runtime measurement Parameter Explanation measurement Structure for recording the information regarding a runtime measurement Important note: This structure must be persistent from calling up "rtm_ start()" to calling up "rtm_stop()". Explanation Return value OK, if successful ERROR, if an error occurs native rtm_stop(measurement[TRTM_Data]);...
Page 143
Chapter 13 Device Logic (Pawn) native CalcTable(key, &value, const table[][TablePoint], size = sizeof table); Searches for a certain value in the "key" column of the transferred reference point table and supplies the relevant value from the "value" column in the table. If the searched value is between two reference points, the returned value is interpolated linearly between the two adjacent values in the "value"...
Page 144
native rM2M_GetId(id[TrM2M_Id], len=sizeof id); Provides the information to identify the module/device Parameter Explanation Structure for storing the information to identify the module/device (see "TrM2M_ Id" in chapter "Arrays with symbolic indices" on page 140) Size (in cells) of the structure to store the information - OPTIONAL Explanation Return value Size (in cells) of the structure used to store the information...
Page 145
Chapter 13 Device Logic (Pawn) native getarg(arg, index=0); Supplies the value of the argument Parameter Explanation The sequence number of the argument. Use 0 for the first argument. index Index if "arg" refers to an array Explanation Return value This function supplies an argument from a variable argument list. If the argument is an array, the "index"...
Page 146
13.2.11 Console native print(const string[]); Prints the specified string to the standard output Parameter Explanation string The character string to be issued. This can include escape sequences. Explanation Return value native printf(const format[], {Float,Fixed,_}:...); Prints the transferred format string to the standard output. The mode of operation of the functions corresponds to that of the standard ANSI-C implementation.
Page 147
Chapter 13 Device Logic (Pawn) 13.2.12 File transfer 13.2.12.1 Arrays with symbolic indices TFT_Info Properties of a file entry // name Name of the file // stamp Time stamp of the file (seconds since 31.12.1999) // stamp256 Fraction of the next started sec. (resolution 1/256 sec.) // size File size in byte // crc...
Page 148
13.2.12.3 Callback functions public func(id, cmd, const data{}, len, ofs); Function to be provided by the script developer, that is called up when a file transfer command is received. The callback function must be able to handle all file transfer commands (see "File transfer commands"...
Page 149
Chapter 13 Device Logic (Pawn) 13.2.12.4 Functions native FT_Register(const name{}, id, funcidx); Registers a file made available by the PAWN script. Parameter Explanation name Unique file name Unique identification with which the file is then referenced (freely selectable) funcidx Index of the public function that should be called up if a file transfer command has been received Type of function: public func(id, cmd, const data{}, len, ofs);...
Page 150
native FT_SetProps(id, stamp, size, crc, flags); Sets the properties of a file Important note: This function must be called up following receipt of a "FT_CMD_LIST" command. Important note: Although this function will still be supported for the purpose of downward compatibility, it should no longer be used for new projects.
Page 151
Chapter 13 Device Logic (Pawn) native FT_Read(id, const data{}, len); Transmits the data to the system, to transfer it to the myDatanet server. The data must be provided by the callback function specified via "FT_Register()". Important note: This function must be called up following receipt of a "FT_CMD_READ" command.
Page 152
native FT_Written(id, len); Confirms that the data received from the myDatanet server has been written. The actual writing process must be executed via the callback function specified via "FT_Register()". The data that is to be written is transmitted to the callback function by the system (see "Callback functions" on page 148). Important note: This function must be called up following receipt of a "FT_CMD_WRITE"...
Page 153
Chapter 13 Device Logic (Pawn) 13.2.13.2 Constants Numbers of the GPIOs GPIO_0 = 0, // GPIO 0 or interrupt input 0 (LED_GPIO) GPIO_1 = 1, // GPIO 1 or interrupt input 1 (SWITCH_GPIO) //Number of GPIOs / IRQs that the rapidM2M T32x has GPIO_NUM = 2, 13.2.13.3 Callback functions...
Page 154
native T32_TempGet(funcidx=-1); Instructs the system to measure the temperature Parameter Explanation funcidx Index of the public function that should be executed when the measurement value for the temperature is ready. Type of function: public func(value); Explanation Return value OK, if successful ERROR, if an error occurs 13.2.14 GPIO, IRQ 13.2.14.1 Constants...
Page 155
Chapter 13 Device Logic (Pawn) 13.2.14.3 Functions native rM2M_GpioDir(gpio, dir); Sets the signal direction for a GPIO Parameter Explanation gpio Number of the GPIO, starting with 0 for GPIO1 Setting the signal direction: RM2M_GPIO_DISABLED : GPIO deactivated RM2M_GPIO_INPUT : Input RM2M_GPIO_OUTPUT : Output Explanation...
Page 156
native rM2M_GpioGet(gpio); Reads the signal level of a GPIO that was configured as an input Parameter Explanation gpio Number of the GPIO, starting with 0 for GPIO1 Explanation Return value RM2M_GPIO_LOW for "low" at the input RM2M_GPIO_HIGH for "high" at the input ERROR_BAD_STATE if the relevant GPIO was not configured as an input <...
Page 157
Chapter 13 Device Logic (Pawn) native rM2M_IrqClose(irq); Deactivates the interrupt functionality of an interruptible pin. Parameter Explanation Number of the interruptible pin, starting with 0 for INT0 Explanation Return value OK, if successful < OK, if an error occurs (see "Return codes for general purposes" in chapter "Constants"...
Page 158
13.2.15.3 Functions native rM2M_I2cInit(i2c, clock, config); Initialises the I C interface. Parameter Explanation Number of the I C interface, starting with 0 for I2C1 clock Clock frequency in Hz to be used. Please observe the valid limits for the module being used (see "Specifications"...
Page 159
Chapter 13 Device Logic (Pawn) native rM2M_I2cCom(i2c, adr, data{}, txlen, rxlen); Executes an I C communication. Data is first of all sent and data is then received. Parameter Explanation Number of the I C interface, starting with 0 for I2C1 Address of the I C slave (Bit7-Bit1, Bit0 unused) data...
Page 160
native rM2M_UartInit(uart, baudrate, mode, funcidx); Initialises the UART interface Parameter Explanation uart Number of the UART interface, starting with 0 for UART1 baudrate Baud rate to be used. Please observe the valid limits for the module being used (see "Specifications" on page 13). mode Bit 0...1 1 = 1 stop bit...
Page 161
Chapter 13 Device Logic (Pawn) native rM2M_UartSetbuf(uart, rxbuf{}, rxlen, txbuf{}, txlen); Provides the firmware for the selected UART interface with a sending and/or receiving buffer from the RAM area reserved for the script. When this function is called up, the system switches from the two buffers integrated in the firmware to the passed buffers.
Page 162
native rM2M_UartWrite(uart, const data{}, len); Sends data via the specified UART interface. Parameter Explanation uart Number of the UART interface, starting with 0 for UART1 data Array that contains the data to be sent Number of bytes to be sent Explanation Return value Number of processed bytes if successful...
Page 163
Chapter 13 Device Logic (Pawn) 13.2.16.2 Functions native T32_GPSInit (funcidx); Initialises the GPS module. Parameter Explanation funcidx Index of the public function that should be executed if a GGA frame is received from the GPS module Function type: public func(data[TNMEA_GGA], len); Explanation Return value OK, if successful...
Page 164
13.2.18 LED 13.2.18.1 Functions native T32_LedOn(color); Enables the RGB-LED to light up in the desired colour. Parameter Explanation color 24Bit colour code (0xRRGGBB) Explanation Return value OK, if successful native T32_LedOff(); Switches the RGB-LED off. Explanation Return value OK, if successful 13.2.19 Micro vibration motor 13.2.19.1 Functions native T32_VibeOn();...
Page 165
Chapter 13 Device Logic (Pawn) 13.2.20 Solenoid switch 13.2.20.1 Callback functions public func(key); Function to be provided by the script developer, that is called up when the state of the button changes. Parameter Explanation Indicates which state change called the function 0: Button was released 1: Button was pressed 13.2.20.2 Functions...
Page 166
13.3 Device Logic error codes If an error occurs while executing the Device Logic, the corresponding error code is entered in the device log and the Device Logic is restarted. If such an error occurs more than three times in 24 hours, the Device Logic is deactivated and error handling is activated (see "Error handling"...
Page 167
Chapter 13 Device Logic (Pawn) Log entry Parameter Description Code Plain text Code Plain text 3000 SCRIPT_ERR SCRIPT SYSTEM Reserved for extensions SHUTDOWN (2/2) (2/2) SCRIPT Connection aborted while downloading the DOWNLOAD device logic. ERROR Although this does not affect the existing Device Logic.
Page 168
Log entry Parameter Description Code Plain text Code Plain text 3016 AMX_ERR_ Out of memory MEMORY 3017 AMX_ERR_ P-code file format is invalid/not supported FORMAT 3018 AMX_ERR_ File is for a newer version of AMX VERSION 3019 AMX_ERR_ File or function not found NOTFOUND 3020 AMX_ERR_INDEX Invalid index parameter (invalid entry point)
Page 169
Chapter 13 Device Logic (Pawn) be blank space. A documentation comment is a comment that starts with "/** " (two stars and space after the second star) and ends with "*/". A comment that starts with "/// " (three forward slashes and a space after the third slash) is also a documentation comment.
Page 170
letter "e" (lower case) followed by an integer numerical constant. For example, "3.12e4" or "12.3e-3" are valid floating-point numbers with an exponent. 13.4.2 Variables 13.4.2.1 Declaration The keyword "new" declares a new variable. For special declarations, the keyword "new" is replaced with "static"...
Page 171
Chapter 13 Device Logic (Pawn) Example: new Float:a; // without initialisation (value is 0.0) new Float:b = 3.0; // with initialisation (value is 3.0) 13.4.3 Constant variables It is sometimes necessary to create a variable that is initialised once and is then not meant to be changed again.
Page 172
List: invalid declaration /* An array cannot be set to an individual new c[3] = 4 value */ /* only an array can hold a string */ new i = "Good-bye" /* Unknown size for an array */ new q[] /* Array initialisers must be constants */ new p[2] = { i + j, k - 3 } 13.4.4.3 Progressive initialisation for arrays...
Page 173
Chapter 13 Device Logic (Pawn) An array with one dimension comprises a number of elements and the "sizeof" operator returns this quantity. The code section below would therefore issue "5", as the array comprises four characters and the zero terminator. new msg[] = ’’Help’’...
Page 174
13.4.5.3 Arithmetic Operator Example Explanation e1 + e2 Result of adding e1 and e2 e1 - e2 Result of subtracting e2 from e1 Result of the arithmetic negation of e (two's complement) e1 * e2 Result of multiplying e1 with e2 e1 / e2 Result of dividing e1 by e2.
Page 175
Chapter 13 Device Logic (Pawn) Note: The following operators combine an assignment with an arithmetic or bitwise operation. The result of the expression is the value of the left operand following the arithmetic or bitwise operation. Operator Example Explanation v += e Increases v by e v -= e Decreases v by e...
Page 176
Operator Example Explanation The result is a logical "true", if e is logical "false". e1 || e2 The result is "true", if either e1 or e2 (or both) are logical "true". The expression e2 is only evaluated if e1 is logical "false". &&...
Page 177
Chapter 13 Device Logic (Pawn) Operator Explanation Reading order Function call left-to-right array index (element) array index (character) logical not right-to-left one's complement two's complement (unary minus) increase decrease "tag" overwritten defined symbol definition status sizeof symbol size in "elements" tagof unique number of the tag multiplication...
Page 178
Each statement can be marked with a label. The label must be followed by a statement, which can also be an "empty statement". The scope of a label is the function in which it was declared, i.e. a "goto" statement cannot jump from the current function to another function.
Page 179
Chapter 13 Device Logic (Pawn) 13.4.6.6 Break Terminates and leaves the smallest, encircling "do", "for" or "while" statement at any point in the loop. The "break" statement moves the program flow to the next statement outside the loop. Example: example(n) new a = 0 for(new i = 0;...
Page 180
13.4.6.8 Do statement while (expression) Executes a statement before the conditional part (the "while" condition) is evaluated. The statement is repeated as long as the condition is logical "true". The statement is executed at least once. Example: example(n) new a = 0 while(n >= 0) return a 13.4.6.9 Exit expression...
Page 181
Chapter 13 Device Logic (Pawn) Example: example(n) new a = 0 for(new i = 0; i < n; i++) return a The "for ( ; ; )" statement is the same as the "while (true)" statement. 13.4.6.11 Goto label Moves the program control (unconditionally) to the statement that follows the specified label. The label must be within the same function as the "goto"-statement (a "goto"-statement cannot jump out of a function).
Page 182
The "switch" statement shifts the sequence control to a "case" clause if a value from the list corresponds to the value of the "switch" expression. The "default" clause consists of the "default" keyword and a double point. The "default" clause is optional, however, if it is specified it must be included as the last entry in the "case"...
Page 183
Chapter 13 Device Logic (Pawn) 13.4.7 Functions A function declaration specifies the name of the function and the formal parameters enclosed in brackets. A function can also return a value. A function must be defined globally, i.e. declared outside of another function and is globally available.
Page 184
main() new v = 5 new f = faculty(v) faculty(n) assert n >= 0 new result = 1 while (n > 0) result *= n-- return result Regardless of what (positive) value the "n" variable has at the start of the "while" loop, "n" will equal zero at the end of the function.
Page 185
Chapter 13 Device Logic (Pawn) The following code example calls up the "addvector" function and adds five to each element of the "vect" variables: new vect[3] = [ 1, 2, 3 ] addvector(vect, [5, 5, 5], 3) /* vect[] now comprises the values 6, 7 and 8 */ 13.4.7.2 Named parameters versus fixed parameters In the previous examples, the order of the parameters in a function call were important as each parameter was copied to the same position of the function parameter.
Page 186
For example, if the "increment" function is defined as follows: increment(&value, incr=1) value += incr The following function calls are all the same: increment(a) increment(a, _) increment(a, 1) Standard values for arguments that are transferred as a reference are helpful in making these parameters optional.
Page 187
Chapter 13 Device Logic (Pawn) The pawn does not support any "pointer". The pawn includes a "reference" argument to transfer function parameters as a reference (see "Function arguments ("call-by-value" versus "call-by- reference")" on page 183). The "placeholder" argument replaces some applications of the ZERO pointer (see "Standard values of function arguments"...
Page 188
In most cases, the forward declarations of functions (i.e. prototypes) are not necessary. A pawn is a two-pass compiler. It detects all of the functions during the first cycle and uses them during the second. User-defined operators must however be declared before use. If available, forward declarations must be exactly the same as the definition of the function.
Page 189
Therefore, the only aim is to transport a block of data from A to B. The data transferred from the rapidM2M T32x to the sever can therefore be selected freely. There are 1023 Byte available per data record that can be used as required. There are also another 10 independent memory blocks each with 4000 Byte for the configuration data that can be used as required.
Page 190
14.1.1 Division of a structured measurement data channel into individual data fields #histdata0 Measurements up BatVoltage s16 title="Battery Voltage" decpl=2 units="V" vscale=0.001 InputVoltage s16 title="USB Voltage" decpl=2 units="V" vscale=0.001 The first line in the example above specifies the container to be used for the measurement data: #histdata0: The measurement data should be stored in histdata channel 0. Measurements: "Measurements"...
Page 191
14.1.2 Division of a configuration memory block into individual data fields #config0 BasicCfg down title="Basic configuration" RecordItv u32 title="Record Interval" units="sec" min=10 default=10 TransmissionItv u32 title="Transmission Interval" units="min" min=10 default=60 The first line in the example above specifies the container to be used for the configuration: #config0: The parameters should be stored in configuration memory block 0. BasicCfg: "BasicCfg"...
Page 192
14.1.3 Division of the aloha data into individual data fields #aloha up BatVoltage s16 title="Battery Voltage" decpl=2 units="V" vscale=0.001 InputVoltage s16 title="USB Voltage" decpl=2 units="V" vscale=0.001 The first line in the example above specifies the container to be used for the aloha data: #aloha: The measurement data should be stored in the aloha data container. The data is only transmitted from the device to the server.
Page 193
editmask Formatting instructions for displaying the field content on the interface of the myDatanet server or input via the interface of the myDatanet server. Formatting instructions Explanation 0=off;1=on A ComboBox is created in which the text following the "=" is displayed for each entry instead of the value.
Page 194
index Is used for the user-defined sorting of the fields in the selection lists. The standard value for the 1000 channels that are available is -1, which ensures that the channel is hidden. As soon as a channel is used in the data structure description (a simple field tag with the attribute name will suffice), the background index value is automatically set to the field index (e.g.
Page 195
14.2 Example #histdata0 Measurements up Delay title="Delay" units="sec" min=10 max=2000 vofs=10 chmode=3 index=1 Height f32 title="Height" decpl=2 units="cm" min=0 max=2000 vscale=0.01 chmode=6 index=0 Pump view=99 edit=99 @Pump Pump_MSK dlorw=skip title="Pump" bitmask=$01 min=0 max=1 chmode=1 Info astr.50 title="Info" index=10 The first line specifies the container to be used for the measurement data: #histdata0: The measurement data should be stored in histdata channel 0. Measurements: "Measurements"...
Page 196
max: Maximum value for the further display on the server (e.g. graphic) vscale: Virtual scaling of the value (see "Attributes of the field definition" on page 192). In the current example the extracted value is multiplied by 0.01. chmode: Channel mode 6 =^ analogue channel (a "simple"...
Page 197
The 7th line describes the fourth measurement value "Info" in the measurement data container used: Info: "Info" should be used as the name for the measurement value. astr.50: The data type used for the measurement value should be an ANSI string. After the dot the number of characters (50 in the current example) are specified.
Page 199
Chapter 15 API Chapter 15 API Important note: The relevant licences are required on the myDatanet server to use the API (Application Programming Interface). For future information contact your responsible sales partner. 15.1 Backend API The API is provided to export data from and import data to the myDatanet server. However, this is not just limited to the pure measurement data but includes all of the data provided by myDatanet server (e.g.
Page 200
15.2.1 Overview rapidM2M Playground 1 Input field for the user name 2 Input field for the password 3 List of the available HTTP commands. The HTTP commands are grouped according to their fields of application. 4 Depending on the selected HTTP command, the drop down lists for selecting the customer, user and site that should replace the corresponding wild cards ("$CID"...customer , "$UID"...user, "$SID"...site) in the resource path of the HTTP command are displayed.
Page 201
16.2 Charging the rechargeable battery To charge the battery, the rapidM2M T32x can be connected to the USB interface of a PC as well as a USB power supply unit. The USB cable (A to C) required for this purpose is not included in the standard scope of delivery of the rapidM2M T32x .
Page 203
Logo of the EU WEEE Directive This symbol indicates that the requirements of Directive 2012/19/EU regarding the scrap disposal of waste from electric and electronic equipment must be observed. Microtronics Engineering GmbHsupports and promotes recycling and environmentally friendly, separate collection/disposal of waste from electric and electronic equipment in order to protect the environment and human health.
Page 205
The capacity of the rechargeable battery is depleted. not respond. Communication Load the device log from the rapidM2M T32x using the DeviceConfig (see ""Log" problems tab" on page 71). A list of all the possible error codes is included in the chapter "Log entries and error codes"...
Page 206
18.2 Log entries and error codes Log entry Parameter Description Code Plain text Code Plain text 1000 POWER ON Restart following a power failure Watchdog reset (e.g. because of an exception) Reset was initiated by the device itself (e.g. in event of firmware update) Restart for another reason.
Page 207
Chapter 18 Troubleshooting and repair Log entry Parameter Description Code Plain text Code Plain text 1039 UV MODEM The rechargeable battery or battery voltage once RECOVER again suffices to guarantee a stable connection. This is either achieved by replacing the rechargeable battery or battery pack or by ensuring that the charge control has charged the battery sufficiently.
Page 208
Log entry Parameter Description Code Plain text Code Plain text 1282 ZLIB Internal error STREAMFINISH Contact the manufacturer if the device log includes this error several times (see "Contact information" on page 219). 1300 USB CONNECTED --- USB connection to a PC established. 1310 USB USB connection was terminated.
Page 209
FAILED Try to improve the position of the antenna. Check whether the device is in the coverage area (www.microtronics.com/footprint). 1200 BAND SEL FAILED -969 --- A network could not be found on the GSM900/1800 or on the GSM850/1900 band. Try to improve the position of the antenna.
Page 210
1200 NETLOCK ERROR -966 Error when selecting the network. Check whether the device is in the coverage area. Internal SIM chip: see www.microtronics.com/footprint TCP channel error 1200 CHANNEL -965 --- An attempt is being made to write to/read a TCP ABORTED client that is no longer available.
Page 211
The DeviceConfig program can be used to read all of the stored log entries, including those that have not yet been transferred to the myDatanet server, directly from the rapidM2M T32x via the USB interface. A more detailed description about the evaluation of the device log using DeviceConfig is included in chapter ""Log"...
Page 213
Chapter 19 Spare parts and accessories Chapter 19 Spare parts and accessories 19.1 Montagesets Beschreibung Menge Bestellnummer T32x Bracket 301145 T32x Bracket with magnet 301146 19.2 Other accessories Description Quantity Order number MDN Magnet 206.803 Rev. 01...
Page 215
Chapter 20 Document history Chapter 20 Document history Rev. Date Changes 29.09.2021 First version Rev. 01...
Page 217
The manufacturer's devices are equipped with subscriber identity modules (SIM) ex-works for the purpose of mobile data transmission. The footprint describes those countries and regions where a mobile connection is available (see www.microtronics.com/footprint). Device logic The device logic is the intelligence installed on the device that determines the local functionality of the device.
Page 218
rapidM2M Store Is responsible for distributing the app models to the individual myDatanet servers. When installing and updating IoT apps the myDatanet server access the app models provided in the rapidM2M Store . The developer of the respective app model defines which myDatanet servers are allowed to access an app model via the rapidM2M Studio .
Page 219
Chapter 22 Contact information Chapter 22 Contact information Support & Service: Microtronics Engineering GmbH Hauptstrasse 7 3244 Ruprechtshofen Austria, Europe Tel. +43 (0)2756 7718023 support@microtronics.com www.microtronics.com Microtronics Engineering GmbH (Headquarters) Hauptstrasse 7 3244 Ruprechtshofen Austria, Europe Tel. +43 (0)2756 77180 Fax.
Need help?
Do you have a question about the rapidM2M T32x and is the answer not in the manual?
Questions and answers