ESP32 Arduino: Guru Meditation Error: Core 1 panic'ed (StoreProhibited) - dynamic

Sending data from (mesh network)smoke sensors to AWS. I am storing the node data using linked list.After passing data to AWS,i am try to de-allocate the memory and coming across following two errors in free().
#include <stdio.h>
#include<stdlib.h>
typedef struct Node
{
uint8_t node_data[15]; //stores node infomation
struct Node* next; //pointer to next node
}node;
node *head=NULL;
node*current=NULL;
static uint8_t k[15]; //this array keeps track of data received on UART port
static uint8_t node_count=0; //keeps the track of no. of nodes added to the system
void push_data(int []); /*this function pushes data present in array into
a node(memory allocated to node dynamically)*/
void delete_node(node*); //this function deletes the memory allocated to node
void pack_data(void); // send node data to aws
void loop()
{
if(Serial2.available()>0)
{
for( uint8_t i=0;i<15;i++)
{
k [i]= Serial2.read();
}
push_data(k);
}
delay(5000);
}
void push_data(uint8_t arr[])
{
if(head==NULL)
{
head=(node*)malloc(sizeof(node));
current=(node*)malloc(sizeof(node));
for(uint8_t i=0;i<15;i++)
{
head->node_data[i]=arr[i];
}
head->next=current;
node_count++;
return;
}
else
{
for(uint8_t i=0;i<15;i++)
{
current->node_data[i]=arr[i];
}
current->next=(struct Node*)malloc(sizeof(struct Node));
current=current->next;
current->next=NULL;
node_count++;
pack_data();
return;
}
}
void pack_data()
{
/*this function converts node data into data format
* and sends the data to aws.*/
/* Once the data is send to aws ,
the memory allocated to nodes is freed
*/
delete_node(head);
return;
}
void delete_node(node* n)
{
node* m=NULL;
while(n!=NULL)
{
m=n->next;
free(n);
n=NULL;
n = m;
}
// return;
}
Whenever is am trying to free the dynamically allocated memory,the delete_node function causes problem.Throwing the following errors
ERROR 1
assert failed: multi_heap_realloc multi_heap_poisoning.c:289 (head != NULL)
ERROR 2
Guru Meditation Error: Core 1 panic'ed (LoadStoreError). Exception was unhandled.
Core 1 register dump:
PC : 0x400f3fc4 PS : 0x00060330 A0 : 0x800efca4 A1 : 0x3ffb1920
A2 : 0x00000000 A3 : 0x3ffcc800 A4 : 0x00000005 A5 : 0x00000000
A6 : 0x00000005 A7 : 0x40000014 A8 : 0x800f3ff4 A9 : 0x3ffb1910
A10 : 0x3ffcc800 A11 : 0x88000028 A12 : 0x00000000 A13 : 0x3ffcc800
A14 : 0x00000008 A15 : 0x00000000 SAR : 0x00000004 EXCCAUSE: 0x00000003
EXCVADDR: 0x4000001e LBEG : 0x40088f8c LEND : 0x40088fa2 LCOUNT : 0xffffffff

Related

Guru Meditation Error: Core 0 panic'ed (LoadProhibited),(Interrupt wdt timeout on CPU1)

