1 Index of Abbreviations Index of Abbreviations Abbreviation Meaning admission control mandatory Advanced Encryption Standard Access Point application programming interface Access Point Name Blind Carbin Copy (e-mail) bdaddr Bluetooth Address BIOS Basic Input Output System BLOB Binary Large Objects Board Support Package Bluetooth Controller Area Network CANopen...
Page 7
1 Index of Abbreviations Abbreviation Meaning D-Bus Desktop-Bus Data Flash Dynamic Frequency Selection DHCP Dynamic Host Configuration Protocol Data Logging Configuration Data Log File Domain Name System DNSMASQ DNS forwarder and DHCP server for small computer networks Data Pool List Digital Subscriber Line DSUB D sub-miniature (connector design)
Page 8
1 Index of Abbreviations Abbreviation Meaning ftpd FTP Daemon GAGAN GPS Aided GEO Augmented Navigation (indian SBAS) GNU Compiler Collection Galileo Control Center GNU Project debugger Group Identifier (Linux) GLONASS Globalnaja nawigazionnaja sputnikowaja sistema (russian satellite navigation system) GNU Debugger GNSS Global Navigation Satellite System GNU’s Not Unix (recursive acronym) Free Software...
Page 9
1 Index of Abbreviations Abbreviation Meaning Ignition Internet Protocol Communications ISCAN Inquiry Scan Flag (Bluetooth device is detectable) International Organization for Standardization JFFS2 Journalling Flash File System version 2 KL15 Klemme 15 (name of pin for ignition signal) LFFORMAT Logger File Format LFJNAME Log File Job Name LGPL...
Page 10
1 Index of Abbreviations Abbreviation Meaning NMEA National Marine Electronics Association (standards for GPS communication) Not Or (logical gate) NRTI Network Response Time Indicator OBEX Object Exchange (protocol) Operating System Password Authentication Protocol Personal information exchange (certificates) Process Identifier Personal Identification Number Power PC Point-to-Point Protocol pppd...
Page 11
1 Index of Abbreviations Abbreviation Meaning subscriber identity module Sub Miniature version A (connector) smime Secure / Multipurpose Internet Mail Extensions Short Message Service SMTP Simple Mail Transfer Protocol SNTP Simple Network Time Protocol source (Linux folder) Service (Linux folder) secure shell SSID Service Set Identifier...
Page 12
1 Index of Abbreviations Abbreviation Meaning Universal Time Coordinated Universal Character Set Transformation Format Virtual Box Disk Image visual (text editor within Linux) WAAS Wide Area Augmentation System (SBAS) Wired Equivalent Privacy (WLAN encryption) WLAN Wireless Local Area Network Wi-Fi Multimedia Wi-Fi Protected Access (WLAN encryption) Extensible Markup Language exclusive OR (logic gate)
2 Introduction Introduction This is the user manual of the on-board module TC1. It describes all features of the three hardware variants of the TC1. Please note that some features might not be available, depending on the variant of your TC1.
Getting Started for A getting started guide to connect your TC1 to machines.cloud machines.cloud and use the TC1 with the Vehicle Data System (VDS) for data logging. Accessibility and archiving: Keep this document and allow access for everyone working with this product.
3 General Information Target Group This manual describes the handling and characteristics of the TC1. It is designed to be a comprehensive source of information about the TC1 for system design, engineering and maintenance personnel. System development, installation and commissioning of the TC1 must only be carried out by trained and experienced personnel who are sufficiently familiar with the used components and with the complete system.
3 General Information Disposal The disposal of the unit shall be conform to the recycling regulations of the country and regions in which they are disposed. Dispose the TC1 according to the valid local regulations. History Version Date Editor Changes...
48083 Insert SIM Card To be able to use the mobile feature of the TC1 a SIM card must be installed. The TC1 can handle any kind of common network provider. The SIM card slot is located inside the connector.
Supplies" on page 18). How to connect the TC1 with your development system: 1. Directly plug in the TC1 in the 29 pin connector on top of the development box. See Pin Assignment (see "Pin Assignment" on page 30) for further information.
Setting up the Serial Interface Terminal program for the serial interface Use a serial straight-through cable to connect the TC1 with your PC. Depending on the used operating system on the used PC for development, a RS232 terminal must be installed.
Start your RS232 terminal (in this case: GTKTerm) Turn power ON to TC1 (Switch on +UB and D+ on the front site of the development box) On the RS232 terminal you can see the following U-Boot messages: System Login The default admin user is "root"...
2. Use command "passwd" and type in a password: How to set up a firewall with iptables The TC1 can be secured with iptables. iptables can be used to build internet firewalls. iptables is the userspace command line program used to configure the packet filtering ruleset.
5 Hardware Hardware Here is an overview provided about the technical components of the TC1. Variants Available variants of the TC1: Variants WiFi Bluetooth 2G/3G GNSS (GPS/GLONASS) TC1-WiFi TC1-WiFi+ TC1-Mobile Details of variants: Variants Details description TC1-WiFi WLAN and Bluetooth with external antenna: IEEE 802.11 2.4 GHz / 5.5 GHz (a,b,g,n), Bluetooth®...
5 Hardware Technical Data The technical data provides an overview of all technical characteristics of the components of the TC1. 5.2.1 Block Diagram Variant TC1-WiFi User Manual 24/374...
5 Hardware 5.2.3 Block Diagram Variant TC1-Mobile 5.2.4 Power Supply Component Description Range DC voltage supply Voltage at +UB power supply 9 V ... 32 V DC Current consumption - Stand-by Sum of input currents at +UB (U = 0 V, ignition off) <...
5 Hardware Component Description Range Ignition pin Internal pull down resistor 3 kOhm switch on threshold > 2.6 V switch off threshold < 1.5 V Protected against short to ground and battery plus 5.2.5 Processor and System Memory Type Features Processor 32 bit controller, Freescale MPC5200B, 400 MHz 128 MByte DDR-SDRAM...
5 Hardware Type Maximal Description available counts Bluetooth Bluetooth V.2.1 + EDR (enhanced data rate) Bluetooth V.4 (BLE bluetooth low energy) Class 1 (+17 dBm) internal or external antenna option (via SMA connector) WLAN IEEE 802.11 a/b/g/n - 2.4 GHz / 5.5 GHz Infrastructure mode with WEP64, WEP128, WPA, WPA2 (TKIP/PSK) security AdHoc mode (WEP)
5 Hardware 5.2.8 System Data Component Description Value Operating system Linux, Board Support package (incl. source code) open source, development environment Connectors Automotive Typ (Tyco / AMP): 19 pin cable suited plugs for 1x WiFi or 1x 2G/3G and 1x GNSS: SMA plugs.
5 Hardware Pin Assignment Connector view: For mating connector see Connector (see "Connector" on page 35) Pin numbers of the TC1: Pin Number Description Digital Output (int. 10kOhm pull down, max. 400[mA] @ 12V) +UB power supply (9-32VDC) GND (shield USB & WLAN) KL15 / D+ (switched power / ignition switch) Digital Input (int.
Mounting Guidelines Make sure that you use the total number of two screws to attach the TC1 to your vehicle. Tighten each screw with a preload force of F = 6.7 kN – 9.0 kN. Use the stated preload force to determine the torque: The torque of a screw depends of its type, its structure robustness, and coefficient of friction (COF).
Page 32
Provide proper ventilation. The TC1 generates surplus heat during operation. Keep the TC1 away from hot air and hot surfaces. Hot air or hot surfaces can heat the TC1 to a not allowed temperature range. Do not install the TC1 to your device with the connector or the cable harness pointing upwards.
Use a dummy plug for not used pins of your used connector. The rated IP Code for the TC1 is only fulfilled, if the TC1 is connected to a fully assembled connector. Consider the data and specifications required for IP rating from the connector's manufacturer you are using.
5 Hardware Antenna Recommended antenna Manufacturer Name/Type Communication interfaces Connector type Hirschmann Roof Mount Antenna WLAN, SMA male CGW 70 26 59 SF S BLUETOOTH CELLULAR (GSM) Hirschmann Low profile antenna CELLULAR (GSM) SMA male GPS 18 90 LP / P / SMA / SMA / 3.0 REQUIREMENT: Make sure to keep a minimum distance of 20 cm between the used antenna and people.
The operating system of the TC1 is a embedded GNU/Linux, which is is configured by STW. To check for the latest version of the operating system for the TC1 go to the STW FTP server: ftp://stw- connectivity.net/ (see ftp://stw-connectivity.net/ - ftp://stw-connectivity.net/) The operating system is separated in two spaces: ...
Page 38
Linux kernel of the TC1. Device tree <STW-V<X.XXrX> STW-V0.01r0 Version of the device tree block /proc/device- block for the TC1. tree/dts_version U-Boot fw_printenv ver ver=u-boot XXXX.XX- ver=u-boot Version of the U-Boot used svnYYYY (MMM DD yyyy 2012.10-svn9064 in the TC1.
6 Software Boot up / Shut down sequence The following files are used on the TC1 device for boot up, shut down and basic initialization of the system. Files executed during boot up and shut down sequence: /etc/inittab The inittab file controls which processes are started/executed during boot up and during normal operation.
Page 40
6 Software /etc/init.d/rc.conf rc.conf is a setup script. It returns all script names to rcS script that must be called on startup or on shutdown. In general the rc.conf is the configuration file for initscripts. It configures what daemons to start at boot up, the basic network daemon, and certain aspects of hardware discovery.
6 Software TC1 - Wakeup For the TC1 are the following sources for wakeup possible: Wakeup by ignition Wakeup by RTC alarm High Level Hardware Access Path Input Output Description information information /etc/init.d/scripts/shalt This is a shell script which switches the self- preservation (/proc/stw_shutdown/shalt) On/Off.
6 Software Path Input Output Description information information system is shut down How to set parameters for wakeup: The parameters are set over the interface rc.conf: Example for set wakeup parameters # Set wakeup parameter to etc/init.d/rc.conf export RTC_WAKEUP="after_sec" # Time in seconds if RTC_WAKEUP="after_sec" # In combination with "after_sec"...
6 Software Path Input Output Description information information < 0 > the self-preservation is switched < 1 > the self-preservation is switched /proc/stw_shutdown/dplus This user space interface includes the state of the ignition pin. < 0 > the state of the ignition is Off <...
Page 44
6 Software NOTE: If the SNTP client is not activated and the settime script is not fully implemented, then the user has to configure the SNTP client and may have to changed the settime script if necessary. Interface at rc.conf: Activate / Deactivate SNTP # Activate "YES"...
Page 45
6 Software Example: Handle wakeup alarm Sets the wakeup alarm off: # echo 0 > /sys/class/rtc/rtc0/wakealarm Sets the wakeup alarm to 10 seconds: # echo 10 > /sys/class/rtc/rtc0/wakealarm User Manual 45/374...
6 Software Network handling For network handling use the network daemon that handles network interfaces automatically. Precondition: The network daemon must be started. The network daemon is not started during the boot up automatically. How to activate the network daemon see network daemon (see "Network daemon"...
6 Software 6.4.1 The default setup of the GSM modem provides functionalities to handle more than one GSM service at a time. High Level Hardware Access Path Input Output Description information information /etc/init.d/scripts/gsm This shell script starts or stops the GSM modem and loads APN settings automatically from database /etc/apns-conf- xml depending of the /etc/init.d/rc.conf settings.
Page 48
6 Software Low Level Hardware Access The modem interfaces are accessible over the symbolic link files /dev/mux0 and /dev/mux1: Path Input Output Description information information /dev/mux0 This device is created per default. Send/Receive AT-commands to GSM modem e.g. via picocom /dev/mux1 This device is created per default.
Page 49
Automatically detection of the correct provider settings. After starting the modem, the TC1 tries to detect the correct provider settings automatically. In order to do this, the mobile country code (MCC) and the mobile network code (MNC) are requested from the modem. The combination of both results in a unique number which identifies your mobile provider.
Page 50
6 Software If the apn-default.xml file is available, the daemon uses the the first entry of the file whether this provider identification number fits or not. The apn-default.xml file has nearly the same behavior as the manually set GPRS parameters mechanism of the daemon.
6 Software Function Brief ysmsd_request_sms_fetch_urgent The TAF library function sends a request SMS fetch urgent message. (see "ysmsd_request_sms_fetch_urgent" on page 234) How to send a SMS using AT commands: 1. Connect to the modem via picocom # picocom -b 115200 /dev/mux1 picocom v1.6 port is : /dev/mux1...
Page 52
6 Software High Level Hardware Access Get local information It is possible to read out the local settings of the eth0 device, such as MAC address, IP address, Gateway, Netmask,..# ifconfig eth0 eth0 Link encap:Ethernet HWaddr 00:1D:48:20:F6:11 inet addr:172.25.230.17 Bcast:172.25.230.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST...
Page 53
6 Software struct sockaddr_in t_Srv; memset(&t_Srv, 0, sizeof(struct sockaddr_in)); t_Srv.sin_family = AF_INET; inet_pton(AF_INET, "1.2.3.4", &t_Srv.sin_addr); // Set server IP to struct sockaddr_in t_Srv.sin_port = htons(1234); // Set port in Network-Byte-Order (Big Endian) to sin_port s16_Return = connect(s16_Sockfd, (struct sockaddr*)&t_Srv, sizeof(struct sockaddr_in)); Try to connect if(s16_Return == 0) // TCP connection is established.
The easiest way to establish a internet connection via the WLAN interface is to activate and configure the network daemon. Network daemon configuration file (see "Network daemon" on page 100) The TC1 WLAN module allows two modes: Managed-Mode Access-Point-Mode (AP mode) The managed mode can be started by wpa_supplican and wpa_cli, the access-point mode can be started by hostapd.
Page 55
6.4.3.1 Access-Point-Mode Connection: Access-Point-Mode (AP mode) The AP mode is the default mode of the TC1 WLAN module. Interface rc.conf: Setup IP parameters for startup in AP mode Setup the IP handling strategy in etc/init.d/rc.conf # --------------- NETWORK WLAN0: # WLAN0_CONF="AP"...
Page 56
6 Software Setup wpa_supplicant.conf Setup the access-point mode in /etc/wlan/hostapd.conf ##### hostapd configuration file ############################################## interface=wlan0 # Driver interface type driver=nl80211 # Interface for separate control program. If this is specified, hostapd # will create this directory and a UNIX domain socket for listening to requests # from external programs (CLI/GUI, etc.) for status information and # configuration.
Page 57
6 Software # specify band) # Default: IEEE 802.11b hw_mode=g # Channel number (IEEE 802.11) # (default: 0, i.e., not set) # Please note that some drivers do not use this value from hostapd and the # channel will need to be configured separately with iwconfig. # If CONFIG_ACS build option is enabled, the channel can be selected # automatically at run time by setting channel=acs_survey or channel=0, both of # which will enable the ACS survey based algorithm.
Page 58
Germany for example can be '44': channel=44 After setting the correct value, the TC1 needs to be restarted. The last parameter that needs to be checked is the transmit power. It can be read with: # iwconfig wlan0 wlan0 IEEE 802.11abgn...
Page 59
6 Software # IP of wlan0, for managed mode this parameter is not needed export WLAN0_IP="192.168.201.1" # Submask of wlan0, for managed mode this parameter is not needed export WLAN0_SUBMASK="255.255.255.0" # Broadcast address of wlan0, for managed mode this parameter is not needed export WLAN_BR="192.168.201.255"...
Page 60
6 Software Country Code/ 802.11 Allowed Maximum Transmit Power Frequency Country Bands Wi-Fi Channels (Radio Tx + Antenna Gain = Range (GHz) for hw_mode EIRP) 1 - 11 100 mW EIRP 2.4-2.4835 FR / France 36, 40, 44, 48 200 mW EIRP 5.15-5.25 52, 56, 60, 64 200 mW EIRP...
6 Software 6.4.4 IP handling This chapter describes how DNSMASQ IP forwarding can be handled on the TC1 system. High Level Hardware Access Path Input Output Description information information /etc/init.d/scripts/dnsmasq This shell script starts the DHCP and DNS services for the selected interface.
6 Software ppp0. export IP_FORWARDING="OFF" # NAT options will be used in case IP forwarding is activated. # Deactivate service by setting export to "OFF", else activates the NAT for network interface (wlan0 / eth0). export ETH0_NAT="OFF" export WLAN0_NAT="OFF" 6.4.5 High Level Hardware Access The Socket CAN package is an implementation of CAN (Controller Area Network) protocols for Linux.
Page 63
6 Software Change the Transmit Queue Length It is possible to vary the maximal number of CAN messages in the transmit queue of e.g. can0. # ifconfig can0 txqueuelen 1000 # ifconfig can0 can0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 UP RUNNING NOARP MTU:16 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0...
/* Read a message back from the CAN bus */ sint16 s16_BytesRead = read( s16_Socket, &t_Frame, sizeof(t_Frame)); 6.4.6 Bluetooth This chapter describes the Bluetooth interface on the TC1 and how a Bluetooth connection can be established to other systems. High Level Hardware Access Path...
Page 65
Achieving a bluetooth connection to the TC1 from different operating systems Connect to TC1 from windows based systems over serial port Windows 7 or newer operating system based devices can connect to the TC1. The device has to be added with paring code "0000".
Page 66
6 Software Connect to TC1 from android based systems for file sharing In order to connect to the TC1 from android based systems, a similar APP like "Bluetooth File Transfer" has to be used. NOTE: The file sharing folder on the TC1 is /tmp/.
Page 67
# RFCOMM channel for the connection channel 7; # Description of the connection comment "Linux VM"; It is necessary to gain root privileges. Use the obexfs tool to connect to the TC1 and mount the connection to bluetooth_test root@pc-name:# obexfs -b 00:07:80:97:E7:BB /home/bluetooth_test/ User Manual...
6 Software Memory handling The memory system of the device includes (see also Technical Data (see "Processor and System Memory" on page 27)): NAND EEPROM Overview of the memory mapping. Root file system image: Unsorted Block File System (UBIFS) ...
Page 69
6 Software High Level Hardware Access Path Input Output Description information information /etc/init.d/scripts/filesystem This user space interface includes the device and partition information of the system. < start > copies data from NOR to RAM and remounts the temporarily file system, mounts USB device to /mnt/usbdisks, prepare NAND Example at rc.conf: Use shared memory Useful for other applications that need shared memory.
Page 70
6 Software Example: Read out EEPROM Displays in two byte hexadecimal by using /usr/bin/hexdump. # hexdump -x /sys/bus/i2c/devices/0-0054/eeprom 0000000 ffff ffff ffff ffff ffff ffff ffff ffff 0002000 Display canonical hex+ASCII, 16 byte per line. # hexdump -C /sys/bus/i2c/devices/0-0054/eeprom 00000000 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |....|...
6 Software 6.5.1 NOR Flash Low Level Hardware Access Path Input Output Description information information /dev/mtd0 This character device includes the interface to the root file system "(root) /". /dev/mtd1 This character device includes the interface to the kernel image. /dev/mtd2 This character device includes the interface to the U-Boot.
Page 72
6 Software 6.5.1.1 Linux Folder Structure The following chapter will explain all folders of the Linux directory structure that is created in the NORFlash. /root This is the root users's home directory. Here are saved all personal data and terminal configurations of the root user.
Page 73
6 Software /bin – User Binaries This directory contains: Binary executables Common linux commands needed to use in single-user modes Commands used by all users of the system. For example: ps, ls, ping, grep, cp. /dev – Device Files ...
Page 74
6 Software /sbin – System Binaries Contains binary executables like /bin. The linux commands located under this directory are used typically by the system administrator for system maintenance purpose. For example: iptables, reboot, fdisk, ifconfig /srv – Service Data Contains server specific and services related data.
Page 75
6 Software 6.5.1.2 STW Folder Structure Software from STW uses the following folders: /etc/init.d Contains the configuration files of all TAF daemons. Only if the configuration file is in the folder, the corresponding daemon will start. The folder also includes the user startup script rc.local and the global startup script rcS.
Page 76
/mnt/usbdisks/sda2 /mnt/opt Directory to store data logger configurations or server configurations. /usr/local/bin Contains STW specific binaries and scripts like cangen or nand_mount_sh. /usr/local/sbin Contains STW specific scripts. /var/log Contains the log files of the current activated TAF components, e.g. files with the syntax <Name of TAF component>.log.
Page 77
"/mnt/dataflash" is available. The following directory structure can be found on that partition: At startup of the TC1, the /etc, /usr, /libs, /home, /opt and /root directories of the root filesystem are automatically overlaid with the content of directory /mnt/dataflash/stw/overlay.
Example2: If the user deletes the /etc/init.d/scripts/bt script in the root filesystem, then the TC1 behaves like the file is gone. But the file is not really deleted. Only a flag in the corresponding overlay directory is set. In this case the flag is set in the /mnt/dataflash/stw/overlay/etc/init.d/script directory.
Page 79
6 Software High Level Hardware Access Path Input Output Description information information /usr/local/bin/nand_prepare.sh This shell script prepares the NAND flash to use it with UBIFS. Assumptions: the NAND is organized in one MDT block with size 1GByte flash will be attached to UBI device /dev/ubi0 Following steps are done: ...
6 Software Low Level Hardware Access Path Input Output Description information information /dev/mtd6 This device includes the entry into the NAND flash. /mnt/dataflash The 1 GB NAND flash is mounted here. Example: Read memory information Read memory information of /dev/mtd6 using /usr/sbin/mtdinfo. # mtdinfo /dev/mtd6 mtd6 Name:...
Page 81
< unlocked > .. EEPROM is readable / writable Example: Read system parameters from EEPROM # stw_eep -r variant Y_TC3G WARNING: Don't unlock the eeprom_sys STW eeprom area. Overwriting this area will cause an unexpected system behavior! Path Input Output...
6 Software Watchdog Library functions for the watchdog The watchdog can be configured with the functions of the system daemon (see "System daemon" on page 88). Function Brief description ysysd_register_watch_dog The TAF library function registers the application on system daemon. (see "ysysd_register_watch_dog"...
6 Software Temperature Sensor Low Level Hardware Access Path Input Output Description information information /sys/bus/spi/devices/spi32766.1/temp1_input This user space interface reads the current temperature of the temperature sensor in degrees celsius. < 0..n > = Temperature in in degrees celsius multiplied by 1000 Example: Read and calculate the temperature 1.
6 Software Path Input Output Description information information < start | restart > starts the internal GPS receiver Low Level Hardware Access Path Input Output Description information information /dev/ttyPSC2 NMEA string This user space interface reads out the NMEA string from from GPS the GPS module.
6 Software 6.10 Digital Input / Output High Level Hardware Access Example: C - Code Read / Write on PIN1 // This example describes how to read / write on /proc/stw_io/PIN1 #include <string.h> #include <stdio.h> #include <stdlib.h> #include <sys/time.h> #include <unistd.h> #include <fcntl.h>...
Page 86
6 Software Path Input Output Description information information < 0 > .. digital value is low < 1..n > .. digital value is high /proc/stw_io/PIN2 This user space interface reads on digital output PIN. < 0 > .. sets digital value to low level <...
Teleservice Application Framework Overview STW provides two different ways for application development on the module. The first way is simply for the developer to write applications from scratch, using the board support package and the sample code that is provided. Also as any open source applications or tools that make sense for that project can be used. The linux operating system provides a very flexible environment for this type of approach and the developer can choose any language or set of tools in the wide world of linux development.
7 Teleservice Application Framework TAF Components TAF Components: 7.2.1 System daemon The system daemon has a special role among the daemons. The system daemon is already activated per default. Daemon location Configuration file /usr/local/bin/ysysd /etc/init.d/ysysd.conf User Manual 88/374...
Page 89
7 Teleservice Application Framework ysysd The system daemon's task is to trigger the kernel watchdog (which triggers the hardware watchdog). offer watchdog functionality to applications. applications can register, trigger and cancel the watchdog service via D-Bus calls. ...
Page 90
# The shutdown run time path includes the run time in seconds after shutdown (ignition off). When the ignition pins # goes off, the controller (TC1 can keep on running for a certain amount of time. User space applications can also # set the desired time.
7 Teleservice Application Framework 7.2.2 Data daemon Daemon location Configuration file /usr/local/bin/ydatad /etc/init.d/_ydatad.config How to activate the configuration file of the data daemon Activate the configuration file of the data daemon, so the data daemon is started during the boot up sequence automatically.
Page 92
7 Teleservice Application Framework Section: Supervising the data daemon # The data daemon can be supervised by a watchdog (provided by the ysysd daemon). # The time when the watchdog shall be triggered is set by "watchdog_interval". # Min. interval is 0, that deactivates the watch dog, max. interval is 0x7FFFFFFF, recommended min.
7 Teleservice Application Framework 7.2.3 Logger daemon Daemon location Configuration file /usr/local/bin/ylogd /etc/init.d/_ylogd.config How to activate the configuration file of the logger daemon Activate the configuration file of the logger daemon, so the logger daemon is started during the boot up sequence automatically.
Page 94
7 Teleservice Application Framework Section: Supervising the data daemon # The data logging daemon can be supervised by a watchdog (provided by the ysysd daemon). # The time when the watchdog shall be triggered is set by "watchdog_interval". # Min. interval is 0 that deactivates the watch dog, max. interval is 0x7FFFFFFF, recommended min.
Page 95
7 Teleservice Application Framework Section: Full dataset interval # Interval for writing a complete dataset to the datalogger file. The interval value is set in bytes # Per default, the mechanism is disabled because it's only necessary in combination with the yserverd # If "0"...
7 Teleservice Application Framework 7.2.4 GPS daemon Daemon location Configuration file /usr/local/bin/ygpsd /etc/init.d/_ygpsd.config How to activate the configuration file of the GPS daemon Activate the configuration file of the GPS daemon, so the GPS daemon is started during the boot up sequence automatically.
Page 97
Therefore, the system time is only set in case, when the time is invalid. A invalid time is assumed, when the year is < 2010. In this case, the TC1 is restarted to get the real time again. User Manual...
7 Teleservice Application Framework 7.2.5 SMS daemon Daemon location Configuration file /usr/local/bin/ysmsd /etc/init.d/_ysmsd.config How to activate the configuration file of the SMS daemon: Activate the configuration file of the SMS daemon, so the SMS daemon is started during the boot up sequence automatically.
Page 99
7 Teleservice Application Framework # If no interval is set, the interval of the watchdog will be set to the default time interval of 10s. watchdog_interval 10 # System reboot path, max. path length 255. After the time interval has elapsed without triggering the watchdog, # the ysysd would kill the ysmsd and execute the "CMDOnWatchdog"...
7 Teleservice Application Framework started! sms_outfolder_path /usr/local/SMSOutFolder Section: SMS outgoing folder # Received SMS are stored in the GSM modem when received. # Set the number of SMS slots that must be supervise through the daemon. # Min. and default buffer size is 10, max. buffer size 0x7FFFFFFF, recommended max. is 10. # If buffer size is less than 10, the default size will be set and an error message will be put on stdout.
Page 101
7 Teleservice Application Framework Relevant sections of the configuration file: Section: Log file path # The logging information can be written to a log file at the following path # By default, the path is deactivated because the corresponding line is commented out. # Max.
Page 102
7 Teleservice Application Framework priority_matrix 1 Section: Network verification # The ynetworkd daemon supervises the desired interface status periodically. # Every "verify_interface_status_interval" seconds. # Min. interval and default 5s, max. interval is 0x7FFFFFFFs, recommended max. is 5000s # If interval is less than 5s, default will be set. verify_interface_status_interval 5 # Select type of verification # 1 -->...
Page 103
7 Teleservice Application Framework # If no path is set, default command "killall pppd" will be set and an error message will be put to stdout. # Daemon will not be started! pppd_stop_script /etc/ppp/ppp-stop # Mux_mode_enabled activates the usage of the gsmMuxd within the ynetworkd # Per default the "use gsmMuxd modus"...
Page 104
7 Teleservice Application Framework Section: Ethernet settings # To start and stop connections via ETH, the ynetworkd uses standard linux tools. # Set the scripts that have to run to establish and to finish a connection via ETH. # For static usage: # Start eth0 connection with lan_static_networkd # Max.
7 Teleservice Application Framework 7.2.7 Server daemon Daemon location Configuration file /usr/local/bin/yserverd /etc/init.d/_yserverd.config How to activate the configuration file of the server daemon Activate the configuration file of the server daemon, so the server daemon is started during the boot up sequence automatically.
Page 106
7 Teleservice Application Framework Syntax for the name CONFIG_NAME: [a..z][A..Z][0..9][_-] Limitation of the configuration file: The memory size of the system memory where the configuration file will be saved limits the size of the configuration files. NOTE: For each specific configuration file the server daemon creates a new identical instance of himself parametrized by it.
Page 107
7 Teleservice Application Framework be started! com_server_url teleservice.specific-url.de Section: Communication protocol download path # Path for Nextjob.job download on the ComServer # Use the string <client_id> as a placeholder for the real client ID. The daemon will replace the string with the real ID. # Max.
Page 108
Section: TC1 device name # Client_ID: Optional <hostname> will be set by the yserverd, e.g. TC1-<serial_num>_0...n # Min. client id length is 1, max. client id length is 512, default client name is the TC1 hostname # If no client name is set, default will be set (hostname).
7 Teleservice Application Framework 7.2.8 Signal daemon Daemon location Configuration file /usr/local/bin/ysignald /etc/init.d/ysignald.config NOTE: The signal daemon can only be used, when a LED is available. How to activate the configuration file of the signal daemon Activate the configuration file of the signal daemon, so the signal daemon is started during the boot up sequence automatically.
Page 110
7 Teleservice Application Framework The following states can be displayed: State of the module LED color Description Power ON yellow This state is active when the TC3G has booted and none of the other states are active. blue This state is active when ygpsd is activated and a valid NMEA string is received and the internet- state is not active.
Page 111
< 0 > = ON for 2 seconds < 1 > = flash 1 time < x > = flash x times STW LED /tmp/LED_Error p1 p2 This file includes the parameters for the 'Error' states p1: defines the color of the LED ...
Page 112
7 Teleservice Application Framework WARNING: The 'LED_Error' file must not be modified by the user. Otherwise, the error codes defined by STW are no longer valid. These blink codes can speed up the support through STW in case of an error.
Page 113
7 Teleservice Application Framework # log file but there will not be an error set/signalized by the daemon. # In order to deactivate for example ydatad, ylogd and ysmsd use: DeactivateDaemon ydatad ylogd ysmsd Example Signals for Normal Operating Mode The signal below starts with the "maximum reachable"...
Page 114
7 Teleservice Application Framework The signal below indicates that there is something wrong and it has nothing to do with the 'Internet' or the 'GPS' state. The matching entry in the 'LED_Error' file would be: 3 4 NOTE: It is possible that the module is running in areas without the possibility to receive internet or GPS signals.
In contrast to other daemons of STW the ymail daemon is written as a shell script. It is based on the mailx e- mail client and grants the developer easy access to the TC1 in order to perform simple tasks.
Page 116
</replace_file> add a file to the TC1 The user has the possibility to add files to the TC1. Those files have to be in the attachment of the e-mail sent to the TC1. The ymaild will add the file(s) to the specified directory with the specified file permissions. The directory must not already exist on the TC1.
Page 117
7 Teleservice Application Framework add a user to the mail.list The user can add other users to the mailing list. Every user on that list is able to get mail from the TC1. Syntax: email_address Example: add mail addresses to mail.list <add_user>...
Page 118
7 Teleservice Application Framework After sending the mail, the TC1 will respond with an encrypted mail and the desired files attached to it. The content of that mail will be similar to: > <get_file> > *.log;/var > </get_file> > > <add_user>...
Page 119
7 Teleservice Application Framework 7.2.9.1 Setup ymaild for the first time Home Directory - maild Before using the ymaild, it has to be configured. All but one configuration files can be found in the home directory /etc/maild. mail.account - file The configuration of the e-mail account is handled in the file mail.account.
Page 120
- folder The certificate folder includes a configuration file and an executable script. The objective is to generate certificates for two e-mail accounts, one for the account of the TC1 and the other one for the mail account of the developer.
Page 121
TC1. Everyone will be able to communicate with the TC1 via this particular mail account. 2. E-mail address for observing: Each user, who wants to observe the communication to the TC1, is put on Carbon Copy. Alternatively, the developer communicating with the TC1 put another developer on CC.
Page 122
7 Teleservice Application Framework Import the certificates to Windows 7 1. Copy the files PCpubl.priv.pfx and TC3Gpubl.cer on the windows PC. 2. Execute the PFX file: Enter the password Add the certificate to 'personal certificates' The procedure is finished here, if the user wants only to observe the communication. Continue with step 3, if communication is required 3.
Page 123
7 Teleservice Application Framework 5. The PFX file needs to be imported into Outlook, in order to decrypt the messages form the TC1, as well. Open Outlook 2013 Go to Options | Trust Center | Settings of the Trust Center | E-Mail-Security | Settings ...
TAF Library 7.3.1 Introduction The TAF library (libtaf) provides the functionality of all components on the TC1 which are necessary for a teleservice application. NOTE: The following description contains all possible features. Whether a single feature is available or not...
The meaning of 'word' means 16 bits at a 16-bit controller like the Infineon C167 or the Freescale 68k. At a 32- bit controller like the used TriCore processor 'word' means 32 bits. On TriCore hardware 16 bits are called a 'halfword' instead. To avoid confusions STW introduced clear types like 'uint16'. Recommended clear type definitions and prefixes Prefix...
Page 127
0:FALSE / (!=0):TRUE unsigned char STW also defines the data type boolean to store binary data. A boolean data type can help to increase the performance. However boolean is target specific and should be used with care. On some platforms a boolean variable takes 1 bit of memory.
Page 128
7 Teleservice Application Framework Type definition (typedef) prefixes Prefix Example Description typedef struct { ... } T_Struct type definition for structure (or bitfield) typedef union { ... } U_Union type definition for union E_Enum type definition for enum typedef enum { ... } typedef void (* PR_Function )( const uint8 ou8_Parameter...
Page 129
7 Teleservice Application Framework Prefix Example Description o<type prefix> const uint8 function parameter (operand) void Callback( ou8_Parameter ); Examples //Prefix examples /* local variable sint16 */ sint16 s16_VariableName; /* function internal array of pointers to uint8 with MAX_MESSAGES elements */ uint8 *apu8_Messages[MAX_MESSAGES];...
Page 130
7 Teleservice Application Framework WARNING: DO NOT USE undocumented BIOS functions! The availability and functionality of undocumented BIOS functions CANNOT be assured. Function Description sint16 const uint8 const uint32 uint16 * const x_function_name ( ou8_VarName1, ou32_VarName2, opu16_PointerName ) Detailed function description... Information Flow Input Information Parameter...
Page 131
7 Teleservice Application Framework Example code: // call of x_function_name() void main(void) sint16 s16_Result = C_NO_ERR; uint16 u16_Value = 0; s16_Result = x_function_name(15, 0x20000, &u16_Value); if (s16_Result != C_NO_ERR) // check if an error occurred! u16_Value = 0; else u16_Value *= 2; 7.3.2.3 Error Codes The error codes used by the C-BIOS API functions are handled by using macros.
Page 132
7 Teleservice Application Framework Macro Value Description C_NOACT No actual value (available) error C_COM Communication error C_CONFIG Configuration error C_CHECKSUM Checksum error C_TIMEOUT Timeout occurred C_IN_PROGRESS Asynchronous operation still in progress Example // Error code handling example sint16 s16_Result; s16_Result = x_sys_stay_alive(X_ON); if (s16_Result == C_NO_ERR) // if reached then this means that function x_sys_stay_alive(..) // has been executed successfully!
7 Teleservice Application Framework 7.3.3 D-Bus Utils Header file: "dbus-utils.h" What is D-Bus? D-Bus is a message bus system that provides a simple way for applications to talk to one another. In addition to interprocess communication, D-Bus helps coordinate the process life cycle. It makes it simple and reliable to code a "single instance"...
Page 134
!= C_NO_ERR) // Error handling return C_UNKNOWN_ERR; // ... // Add rules for which messages have to be seen on the D-Bus dbus_bus_add_match (mt_dbus_util.pt_dbus_conn, "type='signal',interface='stw.taf.broadcast'", NULL); dbus_connection_flush (mt_dbus_util.pt_dbus_conn); dbus_bus_add_match (mt_dbus_util.pt_dbus_conn, "type='method',interface='stw.taf.ysysd'", NULL); dbus_connection_flush (mt_dbus_util.pt_dbus_conn); // ... /* More initialization steps */ // ...
Page 135
7 Teleservice Application Framework Information Flow Input Information Parameter Range Description opt_DBusInstance T_DBUS_Util holds all information which is used to generate a D-Bus connection instance Output Information Parameter Range Description opt_DBusInstance T_DBUS_Util includes the connection instance which is generated by the D-Bus ->pt_dbus_conn Structure T_DBUS_Util typedef struct...
Page 136
7 Teleservice Application Framework Example // Global module T_DBUS_Util mt_DBUS_Util; sint32 s32_Retval; // Basic initialization (see "Introduction" on page 133) for TAF communication // ... 7.3.3.4 dbus_close Function Description sint32 dbus_close (T_DBUS_Util * const opt_DBusInstance) Unregister from the D-Bus and close connection. Information Flow Input Information Parameter...
Page 137
7 Teleservice Application Framework Return Value Description C_NO_ERR Function executed without error. C_CONFIG Could not unregister from D-Bus C_RANGE Parameter opt_DBusInstance is a NULL pointer 7.3.3.5 dbus_send_hallo_signal Function Description sint32 dbus_send_hallo_signal (const T_DBUS_Util * const opt_DBusInstance) Call this function to inform other applications on the D-Bus about your application. It creates a signal (HELLO signal) on the D-Bus to that other TAF applications can listen.
Page 138
7 Teleservice Application Framework Output Information Return Value Description C_NO_ERR Function executed without error. "Hello" signal was successful sent C_UNKNOWN_ERR D-Bus signal sent, out of memory error C_CONFIG D-Bus message append argument error C_RANGE opt_DBusInstance is a NULL pointer Example // Global module T_DBUS_Util mt_DBUS_Util;...
Page 139
7 Teleservice Application Framework Structure T_DBUS_Util typedef struct DBusConnection* pt_dbus_conn; // D-BUS connection instance charn acn_myNameString[128]; // Name of the application, Don't use any special // characters, white spaces or new lines! charn acn_myVersion[128]; // Additional value (for HELLO) signal (opt.) charn acn_myStatus[128];...
Page 140
7 Teleservice Application Framework 7.3.3.7 dbus_who_is_there_signal Function Description sint32 dbus_who_is_there_signal (const T_DBUS_Util * const opt_DBusInstance) All TAF daemons send a HELLO signal on startup and on request. This function creates a WhoIsThere signal on the D-Bus which then triggers all TAF daemons and the applications that are reacting on it, to answer with HELLO signals.
Page 141
7 Teleservice Application Framework Example // Global module T_DBUS_Util mt_DBUS_Util; sint32 s32_Retval; s32_Retval = dbus_who_is_there_signal (&mt_DBUS_Util); if (s32_Retval != C_NO_ERR) // Handle error cases 7.3.3.8 dbus_call_method Function Description sint32 dbus_call_method (const T_DBUS_Util * const opt_DBusInstance, const charn * const opcn_DBusTarget, const charn * const opcn_MethodName, const charn * const opcn_MethodArgument, charn * const opcn_Answer, const sint32 os32_BufferSize) This function is a generic D-Bus utility function that makes a method call on the D-Bus .
Page 142
7 Teleservice Application Framework Structure T_DBUS_Util typedef struct DBusConnection* pt_dbus_conn; // D-BUS connection instance charn acn_myNameString[128]; // Name of the application, Don't use any special // characters, white spaces or new lines! charn acn_myVersion[128]; // Additional value (for HELLO) signal (opt.) charn acn_myStatus[128];...
Page 143
7 Teleservice Application Framework 7.3.3.9 dbus_call_signal Function Description sint32 dbus_call_signal (const T_DBUS_Util * const opt_DBusInstance, const charn * const opcn_DBusTarget, const charn * const opcn_SignalName, const charn * const opcn_SignalArgument); This generic D-Bus utility function creates a signal call on the D-Bus with one string argument. NOTE: This function is used from TAF internal functions and it is not recommended to use it from user applications.
Page 144
7 Teleservice Application Framework Return Value Description C_UNKNOWN_ERR Error sending the signal call C_WARN Error sending the signal call -> out of memory C_RANGE Some of the function arguments are NULL pointer Example // Global module T_DBUS_Util mt_DBUS_Util; sint32 s32_Retval; s32_Retval = dbus_call_signal(&mt_DBUS_Util, "my_daemon", "SetTimer", "1000");...
Page 145
7 Teleservice Application Framework Parameter Range Description opr_NetworkResponseTimeIndicator callback function for NetworkResponseTimeIndicator opr_WhoIsThereCallback callback function for WhoIsThere signal opr_UserMessageCallback callback function for a message defined by the user Callback function prototypes SMS: typedef void (* PR_LIBTAF_GET_SMS) (const charn * const opcn_PhoneNumber, const charn * const opcn_Message);...
Page 146
7 Teleservice Application Framework Parameter Range Description opcn_InterfaceStatus Signalizes the interface connection to the Down internet, if UP or Down. Goodbye: typedef void (* PR_LIBTAF_GET_GOODBYE) (const charn * const opcn_DaemonName); Output Information Parameter Range Description opcn_DaemonName 0 - 128 characters Name of the daemon which has sent the "goodbye"...
Page 147
Range Description opt_msg DBus_Message Object representing a message received from or to be sent to another application. For receiving all information, add the following dbus rules to your source code: dbus_bus_add_match(mt_dbus_util.pt_dbus_conn, "type='signal',interface='stw.taf.ysmsd'", NULL); dbus_bus_add_match(mt_dbus_util.pt_dbus_conn, "type='signal',interface='stw.taf.ynetworkd'", NULL); dbus_bus_add_match(mt_dbus_util.pt_dbus_conn, "type='signal',interface='stw.taf.broadcast'", NULL); Example...
Page 148
7 Teleservice Application Framework dbus_connection_flush(mt_dbus_util.pt_dbus_conn); dbus_bus_add_match(mt_dbus_util.pt_dbus_conn, "type='signal',interface='stw.taf.ysmsd'", NULL); dbus_connection_flush(mt_dbus_util.pt_dbus_conn); dbus_bus_add_match(mt_dbus_util.pt_dbus_conn, "type='signal',interface='stw.taf.ynetworkd", NULL); dbus_connection_flush(mt_dbus_util.pt_dbus_conn); // Install the callback functions dbus_initialize_request_callbacks (&mv_SMS_Callback, &mv_Hello_Callback, &mv_NetworkNotification_Callback, &mv_Goodbye_Callback, &mv_NRTI_Callback, &mv_WhoIsThere_Callback, &mv_UserDBusMessage); Example: UserMessageCallback The example below shows how the UserMessageCallback is used by the ysignal daemon.
Page 149
7 Teleservice Application Framework DBusMessageIter t_args; if(opt_msg != NULL) // check if the message is "Internet_Connection_State" if (dbus_message_is_signal(opt_msg, "stw.taf.ysignald", "Internet_Connection_State") == TRUE) // Get the message arguments if (!dbus_message_iter_init(opt_msg, &t_args)) (void)printf("ProcessSignalArgument: DBUS message has no arguments\n"); dbus_message_iter_get_basic(&t_args, &pcn_Argument); (void)utils_strlcpy(acn_SignalState, pcn_Argument, sizeof( acn_SignalState));...
Page 150
7 Teleservice Application Framework Output Information Return Value Description C_NO_ERR Function executed without error. C_COM If any error occurs while communicating via D-Bus C_CONFIG D-Bus instance is not correct, an instance of type T_DBUS_Util is expected Example // Global Module sint32_Retval = C_NO_ERR;...
7 Teleservice Application Framework 7.3.4 System Header file: "System_handler.h" 7.3.4.1 Introduction The TAF library system component uses the ysys daemon to provide all system relevant functions like register, trigger or cancel the watchdog. 7.3.4.2 ysysd_register_watch_dog Function Description sint32 ysysd_register_watch_dog (const T_DBUS_Util * const opt_DBusInstance) Requests a watchdog service from the ysysd over the D-Bus, which sets the parameters for future observations of this application.
Page 152
7 Teleservice Application Framework Return Value Description C_BUSY Error registering a watchdog service from the ysysd (pending call) C_UNKNOWN_ERR Error registering a watchdog service from the ysysd (stealing reply) C_CONFIG Error registering a watchdog service from the ysysd (Message has no arguments) C_COM Error registering a watchdog service from the ysysd (Answer is not a string).
Page 153
7 Teleservice Application Framework Output Information Return Value Description C_NO_ERR Function executed without error C_UNKNOWN_ERR Could not sent trigger message C_RANGE Parameter opt_DBusInstance is a NULL pointer Example // Global module T_DBUS_Util mt_DBUS_Util; sint32 s32_Retval; s32_Retval = ysysd_trigger_watch_dog (&mt_DBUS_Util); if (s32_Retval != C_NO_ERR) // Handle error cases 7.3.4.4 ysysd_cancel_watch_dog...
Page 154
7 Teleservice Application Framework // expects to be triggered charn acn_myCMDOnWatchdog[2048]; // Bash cmd that must be executed // by the ysysd in case no // trigger signal occurred in time. } T_DBUS_Util; Output Information Return Value Description C_NO_ERR Function executed without error, the watchdog stopped successfully C_UNKNOWN_ERR Could not cancel the watchdog service from ysysd C_RANGE...
Page 155
7 Teleservice Application Framework Structure T_DBUS_Util typedef struct DBusConnection* pt_dbus_conn; // D-BUS connection instance charn acn_myNameString[128]; // Name of the application, Don't use any special // characters, white spaces or new lines! charn acn_myVersion[128]; // Additional value (for HELLO) signal (opt.) charn acn_myStatus[128];...
Page 156
If your application is in a crucial task that must not be interrupted (e.g. saving data to flash, transferring data to the server), then use this function so that the TC1 stays alive for the time specified with ou32_DurationSec, until this crucial task is finished.
Page 157
7 Teleservice Application Framework Example // Global module T_DBUS_Util mt_DBUS_Util; sint32 s32_Retval; s32_Retval = ysysd_request_stay_alive (&mt_DBUS_Util, 10); if (s32_Retval != C_NO_ERR) // Don't start any of the critical work // here because we can not trust the system // to keep running. // Do the critical work here, the system keeps running User Manual 157/374...
7 Teleservice Application Framework 7.3.5 Datapool Header file: "DP_handler.h" and "DP_dbus_handler.h" These header files provide utility functions to handle the data pool daemon. 7.3.5.1 Introduction The data pool functionality of the TAF library uses the ydata daemon to provide access to common data pools. It provides applications and processes the opportunity to define, create and delete variable lists via D-Bus commands.
Page 159
7 Teleservice Application Framework 7.3.5.2 Dynamic Mode Header file: "DP_dbus_handler.h" This header provides utility functions to use the dbus and data pool daemon in dynamic mode. 7.3.5.2.1 ydatad_create_variable_list Function Description sint32 ydatad_create_variable_list (const T_DBUS_Util *const opt_DBusInstance, const charn * const opcn_Datapool , cosnt charn *const opcn_List, const charn * const opcn_Description, const charn * const opcn_Creator) The function creates a variable list opcn_List in the data pool opcn_Datapool.
Page 160
7 Teleservice Application Framework Output Information Return Value Description C_NO_ERR Function executed without error C_UNKNOWN_ERR Error sending the method call or null pointer C_COM Error receiving the method call answer C_NOACT Error occurs because data pool is already initialized or variable list already exists C_RANGE Parameters are out of range Example...
Page 161
7 Teleservice Application Framework Parameter Range Description opcn_List maximum pointer to the name of the variable list MAX_DP_NAME_LENGTH opcn_Name maximum pointer to the name of the variable MAX_DP_NAME_LENGTH opcn_Type maximum pointer to the type of the variable MAX_DP_TYPENAME_LENGTH, allowed types: "UINT8"...
Page 162
7 Teleservice Application Framework Structure T_DBUS_Util typedef struct DBusConnection* pt_dbus_conn; // D-BUS connection instance charn acn_myNameString[128]; // Name of the application, Don't use any special // characters, white spaces or new lines! charn acn_myVersion[128]; // Additional value (for HELLO) signal (opt.) charn acn_myStatus[128];...
Page 163
7 Teleservice Application Framework 7.3.5.2.3 ydatad_init_variable_list Function Description sint32 ydatad_init_variable_list (const T_DBUS_Util *const opt_DBusInstance, const charn * const opcn_Datapool , const charn *const opcn_List) This function creates and initializes the shared memory segment for the named variable list opcn_List within the data pool opcn_Datapool.
Page 164
7 Teleservice Application Framework Return Value Description C_NOACT Error occurred because the data pool or variable list was already initialized, variable list does not exist, determinate shared memory size failed or allocating of a shared memory segment failed C_RANGE Parameters are out of range Example // Global module T_DBUS_Util mt_DBUS_Util;...
Page 165
7 Teleservice Application Framework Structure T_DBUS_Util typedef struct DBusConnection* pt_dbus_conn; // D-BUS connection instance charn acn_myNameString[128]; // Name of the application, Don't use any special // characters, white spaces or new lines! charn acn_myVersion[128]; // Additional value (for HELLO) signal (opt.) charn acn_myStatus[128];...
Page 166
7 Teleservice Application Framework 7.3.5.2.5 ydatad_get_datapool_base_path Function Description sint32 ydatad_get_datapool_base_path (const T_DBUS_Util *const opt_DBusInstance, charn * const opcn_BasePath, const sint32 os32_Size) This function returns the base path of all data pools on the system, as configured in the ydatad configuration file.
Page 167
7 Teleservice Application Framework Return Value Description C_NOACT Reply error from bus, can't get data pool base path C_RANGE Size of base path array is to small Example // Global module T_DBUS_Util mt_DBUS_Util; sint32 s32_Retval; charn acn_Value[256]; s32_Retval = ydatad_get_datapool_base_path (&mt_DBUS_Util, acn_Value, sizeof (acn_Value)); if (s32_Retval == C_NO_ERR) // Go on 7.3.5.2.6...
Page 168
7 Teleservice Application Framework charn acn_myStatus[128]; // Additional value (for HELLO) signal (opt.) charn acn_myAddInfo[512]; // Additional value (for HELLO) signal (opt.) sint32 s32_myTriginterval; // Time interval when the ysysd // expects to be triggered charn acn_myCMDOnWatchdog[2048]; // Bash cmd that must be executed // by the ysysd in case no // trigger signal occurred in time.
Page 169
7 Teleservice Application Framework Information Flow Input Information Parameter Range Description opt_DBusInstance T_DBUS_Util holds all D-BUS information opcn_Datapool maximum pointer to the name of the data pool MAX_DP_NAME_LENGTH Structure T_DBUS_Util typedef struct DBusConnection* pt_dbus_conn; // D-BUS connection instance charn acn_myNameString[128]; // Name of the application, Don't use any special // characters, white spaces or new lines!
Page 170
7 Teleservice Application Framework 7.3.5.2.8 ydatad_validate_variable Function Description E_DataType ydatad_validate_variable (const charn * const opcn_Type, const charn * const opcn_Size) The function checks whether the type of variable exists and if the size is correct. If both input values fit, the function returns the corresponding "variable type index".
Page 171
7 Teleservice Application Framework Enum E_DataType typedef enum eUNKNOWN = 0, eUINT8, eSINT8, eUINT16, eSINT16, eUINT32, eSINT32, eFLOAT32, eAOBYTE, eSTRING, eNULL }E_DataType; Output Information Return Value Description eNULL Type is unknown else Type and size is found. Returns the variable type index. See E_DataType. User Manual 171/374...
Page 172
7 Teleservice Application Framework 7.3.5.3 Static Mode 7.3.5.3.1 Basic folder structure A data pool is only a folder with a specific name. Every data pool contains 1...n data pool lists files (DPL). A data pool list file contains 1...n variables. Every variable in the DPL file is added to the shared memory. Example The static data pool is stored in the folder /opt/taf/.
Page 173
7 Teleservice Application Framework 7.3.5.3.3 Add variable to DPL file The following components have to be added to the DPL file in order to add a variable: Variable objects Parameter Description [VARIABLE1-n] Start tag which contains the actual number of the variable NAME Name of the variable ADDRESS...
Page 175
7 Teleservice Application Framework 7.3.5.4 Access Data Pool Header file: "DP_handler.h" This header file provides utility functions to use the data pool daemon. 7.3.5.4.1 ydatad_load_datapool Function Description sint32 ydatad_load_datapool (const sint32 os32_DatapoolIndex, const charn * const opcn_Path) This function parses the sub folder of the indexed database ou32_DatapoolIndex and creates a data structure for each valid data list.
Page 176
7 Teleservice Application Framework Example // Global module T_DATA_DATAPOOL_INFO *pt_Datapool; sint32 s32_Retval = C_NO_ERR; charn acn_HelpString[MAX_DP_BASEFOLDER_LENGHT]; uint32 u32_NumberOfDatapools u32_NumberOfDatapools = ydatad_get_size_loaded_datapools (); for (uint32 u32_i = 0; u32_i < s32_NumberOfDatapools; u32_i++) s32_Retval = ydatad_get_datapool_info (u32_i, &pt_Datapool); if (s32_Retval != C_NO_ERR) // Do error handling if (strstr (pt_Datapool_Info->acn_DatapoolName, "MyDatapool") != NULL) s32_Retval = ydatad_load_datapool (u32_i, acn_HelpString);...
Page 177
7 Teleservice Application Framework 7.3.5.4.3 ydatad_load_datapool_names Function Description sint32 ydatad_load_datapool_names (const charn * const opcn_Path) This command skims through the base folder and creates a data pool structure for each subfolder that contains a valid data pool. Information Flow Input Information Parameter Range Description...
Page 178
7 Teleservice Application Framework 7.3.5.4.4 ydatad_get_datapool_info Function Description sint32 ydatad_get_datapool_info (const sint32 os32_DatapoolIndex, T_DATA_DATAPOOL_INFO ** oppt_Datapool) The function gets the data pool info structure from the corresponding data pool index. Information Flow Input Information Parameter Range Description os32_DatapoolIndex 0 .. maximum of sint32 includes a data pool index from data pool list Output Information Parameter...
Page 179
7 Teleservice Application Framework void* pv_SHM_Address; sint32 s32_Address_Offset; } T_DATA_VARIABLE_INFO; typedef enum eUNKNOWN = 0, eUINT8, eSINT8, eUINT16, eSINT16, eUINT32, eSINT32, eFLOAT32, eAOBYTE, eSTRING, eNULL }E_DataType; Return Value Description C_NO_ERR Function executed without error, the pool info was received successfully C_RANGE Selected data pool index isn't valid Example...
Page 180
7 Teleservice Application Framework Information Flow Input Information Parameter Range Description os32_DatapoolIndex 0 .. maximum of sint32 includes the data pool index os32_VariableListIndext 0 .. maximum of sint32 includes the variable list index opcn_VariableName 1 .. pointer to the variable name MAX_DP_NAME_LENGTH Output Information Return Value...
Page 182
7 Teleservice Application Framework // "UINT8" // "SINT8" // "UINT16" // "SINT16" // "UINT32" // "SINT32" // "FLOAT32" // "AOBYTE" // "STRING" E_DataType e_TypeIndex; sint32 s32_Size; // Size of the variable charn acn_Unit[MAX_DP_METANAME_LENGTH]; // Unit of the variable, max size of 64 charn acn_Comment[MAX_DP_METANAME_LENGTH];...
Page 183
7 Teleservice Application Framework Information Flow Input Information Parameter Range Description os32_DatapoolIndex 0 .. maximum of sint32 includes the data pool index os32_VariableListIndex 0 .. maximum of sint32 includes the variable list index os32_VariableIndex 0 .. maximum of sint32 includes the variable index opv_Buffer ou32_NumberOfBytesToWrite pointer to the value for the variable...
Page 184
7 Teleservice Application Framework Information Flow Input Information Parameter Range Description os32_DatapoolIndex 0 .. maximum of sint32 includes the data pool index os32_VariableListIndex 0 .. maximum of sint32 includes the variable list index os32_VariableIndex 0 .. maximum of sint32 includes the variable index ou32_SizeOfBuffer depends on variable size includes the size of the buffer in bytes for the...
Page 185
7 Teleservice Application Framework 7.3.5.4.9 ydatad_get_variable_info Function Description sint32 ydatad_get_variable_info (const sint32 const sint32 os32_DatapoolIndex, os32_VariableListIndex, const sint32 os32_VariableIndex, T_DATA_VARIABLE_INFO * const opt_DataVariableInfo) The function verifies whether the indexed variable exists and returns a pointer to the variable information structure opt_DataVariableInfo. Information Flow Input Information Parameter...
Page 186
7 Teleservice Application Framework eFLOAT32, eAOBYTE, eSTRING, eNULL }E_DataType; Return Value Description C_NO_ERR Function executed without error, read data pool info runs successful C_RANGE Data pool, list or variable does not exist, or NULL pointer Example //Global module sint32 s32_DataPoolIndex; sint32 s32_ListIndex;...
Page 187
7 Teleservice Application Framework Output Information Return Value Description C_NO_ERR The list has been updated C_NOACT The list has not been updated C_RANGE Data pool or variable list does not exist 7.3.5.4.11 ydatad_check_update_variable Function Description sint32 ydatad_check_update_variable const sint32 os32_DatapoolIndex const sint32 os32_VariableListIndex const sint32 os32_VariableIndex...
Page 188
7 Teleservice Application Framework 7.3.5.4.12 ydatad_get_updated_variable Function Description sint32 ydatad_get_updated_variable const sint32 os32_DatapoolIndex const sint32 os32_VariableListIndex sint32 const ops32_VariableIndex The function gets the variable index of the first updated variable in the data pool list specified by os32_DatapoolIndex and os32_VariableListIndex. Information Flow Input Information Parameter...
7 Teleservice Application Framework 7.3.6 Datalogger Header file: "DL_LogFile_handler.h" and "DL_dbus_handler.h" These header files provide utility functions to handle the logger daemon. 7.3.6.1 Introduction The datalogger TAF library functionality uses the ylog daemon to provide the opportunity to create static or dynamic logging jobs.
Page 190
7 Teleservice Application Framework How the logger mechanism works User Manual 190/374...
Page 191
7 Teleservice Application Framework 7.3.6.2 Dynamic mode Header file: "DL_dbus_handler.h" This header provides utility functions to use the dbus and the logger daemon in dynamic mode. 7.3.6.2.1 ylogd_create_log_job Function Description sint32 ylogd_create_log_job (const T_DBUS_Util *const opt_DBusInstance, const charn * const opcn_LogJobName ,const uint32 ou32_LogFileFormat, const uint32 ou32_JobSize, const uint32 ou32_TimeStamp, const charn * const opcn_Comment, const uint32 ou32_SampleTime) The function creates a new log job.
Page 192
7 Teleservice Application Framework Structure T_DBUS_Util typedef struct DBusConnection* pt_dbus_conn; // D-BUS connection instance charn acn_myNameString[128]; // Name of the application, Don't use any special // characters, white spaces or new lines! charn acn_myVersion[128]; // Additional value (for HELLO) signal (opt.) charn acn_myStatus[128];...
Page 193
7 Teleservice Application Framework 23.11.10_10:00:51:159;[0x000003];Height;688;[0x000005];Course;327;[0x000100],Temperature;25; // First line 23.11.10_10:00:52:150;[0x000100];Temperature;25;// Second line ASCII_TC1 Log File header: ---------------- LOGFILE_HEADER LogFile;Test_Logger LogFileFormat;2 Comment;Test log job for Test MaxSize;10485760 Date+Time;22.11.11_13:30:53 FileInfo: Timestamp:1 DP :00;Test Lst:00;Engine Var:00;EngineSpeed;Type:SINT32;Size:4;Unit:rpm Var:01;InjectionQuantity;Type:SINT32;Size:4;Unit:mm3/H Var:02;EnginePowerReserve;Type:SINT32;Size:4;UNIT:% DATASTART Time stamp in sec since 2000 Value Value Value...
Page 194
7 Teleservice Application Framework START_TAG BlockLength Datainfo Datum in sec since DP List DP List Datum 1970 Var ID (uint16) (uint16) (uint16) (Datum Length * (uint32) (uint8) (uint8) uint8) Datainfo: BIT 0 1 ---------- 0 = time triggered 1 = event triggered 2 = time or event triggered BIT 2 3 ----------...
Page 195
7 Teleservice Application Framework Example // Global module T_DBUS_Util mt_DBUS_Util; sint32 s32_Retval; s32_Retval = ylogd_create_log_job (&mt_DBUS_Util, "TC3_Logger", 1, 1024*1024, 1, "Test log job", 500); if (s32_Retval == C_NO_ERR) // Go on 7.3.6.2.2 ylogd_add_log_variable Function Description sint32 ylogd_add_log_variable (const T_DBUS_Util *const opt_DBusInstance, const charn * const opcn_LogJobName , const charn * const opcn_DatapoolName, const charn * const opcn_ListName, const charn * const opcn_VariableName, const uint32 ou32_Hysteresis) The function adds a variable to be logged as part of a data logging record of the data logger job...
Page 196
7 Teleservice Application Framework charn acn_myAddInfo[512]; // Additional value (for HELLO) signal (opt.) sint32 s32_myTriginterval; // Time interval when the ysysd // expects to be triggered charn acn_myCMDOnWatchdog[2048]; // Bash cmd that must be executed // by the ysysd in case no // trigger signal occurred in time.
Page 197
7 Teleservice Application Framework 7.3.6.2.3 ylogd_set_variable_change_cmd Function Description sint32 ylogd_set_variable_change_cmd (const T_DBUS_Util * const opt_DBusInstance, const charn * const opcn_LogJobName, const charn * const opcn_DatapoolName, const charn * const opcn_ListName, const charn * const opcn_VariableName, const charn * const opcn_Command) The function adds a new variable event command to expected log job opcn_LogJobName.
Page 198
7 Teleservice Application Framework Structure T_DBUS_Util typedef struct DBusConnection* pt_dbus_conn; // D-BUS connection instance charn acn_myNameString[128]; // Name of the application, Don't use any special // characters, white spaces or new lines! charn acn_myVersion[128]; // Additional value (for HELLO) signal (opt.) charn acn_myStatus[128];...
Page 199
7 Teleservice Application Framework It's possible to select one of the following log mechanisms: TIME_TRIGGERED: Every ou32_LoggingInterval which can be set via ylogd_set_trigger_time (see "ylogd_set_trigger_time" on page 200) function, a dataset will be written to the datalogger log file. In TIME_TRIGGERED mode the ou32_SampleTime, which can be set via the function ylogd_create_log_job (see "ylogd_create_log_job"...
Page 200
7 Teleservice Application Framework Structure T_DBUS_Util typedef struct DBusConnection* pt_dbus_conn; // D-BUS connection instance charn acn_myNameString[128]; // Name of the application, Don't use any special // characters, white spaces or new lines! charn acn_myVersion[128]; // Additional value (for HELLO) signal (opt.) charn acn_myStatus[128];...
Page 201
7 Teleservice Application Framework 7.3.6.2.5 ylogd_set_trigger_time Function Description sint32 ylogd_set_trigger_time (const T_DBUS_Util *const opt_DBusInstance, const charn * const opcn_LogJobName, const uint32 ou32_LoggingInterval) The function sets the time interval between two data logging records. The logging interval ou32_Logging has to be greater than or equal to the sample time. The sample time is set in the function ylogd_create_log_job (see "ylogd_create_log_job"...
Page 202
7 Teleservice Application Framework Output Information Return Value Description C_NO_ERR Function executed without error, trigger time was activated successfully C_COM D-Bus communication error C_UNKNOWN_ERR NULL pointer error C_RANGE opcn_LogJobName is out of range C_NOACT Error occurred because the logger job name was invalid, trigger time interval is to short, data logger configuration does not exist, DLC file is corrupt or logger already exists Example...
Page 203
7 Teleservice Application Framework Information Flow Input Information Parameter Range Description opt_DBusInstance T_DBUS_Util holds all D-Bus information opcn_LogJobName maximum pointer to log job name MAX_DL_NAME_LENGTH ou32_LoggingBufferSize maximum 0 means buffer disabled MAX_DL_BUFFER_SIZE Otherwise number of log entries to buffer Structure T_DBUS_Util typedef struct DBusConnection* pt_dbus_conn;...
Page 204
7 Teleservice Application Framework Return Value Description log job does not exists log job is active and cannot be updated C_RANGE Parameters are out of range 7.3.6.2.7 ylogd_set_master_save_condition Function Description sint32 ylogd_set_master_save_condition (const T_DBUS_Util *const opt_DBusInstance, const charn * const opcn_LogJobName, const charn * const opcn_DatapoolName, const charn * const opcn_ListName, const charn * const opcn_VariableName, const charn * const opcn_Logic, const uint32 ou32_Hysteresis, const uint32 ou32_Threshold, const charn * const opcn_Concatenation)
Page 205
7 Teleservice Application Framework Parameter Range Description opcn_LogJobName maximum pointer to the log job name MAX_DL_NAME_LENGTH opcn_DatapoolName maximum pointer to the data pool name MAX_DP_NAME_LENGTH opcn_ListName maximum pointer to the variable list name MAX_DP_NAME_LENGTH opcn_VariableName maximum pointer to the variable name MAX_DP_NAME_LENGTH opcn_Logic maximum...
Page 206
7 Teleservice Application Framework Return Value Description C_COM D-Bus communication error C_UNKNOWN_ERR Wrong or existing job, dp, list, var name or wrong parameter for concatenation, logic or NULL pointer C_NOACT Error occurred because the logger job, data pool, variable list or variable name invalid, logic, or concatenation operator was invalid, received values corrupt, data logger configuration does not exist, DLC file corrupt or logger already initialized C_RANGE...
Page 207
7 Teleservice Application Framework 7.3.6.2.8 ylogd_set_save_condition Function Description sint32 ylogd_set_save_condition (const T_DBUS_Util *const opt_DBusInstance, const charn * const opcn_LogJobName, const charn * const opcn_DatapoolName, const charn * const opcn_ListName, const charn * const opcn_VariableName, const charn * const opcn_Logic, const uint32 ou32_Hysteresis, const uint32 ou32_Threshold, const charn * const opcn_Concatenation) This function adds a new save condition to the log job opcn_LogJobName: if (VARIABLE ('<='or '>= or '==' or '!=') (os32_Threshold +/- os32_Hysteresis))
Page 208
7 Teleservice Application Framework Parameter Range Description ou32_Threshold uint32 pointer to the logging threshold for the variable we expect to log opcn_Concatenation maximum pointer to concatenation options like 'AND', 'OR' MAX_DL_CONC_LENGTH and 'EXOR' Structure T_DBUS_Util typedef struct DBusConnection* pt_dbus_conn; // D-BUS connection instance charn acn_myNameString[128];...
Page 209
7 Teleservice Application Framework Association between logic, hysteresis and threshold Example // Global module T_DBUS_Util mt_DBUS_Util; sint32 s32_Retval; s32_Retval = ylogd_set_save_condition (&mt_DBUS_Util, "TC3_Logger", "MyDatapool", "GPSDates", "Longitude", ">=", 5, 10, "AND"); if (s32_Retval == C_NO_ERR) // Go on User Manual 209/374...
Page 210
7 Teleservice Application Framework 7.3.6.2.9 ylogd_set_log_management Function Description sint32 ylogd_set_log_management(const T_DBUS_Util * const opt_DBusInstance, const charn * const opcn_LogJobName, const charn * const opcn_LogDestination, const uint32 ou32_LogDuration, const uint32 ou32_LogCompression, const uint32 ou32_LogFolderSize, const charn * const opcn_LogFileExtension); The function configures the log management settings of a log job. When the log job terminates or a file limit is reached, a resulting log file will be placed in the destination directory.
Page 211
7 Teleservice Application Framework Parameter Range Description ou32_LogFolderSize if folder size reaches this level, older logs will be deleted opcn_LogFileExtension maximum Extension of the logger file. MAX_DL_NAME_LENGTH Structure T_DBUS_Util typedef struct DBusConnection* pt_dbus_conn; // D-BUS connection instance charn acn_myNameString[128]; // Name of the application, Don't use any special // characters, white spaces or new lines! charn...
Page 212
7 Teleservice Application Framework Return Value Description can not read data logger configuration, can not allocate space can not start child process can not get on the bus C_RANGE opcn_LogJobName is out of range 7.3.6.2.10 ylogd_set_log_file_cmd Function Description sint32 ylogd_set_log_file_cmd (const T_DBUS_Util * const opt_DBusInstance, const charn * const opcn_LogJobName,...
Page 213
7 Teleservice Application Framework // expects to be triggered charn acn_myCMDOnWatchdog[2048]; // Bash cmd that must be executed // by the ysysd in case no // trigger signal occurred in time. } T_DBUS_Util; Output Information Return Value Description C_NO_ERR Function executed without error buffered trigger was successfully set C_COM D-Bus communication error...
Page 214
7 Teleservice Application Framework Structure T_DBUS_Util typedef struct DBusConnection* pt_dbus_conn; // D-BUS connection instance charn acn_myNameString[128]; // Name of the application, Don't use any special // characters, white spaces or new lines! charn acn_myVersion[128]; // Additional value (for HELLO) signal (opt.) charn acn_myStatus[128];...
Page 215
7 Teleservice Application Framework 7.3.6.3 Static mode 7.3.6.3.1 Basic DLC file structure Every datalogger configuration file has the following basic components: Necessary DLC file objects Parameter Description [JOBOPTIONS] Start tag of the DLC file ACTIVE Active flag will be automatically set to 1 by ylogd after correct file parsing LFJNAME Name of the log file job LFFORMAT...
Page 216
7 Teleservice Application Framework Parameter Description TIME_TRIGGERED (1) Every TRIGGERTIME, a dataset will be written to the datatlogger log file. In TIME_TRIGGERED mode, the BASIC_SAMPLE_TIME shall be equal to TRIGGERTIME TIME_AND_EVENT_TRIGGERED (2) A dataset will be written to the datalogger log file when the selected TRIGGERTIME is reached and the chosen save condition(s) is(are) true.
Page 217
7 Teleservice Application Framework ASCII_TC1 Log File header: ---------------- LOGFILE_HEADER LogFile;Test_Logger LogFileFormat;2 Comment;Test log job for Test MaxSize;10485760 Date+Time;22.11.11_13:30:53 FileInfo: Timestamp:1 DP :00;Test Lst:00;Engine Var:00;EngineSpeed;Type:SINT32;Size:4;Unit:rpm Var:01;InjectionQuantity;Type:SINT32;Size:4;Unit:mm3/H Var:02;EnginePowerReserve;Type:SINT32;Size:4;UNIT:% DATASTART Time stamp in sec since 2000 Value Value Value Value $540000;28;755;Test;28;56332; // First line $540001;;;Test2;29;;// Second line ASCII_CSV Log File header:...
Page 218
7 Teleservice Application Framework BIT 2 3 ---------- 0 = no timestamp 1 = RTC 2 = user defined timestamp BIT 4 0 = C2C Format Binary_TC3_LE Log File header: ---------------- LOGFILE_HEADER LogFile;Test_Logger LogFileFormat;5 Comment;Test log job for Test MaxSize;10485760 Date+Time;22.11.11_13:30:53 FileInfo: Timestamp:1...
Page 219
7 Teleservice Application Framework NUMMASTERSAVECONDITIONS=0 [SAVECONDITIONS] LOG_MECHANISM=1 TRIGGERTIME=0 NUMSAVECONDITIONS=0 7.3.6.3.2 Add variable to DLC file The following variable objects have to be added to the DLC file in order to add a variable: Variable objects Parameter Description [SAMPLECONDITION1- Start tag which contains the actual number of the variable which shall be logged NAME Name of the variable DATAPOOL...
Page 220
7 Teleservice Application Framework 7.3.6.3.3 Add master save condition to DLC file The following variable objects have to be added to the DLC file in order to add a master save condition: Variable objects Parameter Description [MASTERSAVECONDITION1- Start tag which contains the actual number of the save condition VARIABLENAME Name of the master save condition variable DATAPOOL...
Page 222
7 Teleservice Application Framework THRESHOLD=1000 CONCATENATION=OR [SAVECONDITIONS] LOG_MECHANISM=1 TRIGGERTIME=0 NUMSAVECONDITIONS=0 7.3.6.3.4 Add save condition to DLC file The following variable objects have to be added to the DLC file in order to add a save condition: Variable objects Parameter Description [SAVECONDITION1- Start tag which contains the actual number of the save condition VARIABLENAME...
Page 223
7 Teleservice Application Framework Association between logic, hysteresis and threshold User Manual 223/374...
Page 225
7 Teleservice Application Framework 7.3.6.4 Handle Logger File Header file: "DL_LogFile_handler.h" This header provides utility functions to use the logger daemon to handle logger files. 7.3.6.4.1 ylogd_request_data_logger_file Function Description sint32 ylogd_request_data_logger_file (const T_DBUS_Util *const opt_DBusInstance, const charn * const opcn_DataLoggerName, charn * const opcn_DataLoggerPath, const uint16 ou16_BufferSize) The function requests the datalogger file opcn_DataLoggerName.
Page 226
7 Teleservice Application Framework Output Information Parameter Range Description opcn_DataLoggerPath ou16_BufferSize contains the path to the datalogger file copy Return Value Description C_NO_ERR file was found, logger name fits and file pointer was set successfully C_CONFIG no file found or logger name is incorrect C_UNKNOWN_ERR NULL pointer error C_RANGE...
Page 227
7 Teleservice Application Framework Structure T_DBUS_Util typedef struct DBusConnection* pt_dbus_conn; // D-BUS connection instance charn acn_myNameString[128]; // Name of the application, Don't use any special // characters, white spaces or new lines! charn acn_myVersion[128]; // Additional value (for HELLO) signal (opt.) charn acn_myStatus[128];...
Page 228
7 Teleservice Application Framework 7.3.6.4.3 ylogd_trigger_buffered_log Function Description sint32 ylogd_trigger_buffered_log(const T_DBUS_Util * const opt_DBusInstance, const charn * const opcn_DataLoggerName) The function causes an activated, buffered log job to flush its ring buffer to the log file and then continue operation as normal. Information Flow Input Information Parameter...
7 Teleservice Application Framework 7.3.7 Header file: "GPS_handler.h" 7.3.7.1 Introduction The GPS functionality from the TAF library uses the ygps daemon to provide position, date, time, height and actual speed from the integrated GPS receiver. 7.3.7.2 ygpsd_get_gps_data Function Description sint32 ygpsd_get_gps_data (const T_DBUS_UTIL * const opt_DBusInstance T_DBUS_GPS_Data * const opt_DBusGpsData) The function sends a method call on the D-Bus to the ygpsd opt_DBusInstance to receive GPS data.
Page 230
7 Teleservice Application Framework Output Information Result Range Description opt_DBusGpusData T_DBUS_GPS_Data holds the GPS data information Structure T_DBUS_GPS_Data typedef struct charn acn_status[32]; // NONE = fix not available, // NMEA = receiving valid nmea string from gps receiver charn acn_latitude[32]; // Degrees notation: DD.dddddd charn acn_longitude[32];...
Page 231
7 Teleservice Application Framework Example static sint32 ms32_RequestGPSData(const T_DBUS_Util* const opt_DBusInstance) T_DBUS_GPS_Data t_DBus_GPS_Data; // Call dbus util function if(ygpsd_get_gps_data (opt_DBusInstance, &t_DBus_GPS_Data) != 0) printf("Error fetching GPS data!\n"); return C_COM; // To something with the received values return C_NO_ERR; User Manual 231/374...
7 Teleservice Application Framework 7.3.8 Header file: "SMS_handler.h" 7.3.8.1 Introduction The SMS functionality from the TAF library uses the ysms daemon to send and receive SMS messages SMS can be sent or received either after standard time intervals or immediately. The standard time interval and other parameters can be configured in the ysmsd configuration file (see SMS daemon (see "SMS daemon"...
Page 233
7 Teleservice Application Framework Output Information Return Value Description C_NO_ERR Function executed without error C_UNKNOWN_ERR NULL pointer or memory error C_COM D-Bus communication error C_RANGE Invalid SMS or phone number length Example sint32 s32_Retval = C_NO_ERR; T_DBUS_Util mt_DBUS_Util; s32_Retval = ysmsd_send_sms (&mt_DBUS_Util, "017612341234", "Hello World"); if (s32_Retval == C_NO_ERR) // Go on 7.3.8.3...
Page 234
7 Teleservice Application Framework // characters, white spaces or new lines! charn acn_myVersion[128]; // Additional value (for HELLO) signal (opt.) charn acn_myStatus[128]; // Additional value (for HELLO) signal (opt.) charn acn_myAddInfo[512]; // Additional value (for HELLO) signal (opt.) sint32 s32_myTriginterval; // Time interval when the ysysd // expects to be triggered charn...
Page 235
7 Teleservice Application Framework Structure T_DBUS_Util typedef struct DBusConnection* pt_dbus_conn; // D-BUS connection instance charn acn_myNameString[128]; // Name of the application, Don't use any special // characters, white spaces or new lines! charn acn_myVersion[128]; // Additional value (for HELLO) signal (opt.) charn acn_myStatus[128];...
7 Teleservice Application Framework 7.3.9 Network Header file: "Network_handler.h" 7.3.9.1 Introduction The ynetwork daemon provides functions to manage the internet connectivity automatically. Via D-Bus the ynetworkd can be switched from connected to disconnected. It is also possible to get the actual connected interface.
Page 237
7 Teleservice Application Framework } T_DBUS_Util; Output Information Parameter Range Description opcn_ConnectedInterface ou8_BufferSize name of the actual connected interface, "ETH", "WLAN", "PPP", "NotConnected" Return Value Description C_NO_ERR Function executed without error C_COM D-Bus communication error C_CONFIG Invalid interface length or NULL pointer Example sint32 s32_Retval = C_NO_ERR;...
Page 238
7 Teleservice Application Framework Structure T_DBUS_Util typedef struct DBusConnection* pt_dbus_conn; // D-BUS connection instance charn acn_myNameString[128]; // Name of the application, Don't use any special // characters, white spaces or new lines! charn acn_myVersion[128]; // Additional value (for HELLO) signal (opt.) charn acn_myStatus[128];...
Page 239
7 Teleservice Application Framework 7.3.9.4 ynetworkd_stop_connection Function Description sint32 ynetworkd_stop_connection (const T_DBUS_Util *const opt_DBusInstance) The function turns the ynetworkd into not connected mode. If a connection is established, the connection will be automatically closed. Information Flow Input Information Parameter Range Description opt_DBusInstance T_DBUS_Util...
Page 240
7 Teleservice Application Framework Example sint32 s32_Retval = C_NO_ERR; T_DBUS_Util mt_DBUS_Util; s32_Retval = ynetworkd_stop_connection (&mt_DBUS_Util); if (s32_Retval == C_NO_ERR) // Go on User Manual 240/374...
FWSW – Set wakeup cycle time Syntax of command: FWSW;<wakeup_cycle> Syntax of response: FWSW;<error_code> Description: Set a new wakeup cycle time. At this interval the TC1 requests a new NextJob.job from the ComServer. Parameter: Input: Variable Variable Type Description...
Page 242
7 Teleservice Application Framework Output: Variable Variable Type Description error_code uint16 0: no error occurred, else command failed DLGN – Get data logger log file by name Syntax of command: DLGN;<name>;<format>;<clear>;<first_dataset> Syntax of response: DLGN;<error_code> Description: Returns the content of the specified data logger log file. Starts with first_dataset. Log file data can be deleted after reading is finished.
Page 243
7 Teleservice Application Framework DLCN – Clear data logger log file by name Syntax of command: DLCN;<name> Syntax of response: DLCN;<error_code> Description: Clears the specified data logger log file (Only deletes logger data, does not delete the log file). Parameter: ...
Page 244
7 Teleservice Application Framework Parameter: Input: Variable Variable Type Description block_len uint16 Length of data section in bytes 16 ((for name) + (No. of index * 2)) name string File name for returned data (max 16 char) var_index_n uint16 Index of variables to be read ...
Page 245
7 Teleservice Application Framework Parameter: Input: Variable Variable Type Description block_len_n uint16 Size of variable + 2 bytes for index (for binary format only) var_index_n uint16 Index of variables to be written value_n Value of variable. Size (m) specified by var_index (via KSP file) and block_len_n-2 ...
Page 246
7 Teleservice Application Framework Output: Variable Variable Type Description error_code uint16 0: no error occurred, else command failed 7.3.10.3 Server independent commands User specific commands can be send via yserverd on the D-Bus. To use this mechanism, the following syntax must be used: Send to D-Bus DBUS;<response>;<destination>;<data_length>;<payload><CR>...
Page 247
7 Teleservice Application Framework 7.3.10.4 yserverd_request_nextjob Function Description sint32 yserverd_request_nextjob (const T_DBUS_Util * const opt_DBusInstance) The function sends a D-Bus message for immediate request of a NextJob.job file. All running yserverd instances will receive the message. All instances of the yserverd check if there is a new Nextjob.job file available on the server.
7 Teleservice Application Framework 7.3.11 Signal Header file: "Signal_handler.h" NOTE: The signal daemon can only be used, when a LED is available on the used module. 7.3.11.1 Introduction The ysignal daemon signalizes the current state of the module (for example Power ON) according to the D-Bus signals of the ynetworkd and ygpsd.
Page 249
7 Teleservice Application Framework Structure T_DBUS_Util typedef struct DBusConnection* pt_dbus_conn; // D-BUS connection instance charn acn_myNameString[128]; // Name of the application, Don't use any special // characters, white spaces or new lines! charn acn_myVersion[128]; // Additional value (for HELLO) signal (opt.) charn acn_myStatus[128];...
Page 250
7 Teleservice Application Framework 7.3.11.3 ysignald_GPS_con_state Function Description sint32 ysignald_GPS_con_state (const T_DBUS_Util * const opt_DBusInstance, const charn * const opcn_SignalArgument); This function sends the desired GPS state via D-BUS. To be able to use this function the UseExternalGPSState must be set to true. UseExternalGPSState can be configured in the configuration file ysignald.config of the ysignal daemon (see "Signal daemon"...
Page 251
7 Teleservice Application Framework Example /* Register with D-BUS */ if(dbus_get_on_the_bus(&mt_dbus_util) != 0) // Register application on D-BUS failed */ return(1); /* send dbus signal */ s32_retval = ysignald_GPS_con_state(&mt_dbus_util, "Valid"); if(s32_retval != C_NO_ERR) // Sending 'GPS_Connection_State' signal with state 'Valid' faild return(1);...
7 Teleservice Application Framework 7.3.12 Utils Header file: "utils.h" 7.3.12.1 utils_create_directory Function Description sint32 utils_create_directory (const charn * const opcn_Path, const mode_t oun_Mode) The function creates a directory, in case the directory does not already exist. Information Flow Input Information Parameter Range Description...
Page 253
7 Teleservice Application Framework 7.3.12.2 utils_remove_directory Function Description sint32 utils_remove_directory (const charn * const opcn_DirPath) The function removes a directory, in case the directory exists. Information Flow Input Information Parameter Range Description opcn_DirPath pointer to the name of the directory Output Information Return Value Description...
Page 254
7 Teleservice Application Framework 7.3.12.4 utils_reg_file_exists Function Description sint32 utils_reg_file_exists (const charn * const opcn_FileName) The function verifies if the regular file opcn_FileName exists in the current folder. Information Flow Input Information Parameter Range Description opcn_FileName pointer to regular file name we expect to find Output Information Return Value Description...
Page 255
7 Teleservice Application Framework 7.3.12.6 utils_link_exists Function Description sint32 utils_link_exists (const charn * const opcn_LinkName) The function verifies if the link opcn_LinkName exists in the current folder. Information Flow Input Information Parameter Range Description opcn_LinkName pointer to name of the link to check Output Information Return Value Description...
Page 256
7 Teleservice Application Framework 7.3.12.8 utils_fifo_exists Function Description sint32 charn const * const s32_FifoExists( opcn_FifoName The function verifies if the FIFO opcn_FifoName exists in the current folder. Information Flow Input Information Parameter Range Description opcn_FifoName pointer to FIFO name Output Information Return Value Description The FIFO exists...
Page 257
7 Teleservice Application Framework 7.3.12.10 utils_search_first_value Function Description sint32 utils_search_first_value (FILE * const charn * const charn * opt_File, opcn_SearchString, opcn_ValueTarget, const uint32 ou32_ValueTargetBufferSize) The function searches for the string opcn_SearchString, from the beginning in the file opt_File. If opcn_SearchString is located in the file, the rest of the line is copied into opcn_ValueTarget. The maximal length of opcn_ValueTarget is defined by ou32_ValueTargetBufferSize in byte.
Page 258
7 Teleservice Application Framework Parameter Range Description opcn_SearchString pointer to the search string opcn_ValueTarget pointer to the value string opcn_ValueTargetBufferSize pointer to the buffer size of the value Output Information Return Value Description C_NO_ERR search string is found and value is written to buffer C_UNKNOWN_ERR no search string found, buffer too small or couldn't allocate buffer 7.3.12.12 utils_open_log_file...
Page 259
7 Teleservice Application Framework 7.3.12.13 utils_log_print Function Description sint32 utils_log_print (charn * opcn_LogString The function prints the string opcn_LogString in the log file that was already opened. The function adds a time stamp to the string opcn_LogString. If the string could not be added to the log file, it is printed to stdout. Information Flow Input Information Parameter...
Page 260
7 Teleservice Application Framework 7.3.12.15 utils_remove_file Function Description sint32 utils_remove_file (const charn * const opcn_FileName The function removes the file opcn_FileName. Before the file will be removed, the content will be deleted. Recovering of the content is not possible. Information Flow Input Information Parameter Range...
Page 261
7 Teleservice Application Framework Return Value Description C_NO_ERR Function executed without error, a semaphore ID was successful generated C_CONFIG Semaphore counter is smaller than or equal to zero C_NOACT An error occurred when generating a new semaphore ID, or getting the semaphore ID that was already initialized 7.3.12.17 utils_semaphore_remove Function Description...
Page 262
7 Teleservice Application Framework Information Flow Input Information Parameter Range Description osn_SHMKey Specifies either the IPC_PRIVATE value or an IPC key constructed by the ftok subroutine Output Information Parameter Range Description ops32_SemID includes the semaphore ID Return Value Description C_NO_ERR Function executed without error, a semaphore ID was successful generated C_CONFIG invalid semaphore key...
Page 263
7 Teleservice Application Framework Return Value Description C_NOACT The function can not lock the semaphore with the given ID 7.3.12.20 utils_semaphore_unlock Function Description sint32 utils_semaphore_unlock (const sint32 os32_SemID const uint8 ou8_Mode The function unlocks the semaphore os32_SemID that was locked before. Use function after leaving a critical section.
Page 264
Return Value Description C_NO_ERR Function executed without error else "TC1-GET_HOSTNAME_ERR" will be set to the output 7.3.12.22 utils_write_string_value Function Description sint32 utils_write_string_value (FILE * opt_File const charn * const opcn_String The function write the string opcn_String to the end of the file opt_File.
Page 265
7 Teleservice Application Framework Output Information Return Value Description >0 time format as integer (seconds since 1970) C_CONFIG The time string is corrupted 7.3.12.24 utils_get_time Function Description charn * utils_get_time (charn * opcn_Time The function writes the current time and date as a string into opcn_Time. Information Flow Output Information Parameter...
Page 266
7 Teleservice Application Framework 7.3.12.26 utils_get_time_ms Funcon Description uint32 utils_get_time_ms (void) The function returns the current time that is elapsed since the TC1 was initialized. The elapsed time is scaled in milliseconds. Information Flow Output Information Return Value Description uint32 Up time in milliseconds 7.3.12.27 utils_open_dir...
Page 267
7 Teleservice Application Framework 7.3.12.28 utils_close_dir Function Description void utils_close_dir(void* const opv_DirHandle) The function closes a directory handle. Information Flow Input Information Parameter Range Description opv_DirHandle Directory handle 7.3.12.29 utils_read_dir Function Description sint32 utils_read_dir(void* const opv_DirHandle, const charn* const opcn_Match, charn* const opcn_FileName) opcn_FileName opcn_Match...
Development Tools Create Own Root File System STW provides a "Board Support Package" for the TC1. Within this BSP the customer has the possibility to create its own root file system. The BSP uses Buildroot (http://buildroot.uclibc.org/) BR to create the root file system.
Page 269
The STW rootfs version is configured by option BR2_STW_VERSION in the defconfig file. It can be changed either by editing the defconfig file or via the menuconfig->Set STW Version. The version of the final rootfs can be read in file /etc/br_version.
5. The following screen output signalizes that your setup is correct and that you successfully built the root file system with default settings: The 'rootfs.ubi' can be found in the result folder. In order to update the TC1 see chapter Linux Updater (see "Linux Updater"...
In order to change the configuration of the root file system e.g. enable or disable certain packages, it should be built with default settings first (do_make_all). Use the STW build script 'do_menuconfig' under 'bat/buildscripts' to enable or disable a package. For further information see chapter STW Build Scripts (see "STW Build...
Page 272
8 Development Tools Enter the Buildroot configuration menu via ./bat/buildscripts/do_menuconfig. Inside the configuration menu it is possible to navigate through the sub menus and activate or deactivate the desired packages. Use the search function, if you know the name of the package. Open the search mask with '/' (like vi), insert the package name, and press ENTER.
Page 273
8 Development Tools The results will be displayed. 'Location' shows the path to the searched package. In this case: Top level -> Package Selection for the target -> Libraries -> JSON/XML User Manual 273/374...
Page 274
8 Development Tools After navigation to this location, the searched package can be activated or deactivated. After the configuration is done, go to the top level and save the changes when leaving the menuconfig. When the build script 'do_make' is executed next, it will create a root file system with the new configurations. NOTE: 'do_make_all' will overwrite the buildroot and busybox configuration with the target defconfig.
The packages need to be added to the './libs/br_pjt/package' directory. When a desired package is not available in the STW customer package selection, there is a fair chance, that this package exists in a newer version of Buildroot. In order to find out, the latest BR source tree should be searched for this package.
Page 276
The script creates a FIT image from the rootfs.ubi result file. This image is located in the result folder and can be used to update the TC1 via the STW U-Boot update mechanism. do_distclean The script cleans the buildroot folder after a rootfs is build. The script deletes all files generated during the build process.
8 Development Tools Create Own Application Precondition: To be able to create an application, the toolchain must be installed on your platform that are you using for application development. Refer therefor to Toolchain (see "Toolchain" on page 284). Compile a program: There are basically two ways to compile a program: ...
Page 278
8 Development Tools Start the CodeBlocks IDE. Menu: File | new | project Pick the empty project. Click Go. The empty project wizard will pop up. Click Next. Specify the name of the project, the directory for the project file and the name of the project file. Click Next.
Page 279
Project directory “test”: test | pjt: This folder contains the project files test | result | TC1: This folder contains the compiled output file The new project shall be displayed in the "Project Management area". User Manual 279/374...
8 Development Tools 8.2.2 Code Blocks After a New Project (see "Create New Project" on page 277) is created the "Workspace" is available: Create a source file. Switch to the src directory of the project and create a new file "main.c": Add the file to the project.
Page 281
Code::Blocks compiles and links all necessary components and creates an executable file in the output directory. Copy the file to the device (for example over NFS (see "NFS" on page 315)): Copy file via NFS Note: Don't forget to mount the directories on Host PC and TC1! User Manual 281/374...
Create a source file that shall be compiled: Add following source snip: #include <stdio.h> int main (void) printf ("Hello World\r\n"); return 0; Now save the file and create an executable file. Therefor use the STW cross compiler. User Manual 282/374...
Page 283
8 Development Tools NOTE: Compiling in command line is possible after installing the DevKit (see "Install the Toolchain" on page 284) The first parameter is the source file, the second one is the output file. Copy the output file via USB stick or NFS (see "NFS" on page 315) to device. After executing the application, you should get the following output: User Manual 283/374...
NOTE: STW supports and recommends Ubuntu 14.04 LTS for developing. This operating system has been tested and is 100 % compatible with the TC1 development kit. All other linux based operating systems are neither recommended nor supported for TC1 development.
Page 285
8 Development Tools How to install the toolchain 1. Download the toolchain "powerpc-gcc-4.4.3-uclib.tar.gz" from STW FTP - 32-/64-Bit URL:ftp://stw-connectivity.net/ (see ftp://stw-connectivity.net/ - ftp://stw-connectivity.net/) TC1/DeploymentPackage_vX_XXrX/devkit_vX_XXrX/toolchain/linux/ (see example image below) Example: 2. Unzip the compressed toolchain "powerpc-gcc-4.4.3-uclib.tar.gz" - 32-/64-Bit 3. Configure shell to use the toolchain - 32-/64-Bit To use the toolchain under the shell, set the environmental variables.
Page 286
8.3.1.2 Install the Code::Blocks IDE Code::Blocks can be used to compile ready to go executables for the TC1. Especially for larger projects, Code::Blocks is recommended, since it provides a good overview over your software modules to be used. If you want to install Code::Blocks, go to the synaptic package manager of Linux Ubuntu.
Page 287
8 Development Tools 8.3.1.3 Setup the Code::Blocks IDE After Code::Blocks has been installed on your PC, it must be configured so that it can be used with the TC1. User Manual 287/374...
Page 288
8 Development Tools 1. Start Code::Blocks 2. In the main menu select "Settings | Compiler and Debugger..." 3. Select the compiler: "GNU GCC Compiler for PowerPC" 4. Navigate to the tab "Compiler settings | Other option": 5. Enter in the tab "Other options" the following lines: -O2 -Wall -Wno-parentheses -fno-strict-aliasing -DPF_CAN=29 -DAF_CAN=PF_CAN 6.
Page 289
8 Development Tools 7. Navigate to the tab "Toolchain executables" and enter in "Compilers's installation directory" the following line: /opt/powerpc-gcc-4.4.3-uclib/ User Manual 289/374...
Page 290
8 Development Tools 8. Navigate to the tab "Program Files" enter the following settings: C compiler: powerpc-stw-linux-uclibc-gcc C++ compiler: powerpc-stw-linux-uclibc-c++ Linker for dynamic libs: powerpc-stw-linux-uclibc-g++ Linker for static libs: powerpc-stw-linux-uclibc-ar Debugger: powerpc-stw-linux-uclibc-gdb Make program: make 9.
Page 291
8 Development Tools 8.3.1.4 Setup the Compiler for Debugging It is possible to use the GNU Debugger to debug applications under Linux. The description of the GNU Debugger (GDB) is in combination with Code::Blocks. No additional software is needed. How to prepare debugging Precondition: The toolchain and the IDE CodeBlocks is installed and set up User Manual 291/374...
Page 292
8 Development Tools 1. In case of a 64-bit operation system, you need to install 'lib32ncurses5'. For 32-bit operation systems this step can be skipped. To install the library via command line use: sudo apt-get install lib32ncurses5 2. Check the Code::Blocks Compiler Settings. The CodeBlocks "Compiler Settings"...
Page 293
8 Development Tools 3. Adapt the "Build Options" in order to build the binary with debug symbols: User Manual 293/374...
Page 294
4. In the main menu select "Project | Properties... | Debugger" and set up the remote connection settings: Serial port: stays empty Baud: 115200 IP address: the IP adresse of your TC1 Port: 9090 5. In the main menu select "Settings | Debugger..." and go to Default User Manual 294/374...
Page 295
8 Development Tools 6. Specify the GDB path to: /opt/powerpc-gcc-4.4.3-uclib/bin/powerpc-stw-linux-uclibc-gdb 7. Make the built binary accessible from the TC1: Use for example the NFS (see "NFS" on page 315), or if available use an USB drive. 8. Start the gdbserver on the TC1 (with your application e.g. ysignald): ...
8.3.2.1 Install the Toolchain This chapter provides a step by step tutorial to install the toolchain on a 32-/64-Bit Windows 7 System. 1. Download the toolchain installer from the STW FTP server: URL: ftp://stw-connectivity.net/ (see ftp://stw-connectivity.net/ - ftp://stw-connectivity.net/) ESX- TC1/DeploymentPackage_vX_XXrX/devkit_vX_XXrX/toolchain/windows/gcc_4_4_3/: 2.
Page 297
2. Execute the IDE installer (Setup.exe binary) and follow the instructions on the screen. 8.3.2.3 Setup the Code::Blocks IDE After Code::Blocks has been installed on your PC, it must be configured so that it can be used with the TC1. User Manual 297/374...
Page 298
8 Development Tools 1. Start Code::Blocks 2. In the main menu select "Settings | Compiler and Debugger..." 3. Select the compiler: "GNU GCC Compiler for PowerPC" 4. Navigate to the Tab "Toolchain executables" 5. Select the "Compiler's installation directory". Set the path depending where Code::Bloccks is installed. On a 64 bit system, Code::BLocks is installed in "Program Files (x86)"...
Page 299
9. Go to the tab "Compiler settings" | "Other options" and add the following line: For a 32 bit system: --sysroot=C:\Program Files\STW\PowerPC GCC\stw-linux-uclib_powerpc_add- ons\4_4_3\esx-tc3g_v1_00r0 For a 64 bit system: --sysroot=C:\Program Files (x86)\Stw\PowerPC GCC\stw-linux-uclib_powerpc_add- ons\4_4_3\esx-tc3g_v1_00r0 10. Go to the tab "Linker settings"...
Page 300
8 Development Tools 8.3.2.4 Setup the Compiler for Debugging Use the GNU Debugger to debug applications under Windows. The description of the GNU Debugger (GDB) is in combination with the Code::Blocks IDE. No additional software is needed. Precondition: The toolchain and the Code::Blocks IDE is installed and configured. User Manual 300/374...
Page 301
8 Development Tools How to prepare debugging 1. Check the Code::Blocks Compiler Settings. The CodeBlocks "Compiler Settings" have to look like this: User Manual 301/374...
Page 302
8 Development Tools 2. Adapt the "Build Options" in order to build the binary with debug symbols: User Manual 302/374...
Page 303
3. In the main menu select "Project | Properties... | Debugger" and set up the remote connection settings: Serial port: stays empty Baud: 115200 IP address: the IP adresse of your TC1 Port: 9090 4. In the main menu select "Settings | Debugger..." and go to Default User Manual 303/374...
Page 304
5. In "Executable path" specify the GDB path to : C:\Program Files (x86)\Stw\PowerPC GCC\4_4_3\powerpc- stw-linux-uclibc\linux-3.4.17_uclibc-0.9.33.2\bin\powerpc-stw-linux-uclibc-gdb.exe 6. Make the built binary accessible from the TC1: Use for example the NFS (see "NFS" on page 315), or if available use an USB drive.
8 Development Tools 9. Click "Debug | Start" the debugging: Continue with Create Own Application (see "Create Own Application" on page 277) 8.3.3 Examples The example folder DeploymentPackage v3_00r1/devkit v3_00r2/examples contains a basic Code::Blocks project. This example project describes how to use: ...
IOX library: This library provides higher level functions to interact with ESX-IOX modules. Non-STW devices COL2 library: This CANopen Layer 2 library can be used for communication with Non-STW CANopen devices J1939 The library provides an easy way to access j1939 nodes over CAN.
3. Follow the instructions on the screen. BSP Components The Board Support Packages (BSP) includes all components which are required for a bootable system. For each TC1 variant exists one specific BSP. These BSPs can be found on the STW FTP server. User Manual 307/374...
The universal bootloader starts the system. The CPU of the system can only execute program code that is located in the ROM (read only memory) or in the RAM (random access memory) of the TC1. The Linux operating system, the root file system and all user applications are stored in the NOR flash. The NOR flash is a nonvolatile data storage.
Page 309
;******************************************************************************* 1. Open the config.ttl with an editor of your choice. 2. Select the COM port for the Windows Updater, where the TC1 is connected to the PC: 3. Set the update source: a. Update via TFTP download: Set VarTftpDownload = 1 In case of an update via TFTP, the network settings of the config.ttl file needs to be completed (for...
3. When the script prompts to switch on the device, then do it. Linux Updater The Linux updater is a software tool to update the TC1 from a Linux OS. It can be found in the Deployment Package v1.00r1 or newer.
Page 311
How to use the Linux Updater The update procedure can be divided into the following steps: 1. Connect the TC1 via RS232 to the host PC from that the update has to be executed 2. Execute the start script tc1_updater_for_linux 3.
Page 312
9 Update the Device How to configure the Updater over the GUI: The update settings are stored in the configuration file config.ttl. 1. Execute the start script tc1_updater_for_linux 2. Over the GUI select the components that must be updated: How to configure the Updater file config.ttl without using the GUI: The configuration file config.ttl includes a section called "User Settings".
Page 313
WARNING: Do not use an U-Boot .bin file from an older BSP. Downgrading from U-Boot 2012.10 to U-Boot 2008.10 will destroy the U-Boot. After that, the controller has to be sent back to STW for reprogramming. 1. Set the file permissions of the start script tc1_updater_for_linux of the updater to "executable":...
Setting up the Serial Interface Terminal program for the serial interface Use a serial straight-through cable to connect the TC1 with your PC. Depending on the used operating system on the used PC for development, a RS232 terminal must be installed.
Start tftpd through xinetd $ sudo /etc/init.d/xinetd restart 10.1.3 The root-file system of the TC1 as well as data transfer of your own application program, will be performed by using NFS. Host Computer Install NFS: $ sudo apt-get install portmap nfs-kernel-server...
Page 316
"/mnt/com_nfs/" on the TC1 device. 192.168.10.101 is the IP address of the host computer. Copy files onto TC1 Put the file that shall be copied to the TC1 (for example "test.txt" , to the folder: /home/<user>/com_nfs Type in the command:...
Telnet is another way of communicating with your TC1. However, Telnet uses the Ethernet instead of RS232. Once the TC1 has been setup and is running, you don't need the RS232 terminal anymore to just log in to the TC1 or to apply changes. You can simply use TELNET (Telnet is supported by Linux, Macintosh, even...
This output is designed to provide power to an attached device, e.g. an external GPS receiver with up to 400 mA at DC 12 V. It is equipped with an internal 10 kOhm pull down resistor. To prevent damage to the TC1, an external fuse must be applied to make sure the current does not exceed 400 mA.
# GSM Settings export GSM_BAUDRATE="460800" export GSM_PIN="1234" export GSM_SCA="0012063140005" export GSM_APN="epc.tmobile.com" GSM Manual control: The GSM service of the TC1 built in GSM/GPRS Modem can be manually controlled via the following scripts: ppp-start ppp-stop These scripts reside in: /etc/ppp/ 10.1.6.1...
10 Application Notes 10.1.7 CAN-Termination According to the CAN specification, every end of a CAN bus trunk-line must be terminated with a 120 Ohm Resistor. Example of a terminated CAN bus: CAN-Bus length (Trunk-line length) The CAN bus length (Trunk-line length) is limited and depends on the Baud-rate, the CAN bus is operated with. The following table shall give an overview of maximum CAN bus length according to the used Baud rate.
10.1.8 Bluetooth M2M The file describes how to easily create a connection between a master TC1 module to a slave TC1 module. Precondition: Both modules must have a up and discoverable Bluetooth device. How to check if the Bluetooth interface is up:...
Page 322
10 Application Notes The bdaddr of the TC1-141231231003 is 00:07:80:57:BF:A6. This bdaddr is used in this example, to establish a connection via Bluetooth. Use the rfcomm command to establish a serial port connection via Bluetooth. The first parameter is "bind". With the parameter bind, the rfcomm command binds the chosen RFCOMM device to a remote Bluetooth device.
Page 323
Smartphone_xyz In this example the the module TC1-141231231003 was found and is used to send or receive files via ftp. Check, if it is possible to send or receive files via ftp. Use the command sdptool to perform the check.
Page 324
10 Application Notes In the output of the inquiry the channel number 10 is received. This channel number is used for sending or receiving files between the devices. For sending a file use the obexftp command. The first parameter specifies the Bluetooth address of the remote device and the second parameter specifies the Bluetooth channel.
10.1.9 E-Mail The TC1 is equipped with an e-mail client. The name of the client is 'mailx'. With that client it is possible to send an e-mail from the TC1. The account settings have to be added to a configuration file.
11 Utilities Tools Utilities Tools Description This chapter provides an overview, including a short description, about the utilities of STW available on the TC1. 11.1 stw_dptool NAME stw_dptool - tool shows the content of the datapool SYNOPSIS stw_dptool [-h] [-v] [-m] [-a] [-x] [-z] [-d <dp_name>...
11 Utilities Tools 11.2 stw_GetGPS NAME stw_GetGPS - cmd line tool to fetch GPS data SYNOPSIS stw_GetGPS [-hvmja] DESCRIPTION This application asks the GPS data structure via dbus from the ygpsd. Structure T_DBUS_GPS_Data typedef struct charn acn_status[32]; // NONE = fix not available, // NMEA = receiving valid nmea string from gps receiver charn acn_latitude[32];...
Page 330
11 Utilities Tools OPTIONS -v, --version Version number of the application. -h, --help Usage and options (help). -m, --man Print the manpage. -d, --debug Print debug messages. -b, --big Set byte order to big endian Default: little endian -c, --can CAN bus to use Default value: can0...
11 Utilities Tools 11.5 stw_show_gps Description The application stw_show_gps parses NMEA0183 strings from a port of the device. The tool will work only, if the GPS daemon ygpsd is not running. Usage # stw_show_gps Usage: show_gps <dev_file> [-lat] [-lon] [-alt] [-tim] [-sat] [-qua] [-war] [-spe] [-cou] [-dat] [-sta] [-all] [-p] Example # stw_show_gps /proc/stw_gps/port -all...
11 Utilities Tools 11.6 stw_flash_client Description This application supports the functionality of the STW Kefex Tool WinFlash. Example # stw_flash_client -h Usage: flash_client <options> <ini_file> <ini_file_section> --help Displays this usage information --wakeup Triggers a wakeup on specified node e.g. flash_client -w -i can0 WinFlash.ini CONFIG1...
11 Utilities Tools 11.7 stw_SendSMS NAME stw_SendSMS - Sends a SMS via the TAF and the internal modem. SYNOPSIS stw_SendSMS <PhoneNo> <Text> [-h] [-v] [-m] DESCRIPTION This application allows you to send a text message right away. This is done via DBUS and the ysmsd.
Open a TCP client socket and connect to the server specified by DESTINATION. The format of DESTINATION is <Ip:Port>, (e.g. 172.20.230.131:30000). Format of the CAN messages is the STW TCP-DLL format. --tcp-listen PORT Open a listening TCP socket on port number PORT and wait for a incoming connection.
- STW KEFEX console client Description The kefex_client is a command line tool for the STW KEFEX toolchain. It can handle KEFEX project files and communicate with a ECU via the STW KEFEX protocol. It implements the client side of the KEFEX communication protocol, e.g.
Page 336
11 Utilities Tools --eeprom Specify if the invoked command shall deal with all variable lists or EEPROM lists only. If specified, only EEPROM lists are considered. Read or write commands will access the EEPROM values directly. If omitted, all lists are considered. Read or write commands will access the RAM values (RAM mirrors for EEPROM lists).
Page 337
11 Utilities Tools --dp_remove Remove a TAF data pool.Only a data pool that has previously been created by command --dp_create can be removed. The TAF data pool to be removed is identified by the name of the KEFEX project specified by config option -p.
x86 Windows-PC (experimental) x86 Linux-PC (e.g. Ubuntu) (experimental) PowerPC embedded Linux (EB07, TC3, TC1) ARM-Cortex embedded Linux (TC4P (i.MX6)) (experimental) 11.11 Lighttpd Webserver Lighttpd is a light weight http server adequate to run on an embedded system.
This product contains Free Software or Open Source Software. For license details see the components below. To obtain a copy of the source code of all Free Software or Open Source Software components please contact STW: Sensor-Technik Wiedemann GmbH Am Bärenwald 6...
Page 341
12 Open Source Licenses To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have.
Page 342
12 Open Source Licenses stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License.
Page 343
12 Open Source Licenses itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code.
Page 344
12 Open Source Licenses may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9.
12 Open Source Licenses This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program;...
Page 346
12 Open Source Licenses source code) is copyrighted by me and others who actually wrote it. -- Wolfgang Denk ======================================================================= GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
Page 347
12 Open Source Licenses under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language.
Page 348
12 Open Source Licenses the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange;...
Page 349
12 Open Source Licenses otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all.
12 Open Source Licenses REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY...
Page 351
12 Open Source Licenses distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations.
Page 352
12 Open Source Licenses these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole.
Page 353
12 Open Source Licenses this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works.
Page 354
12 Open Source Licenses either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation.
12 Open Source Licenses If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions;...
Page 356
12 Open Source Licenses for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things.
Page 357
12 Open Source Licenses programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system.
Page 358
12 Open Source Licenses a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License.
Page 359
12 Open Source Licenses If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code.
Page 360
12 Open Source Licenses will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution.
Page 361
12 Open Source Licenses restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not...
Page 362
12 Open Source Licenses WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
Safety of machinery - Electrical Compliance with air and creeping equipment of machines - distances Part 1: General requirements (Covered by software "Integra") STW Company Supply voltage Operation at minimum and maximum Standard supply voltage (9-32) V Duration: 60 minutes...
Page 364
13 Qualification Tests Standard Test description Parameter Short circuit test of PWM outputs and digital outputs to low resistance loads against GND. STW Company Polarity protection Interchanged battery terminals Standard STW Company Current consumption Current consumption without D+ (9 V...
Page 365
13 Qualification Tests Standard Test description Parameter ISO 16750-2 Slow decrease and increase of supply Decrease the supply voltage from the voltage minimum supply voltage to 0 V, then increase it from 0 V to minimum supply voltage applying a change rate of (0.5 ± 0.1) V/min linear, or in equal steps of not more than 25 mV.
13 Qualification Tests Standard Test description Parameter (50/60 Hz) for a duration of 60 seconds. ISO 16750-2 Insulation resistance Perform a "damp heat cyclic" test in accordance with ISO 16750-4, then apply 500 V d.c. (50/60 Hz) for a duration of 60 seconds. 13.3 Electromagnetic Compatibility e1/E1 Standard...
13 Qualification Tests Standard Test decription Parameter portable radio and ancillary equipment of digital cellular radio ETSI EN 301489 - 17 ElectroMagnetic Compatibility (EMC) Bluetooth & WLAN standard for radio equipment and services; Part 17: Specific conditions for Broadband Data Transmission Systems 13.6 Environmental Influences Standard...
Page 369
13 Qualification Tests Standard Test description Parameter ISO 16750-4 Temperature cycling test - 100 cycles, from -40 °C to +70 °C transfer time ≤ 30 seconds IEC 60068-2-14, Test rapid change of temperature dwell time: 60 minutes ISO 16750-4 Salt spray tests - corrosion test Severity level 5 IEC 60068-2-52, Test ISO 16750-4...
Need help?
Do you have a question about the TC1 and is the answer not in the manual?
Questions and answers