I was trying to record light intensity values for a Li-Fi project.
This is my code:
#include <soc/sens_reg.h>
#include <soc/sens_struct.h>
#include <driver/adc.h>
#include <SD.h>
#define ADC1_GPIO36_CHANNEL ADC1_CHANNEL_0
#include <adc_channel.h>
const char filename1[] = "/part1.dat";
const char filename2[] = "/part2.dat";
File file1, file2;
int local_adc1_read(int channel) {
uint16_t adc_value;
SENS.sar_meas_start1.sar1_en_pad = (1 << channel); // Only one channel is selected
while (SENS.sar_slave_addr1.meas_status != 0)
;
SENS.sar_meas_start1.meas1_start_sar = 0;
SENS.sar_meas_start1.meas1_start_sar = 1;
while (SENS.sar_meas_start1.meas1_done_sar == 0)
;
adc_value = SENS.sar_meas_start1.meas1_data_sar;
return adc_value;
}
#define ADC_SAMPLES_COUNT 1000
int16_t abuf[ADC_SAMPLES_COUNT];
int16_t abufPos = 0;
portMUX_TYPE DRAM_ATTR timerMux = portMUX_INITIALIZER_UNLOCKED;
TaskHandle_t complexHandlerTask;
hw_timer_t * adcTimer = NULL; // Our timer
void complexHandler(void *param) {
timerAlarmDisable(adcTimer);
timerDetachInterrupt(adcTimer);
timerEnd(adcTimer);
adcTimer = NULL;
file1 = SD.open(filename1, FILE_WRITE);
file2 = SD.open(filename2, FILE_WRITE);
file1.write((const byte*)abuf, abufPos);
file2.write((const byte*)abuf, abufPos);
file1.close();
file2.close();
}
int counter;
void IRAM_ATTR onTimer() {
portENTER_CRITICAL_ISR(&timerMux);
abuf[abufPos++] = local_adc1_read(ADC1_CHANNEL_0);
//abuf[abufPos++] = adc1_get_raw(ADC1_CHANNEL_0);
if (abufPos >= 8) {
if (abuf[abufPos-7] ==
abuf[abufPos-6] ==
abuf[abufPos-5] ==
abuf[abufPos-4] ==
abuf[abufPos-3] ==
abuf[abufPos-2] ==
abuf[abufPos-1] ==
abuf[abufPos])
{
// Notify adcTask that the buffer is full.
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
vTaskNotifyGiveFromISR(complexHandlerTask, &xHigherPriorityTaskWoken);
if (xHigherPriorityTaskWoken) {
portYIELD_FROM_ISR();
}
}
portEXIT_CRITICAL_ISR(&timerMux);
}
}
void setup() {
setCpuFrequencyMhz(240);
xTaskCreate(complexHandler, "Handler Task", 8192, NULL, 1, &complexHandlerTask);
adcTimer = timerBegin(3, 80, true); // 80 MHz / 80 = 1 MHz hardware clock for easy figuring
timerAttachInterrupt(adcTimer, &onTimer, true); // Attaches the handler function to the timer
timerAlarmWrite(adcTimer, 100, true); // Interrupts when counter == 45, i.e. 22.222 times a second
timerAlarmEnable(adcTimer);
Serial.begin(115200);
pinMode(2, OUTPUT);
//pinMode(36, INPUT);
if (!SD.begin())
Serial.println("SD begin failed");
while(!SD.begin()) {
Serial.print(".");
//delay(500);
SD.remove(filename1);
SD.remove(filename2);
}
}
void loop() {
}
I got this error:
Guru Meditation Error: Core 0 panic'ed (LoadProhibited). Exception was unhandled.
rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:1100
load:0x40078000,len:10900
load:0x40080400,len:6388
entry 0x400806b4
Guru Meditation Error: Core 0 panic'ed (LoadProhibited). Exception was unhandled.
Core 0 register dump:
PC : 0x400f095f PS : 0x00060030 A0 : 0x800d1019 A1 : 0x3ffb3f80
A2 : 0x00000000 A3 : 0x3ffb2080 A4 : 0x00000020 A5 : 0x80000020
A6 : 0x00000000 A7 : 0x00000000 A8 : 0x00000005 A9 : 0x00000020
A10 : 0x00000020 A11 : 0x3ffbc0d0 A12 : 0x80087259 A13 : 0x3ffbc0d0
A14 : 0x00000000 A15 : 0x00000000 SAR : 0x00000000 EXCCAUSE: 0x0000001c
EXCVADDR: 0x00000000 LBEG : 0x00000000 LEND : 0x00000000 LCOUNT : 0x00000000
ELF file SHA256: 0000000000000000
Backtrace: 0x400f095f:0x3ffb3f80 0x400d1016:0x3ffb3fa0 0x40088269:0x3ffb3fe0
I tried decreasing the interrupt frequency, using a huge app (3 MB), increasing the CPU clock to 240 Hz, but nothing changed.
By outcommenting
vTaskNotifyGiveFromISR(complexHandlerTask, &xHigherPriorityTaskWoken);
and
xTaskCreate(complexHandler, "Handler Task", 8192, NULL, 1, &complexHandlerTask);
now the error is
Guru Meditation Error: Core 1 panic'ed (Interrupt wdt timeout on CPU1)
And some register dumps of core 1 and core 0. There isn't any change doing something in the loop.

I got 14:29 when running this code. Trying to use Ardouino circuits

int switchmode=0;
void setup()
{
pinMode(3, INPUT);
pinMode(7, OUTPUT);
pinMode(9, OUTPUT);
}
void loop()
{
switchmode = digitalRead(3;
digitalWrite(7,switchmode);
if(switchmode== HIGH){
digitalWrite(9,HIGH);
delay(1000);
digitalWrite(9,LOW);
delay(1000);
}
I'm running this code on a virtual electric circuit on Tinkercad.com
This is sthe error that I get
** In function 'void loop()':
14:29: error: expected ')' before ';' token
exit status 1**
I think you miss this bracket here:
// ↓
switchmode = digitalRead(3;
// The correct is:
switchmode = digitalRead(3);

When connect to an OBD device, setCharacteristicNotification and writeCharacteristic, onCharacteristicChanges received 3E 00 00 3F notification

When connected to an OBD device, setCharacteristicNotification and writeCharacteristic. Notification was received onCharacteristicChanged.
But the notification showed 3E 00 00 3F, same conditions for many write requests. It is expected to return the information about the device.
The codes are as following:
public void writeCharacteristic(String commnd, BluetoothGattCharacteristic characteristic, boolean enabled) {
int commandLength = commnd.length(); // length of the string used for the loop
byte[] bytes = new byte[commnd.length()];
for(int i = 0; i < commandLength ; i++){ // while counting characters if less than the length add one
char character = commnd.charAt(i); // start on the first character
int ascii = (int) character; //convert the first character
bytes[i] = (byte) Integer.parseInt(String.valueOf(ascii));
Log.w(TAG, "byte index:"+i+", ascii:"+ascii+", bytes i:"+bytes[i]);
}
characteristic.setWriteType(BluetoothGattCharacteristic.WRITE_TYPE_NO_RESPONSE);
characteristic.setValue(bytes);//ch);//messageBytes);
boolean success = mBluetoothGatt.writeCharacteristic(characteristic);
Log.w("Gatt", "write result:"+success);
Log.w(TAG, "set characteric notification, enabled?"+enabled);
setCharacteristicNotificationWithDescriptor(characteristic, true);
}
protected static final UUID CHARACTERISTIC_UPDATE_NOTIFICATION_DESCRIPTOR_UUID = UUID.fromString("00002902-0000-1000-8000-00805f9b34fb");
public boolean setCharacteristicNotificationWithDescriptor(BluetoothGattCharacteristic characteristic, boolean enable) {
Log.w(TAG, "setCharacteristicNotification(UUID=" + characteristic.getUuid().toString() + ", enable=" + enable + " )");
mBluetoothGatt.setCharacteristicNotification(characteristic, enable);
Log.w(TAG, "descriptor:"+CHARACTERISTIC_UPDATE_NOTIFICATION_DESCRIPTOR_UUID);
BluetoothGattDescriptor descriptor = characteristic.getDescriptor(CHARACTERISTIC_UPDATE_NOTIFICATION_DESCRIPTOR_UUID);
descriptor.setValue(enable ? BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE : new byte[] { 0x00, 0x00 });
Log.w(TAG, "notification value:"+BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE+", false:"+new byte[] { 0x00, 0x00 }.toString());
boolean status = mBluetoothGatt.writeDescriptor(descriptor); //descriptor write operation successfully started?
Log.w(TAG, "write descriptor:"+status);
return status;
}
Not sure how to get the correct response? I sent the AT command with 0D. Thank you.

Sensor reading communication via bluetooth

I have two bluetooth modules(HC05) connected to separate arduinos. One acting as master and other as slave. One LDR is connected to the slave part which will be taking continuous readings and sending it to master via bluetooth.
The modules are successfully paired.I could even control an led connected to master using a pushbutton connected to slave.
Since 4 days I am struggling to get the readings of LDR on the serial monitor of master.
The slave part of the project(having the LDR):
#include <SoftwareSerial.h>
SoftwareSerial BTSerial(10, 11); // RX | TX
#define ldrPin A0
int ldrValue = 0;
void setup() {
pinMode(9, OUTPUT); // this pin will pull the HC-05 pin 34 (key pin) HIGH to switch module to AT mode
digitalWrite(9, HIGH);
pinMode(ldrPin, INPUT);
BTSerial.begin(9600);
Serial.begin(9600);
}
void loop()
{
ldrValue = analogRead(ldrPin);
BTSerial.println(ldrValue);
Serial.println(ldrValue);
delay(1000);
}
The master part of the project which will be getting the reaings and displaying on serial monitor:
#include <SoftwareSerial.h>
SoftwareSerial BTSerial(10, 11); // RX | TX
const byte numChars = 1024;
char receivedChars[numChars]; // an array to store the received data
boolean newData = false;
void setup() {
pinMode(9, OUTPUT); // this pin will pull the HC-05 pin 34 (key pin) HIGH to switch module to AT mode
digitalWrite(9, HIGH);
BTSerial.begin(9600);
Serial.begin(9600);
Serial.println("<Arduino is ready>");
}
void loop() {
recvWithEndMarker();
showNewData();
}
void recvWithEndMarker() {
static byte ndx = 0;
char endMarker = '\n';
char rc;
while (BTSerial.available() > 0 && newData == false) {
rc = BTSerial.read();
if (rc != endMarker) {
receivedChars[ndx] = rc;
ndx++;
if (ndx >= numChars) {
ndx = numChars - 1;
}
}
else {
receivedChars[ndx] = '\0'; // terminate the string
ndx = 0;
newData = true;
}
}
}
void showNewData() {
if (newData == true) {
Serial.print("This just in ... ");
Serial.println(receivedChars);
newData = false;
}
}
But the problem is that in the serial monitor only the highest digit ( 3 in 392) is displayed in the serial monitor. The readings are correct but the complete readings are not displayed.
The serial monitor showed something like this:
<Arduino is ready>
This just in ... 1
This just in ... 1
This just in ... 1
This just in ... 1
This just in ... 1
This just in ... 3
This just in ... 3
This just in ... 3
This just in ... 3
This just in ... 3
Ifin the Slave part instead of LDR readings if I am sending a string "hello", then it is printing as :
<Arduino is ready>
This just in ... h
This just in ... h
This just in ... h
This just in ... h
This just in ... h
This just in ... h
I have referred this link for serial communications Serial input basics
Can someone please help me out as I am new to arduino.
To read a string directly into a variable you can use:
BTSerial.readString()
instead of:
BTSerial.read()
like in the official documentation

TK06a GPS Tracker Protocol : Long/Lat Format

I have a GPS tracker with TK06a Chipset, and I have my own tcp listener, everything is working fine, I have received the data from the device with this format :
#355488020131775##1#0000#AUT#01#52500100232a47#10341.175280,E,121.322800,N,0.28,0.00#111113#171607.000##
I think i figured out what are these, (for example the first one is the IMEI), but I didn't know how to convert (10341.175280,E) and (121.322800,N) to something that google maps can understand.
beside the device has a poor user manual and no documentation for the protocol.
the real location should be in here (1.355269,103.686426) maybe this can lead you to solve this mystery :)
Thanks in advance.
Edit:
I Found this on the web, maybe some will find it useful :
The decode of the line above.
the IMEI number cannot be empty, if the SIM card number regarded as device series number, then the data of IMEI part should be filled in
SIM cad number.
SIM card number: this part can be empty , or also can be same as 1st point , fill in SIM card number.
0 or 1 , reserve (original meaning is ACC status )
Device password ( 0-9 numbers, digit cannot over 6 digits, generally is in 4 digits )
Reserved word AUT, cannot be changed .
Numbers of data, 00-99 , in 2 digits.
The format of Each data as below:
#base station number#Longitude, East and West identification, latitude,North and South identification,speed(nm), direction angle(0-360)#date#time
Base station number can be empty.
Longitude, format : dddff.ffff, the degree part must be in 3 integer, the minute part must be in 2 integer, the decimal part is in
4 digits, there is no separator between degree and minute.
East and West identification, only one character , E/W.
Latitude, format : ddff.ffff, same as Longitude , only the degree part is in 2 integer.
North and South identification, only one character , N/S.
Speed: can be 0.
Direction : can be 0.
Date, format : ddmmyy.
Time, format: hhnnss.mmm, the part before decimal point should be hour, minute and second in turn, each is in 2 digits, the part after
decimal point should be milliseconds, it can be 000.
This format is DM like in NMEA RMC message, but with a missing leading 0:
given longitude: 10341.175280 E
The first 3 digits are degrees: 103
Then the rest is minutes: 41.175280
This now is fomrat "DM" Degrees and decimal minutes.
Google uses "DEG" (Decimal degrees)
convert: 103 + 41.175280 / 60.0 = 103.686254
(DEG = degrees + minutes / 60.0)
wich fits perfectly to your location
Now it is a bit strange:
It should read "0121.322800" not "121.322800"
But then similar to above but since latitude is limited to two digits:
The first 2 digits are always degrees: 01
Then the rest is minutes: 21.322800
same formala as above: lat= 1 + 21.322800 / 60.0 = 1,35538
finally: if W or S, multiply the deg value with -1
(In your case it is N and E, so it stays as it is - positive)
This format looks partly like the NMEA RMC sentence
I think you want to make this work with OpenGTS.
So here what i done to work:(Note i dont need the tk10x devices so i overwrited the files, you can create another class if you want)
go to $GTS_HOME/src/org/opengts/servers/tk10x
and change the TrackServer.java with this code
I writed a new parseInsertFunction
package org.opengts.servers.tk10x;
import java.lang.*;
import java.util.*;
import java.io.*;
import java.net.*;
import java.sql.*;
import org.opengts.util.*;
import org.opengts.db.*;
import org.opengts.db.tables.*;
public class TrackServer
{
// ------------------------------------------------------------------------
// initialize runtime configuration
public static void configInit()
{
DCServerConfig dcs = Main.getServerConfig();
if (dcs != null) {
TrackServer.setTcpIdleTimeout( dcs.getTcpIdleTimeoutMS( Constants.TIMEOUT_TCP_IDLE ));
TrackServer.setTcpPacketTimeout( dcs.getTcpPacketTimeoutMS( Constants.TIMEOUT_TCP_PACKET ));
TrackServer.setTcpSessionTimeout(dcs.getTcpSessionTimeoutMS(Constants.TIMEOUT_TCP_SESSION));
TrackServer.setUdpIdleTimeout( dcs.getUdpIdleTimeoutMS( Constants.TIMEOUT_UDP_IDLE ));
TrackServer.setUdpPacketTimeout( dcs.getUdpPacketTimeoutMS( Constants.TIMEOUT_UDP_PACKET ));
TrackServer.setUdpSessionTimeout(dcs.getUdpSessionTimeoutMS(Constants.TIMEOUT_UDP_SESSION));
}
}
// ------------------------------------------------------------------------
// Start TrackServer (TrackServer is a singleton)
private static TrackServer trackServerInstance = null;
/* start TrackServer on array of ports */
public static TrackServer startTrackServer(int tcpPorts[], int udpPorts[], int commandPort)
throws Throwable
{
if (trackServerInstance == null) {
trackServerInstance = new TrackServer(tcpPorts, udpPorts, commandPort);
} else {
//Print.logError("TrackServer already initialized!");
}
return trackServerInstance;
}
public static TrackServer getTrackServer()
{
return trackServerInstance;
}
// ------------------------------------------------------------------------
// TCP Session timeouts
/* idle timeout */
private static long tcpTimeout_idle = Constants.TIMEOUT_TCP_IDLE;
public static void setTcpIdleTimeout(long timeout)
{
TrackServer.tcpTimeout_idle = timeout;
}
public static long getTcpIdleTimeout()
{
return TrackServer.tcpTimeout_idle;
}
/* inter-packet timeout */
private static long tcpTimeout_packet = Constants.TIMEOUT_TCP_PACKET;
public static void setTcpPacketTimeout(long timeout)
{
TrackServer.tcpTimeout_packet = timeout;
}
public static long getTcpPacketTimeout()
{
return TrackServer.tcpTimeout_packet;
}
/* total session timeout */
private static long tcpTimeout_session = Constants.TIMEOUT_TCP_SESSION;
public static void setTcpSessionTimeout(long timeout)
{
TrackServer.tcpTimeout_session = timeout;
}
public static long getTcpSessionTimeout()
{
return TrackServer.tcpTimeout_session;
}
// ------------------------------------------------------------------------
// UDP Session timeouts
/* idle timeout */
private static long udpTimeout_idle = Constants.TIMEOUT_UDP_IDLE;
public static void setUdpIdleTimeout(long timeout)
{
TrackServer.udpTimeout_idle = timeout;
}
public static long getUdpIdleTimeout()
{
return TrackServer.udpTimeout_idle;
}
/* inter-packet timeout */
private static long udpTimeout_packet = Constants.TIMEOUT_UDP_PACKET;
public static void setUdpPacketTimeout(long timeout)
{
TrackServer.udpTimeout_packet = timeout;
}
public static long getUdpPacketTimeout()
{
return TrackServer.udpTimeout_packet;
}
/* total session timeout */
private static long udpTimeout_session = Constants.TIMEOUT_UDP_SESSION;
public static void setUdpSessionTimeout(long timeout)
{
TrackServer.udpTimeout_session = timeout;
}
public static long getUdpSessionTimeout()
{
return TrackServer.udpTimeout_session;
}
// ------------------------------------------------------------------------
// ------------------------------------------------------------------------
// TCP port listener threads
private java.util.List<ServerSocketThread> tcpThread = new Vector<ServerSocketThread>();
// UDP port listener threads
private java.util.List<ServerSocketThread> udpThread = new Vector<ServerSocketThread>();
// Command port listener thread
private ServerSocketThread cmdThread = null;
private DatagramSocket udpSocket = null;
// ------------------------------------------------------------------------
/* private constructor */
private TrackServer(int tcpPorts[], int udpPorts[], int commandPort)
throws Throwable
{
int listeners = 0;
// Start TCP listeners
if (!ListTools.isEmpty(tcpPorts)) {
for (int i = 0; i < tcpPorts.length; i++) {
int port = tcpPorts[i];
if (ServerSocketThread.isValidPort(port)) {
try {
this._startTCP(port);
listeners++;
} catch (java.net.BindException be) {
Print.logError("TCP: Error binding to port: %d", port);
}
} else {
throw new Exception("TCP: Invalid port number: " + port);
}
}
}
// Start UDP listeners
if (!ListTools.isEmpty(udpPorts)) {
for (int i = 0; i < udpPorts.length; i++) {
int port = udpPorts[i];
if (ServerSocketThread.isValidPort(port)) {
try {
ServerSocketThread sst = this._startUDP(port);
if (this.udpSocket == null) {
this.udpSocket = sst.getDatagramSocket();
}
listeners++;
} catch (java.net.BindException be) {
Print.logError("UDP: Error binding to port: %d", port);
}
} else {
throw new Exception("UDP: Invalid port number: " + port);
}
}
}
/* do we have any active listeners? */
if (listeners <= 0) {
Print.logWarn("No active device communication listeners!");
}
}
// ------------------------------------------------------------------------
/* start TCP listener */
private void _startTCP(int port)
throws Throwable
{
ServerSocketThread sst = null;
/* create server socket */
try {
sst = new ServerSocketThread(port);
} catch (Throwable t) { // trap any server exception
Print.logException("ServerSocket error", t);
throw t;
}
/* initialize */
sst.setTextPackets(Constants.ASCII_PACKETS);
sst.setBackspaceChar(null); // no backspaces allowed
sst.setLineTerminatorChar(Constants.ASCII_LINE_TERMINATOR);
sst.setIgnoreChar(Constants.ASCII_IGNORE_CHARS);
sst.setMaximumPacketLength(Constants.MAX_PACKET_LENGTH);
sst.setMinimumPacketLength(Constants.MIN_PACKET_LENGTH);
sst.setIdleTimeout(TrackServer.tcpTimeout_idle); // time between packets
sst.setPacketTimeout(TrackServer.tcpTimeout_packet); // time from start of packet to packet completion
sst.setSessionTimeout(TrackServer.tcpTimeout_session); // time for entire session
sst.setTerminateOnTimeout(Constants.TERMINATE_ON_TIMEOUT);
sst.setClientPacketHandlerClass(TrackClientPacketHandler.class);
sst.setLingerTimeoutSec(Constants.LINGER_ON_CLOSE_SEC);
/* start thread */
Print.logInfo("Starting TCP listener thread on port " + port + " [timeout=" + sst.getSessionTimeout() + "ms] ...");
sst.start();
this.tcpThread.add(sst);
}
// ------------------------------------------------------------------------
/* start UDP listener */
private ServerSocketThread _startUDP(int port)
throws Throwable
{
ServerSocketThread sst = null;
/* create server socket */
try {
sst = new ServerSocketThread(ServerSocketThread.createDatagramSocket(port));
} catch (Throwable t) { // trap any server exception
Print.logException("ServerSocket error", t);
throw t;
}
/* initialize */
sst.setTextPackets(Constants.ASCII_PACKETS);
sst.setBackspaceChar(null); // no backspaces allowed
sst.setLineTerminatorChar(Constants.ASCII_LINE_TERMINATOR);
sst.setIgnoreChar(Constants.ASCII_IGNORE_CHARS);
sst.setMaximumPacketLength(Constants.MAX_PACKET_LENGTH);
sst.setMinimumPacketLength(Constants.MIN_PACKET_LENGTH);
sst.setIdleTimeout(TrackServer.udpTimeout_idle);
sst.setPacketTimeout(TrackServer.udpTimeout_packet);
sst.setSessionTimeout(TrackServer.udpTimeout_session);
sst.setTerminateOnTimeout(Constants.TERMINATE_ON_TIMEOUT);
sst.setClientPacketHandlerClass(TrackClientPacketHandler.class);
/* start thread */
Print.logInfo("Starting UDP listener thread on port " + port + " [timeout=" + sst.getSessionTimeout() + "ms] ...");
sst.start();
this.udpThread.add(sst);
return sst;
}
public DatagramSocket getUdpDatagramSocket()
{
return this.udpSocket;
}
// ------------------------------------------------------------------------
}`
and in Constant.java find 'ASCII_LINE_TERMINATOR[] ' constant declaration and add '000' to with
public static final int ASCII_LINE_TERMINATOR[] = new int[] {
// this list has been construction by observation of various data packets
0x00, 0xFF, 0xCE, '\0', '\n', '\r', ')', ';',000
};
after this
cd $GTS_HOME
ant tk10x
bin/runserver.sh -s tk10x
This should do the trick
And here is a link to the package i created
https://anonfiles.com/file/0aae22ccb3822618fb693cd667283b18