1

EXPLODE Function for text params

(21/02/2018 03:43:52 отредактировано techdev)

Тема: EXPLODE Function for text params

Description of the issue

Currently most RS232 messages appear in raw data as a text param, let's call it text_param as example,
some external device connected to the gps serial port can send multiple values using a separator, just for name a few (,.<>|&- = or any custom character or more than one character ##)
This kind of data must be parsed in order to be used, otherwise is just a text with no sense.

The idea

   Implement the function EXPLODE to be used with text params, that can be used also with any params (casting to string if needed)
The proposed function is:

string new_params_list_n = EXPLODE(string input_param, string separator, int limit=0)

string new_params_list_n: Will generate a 'list of new params' with the contents of 'input_params' exploded with 'separator' until 'limit' items, the list will contain 'n' items and will create a new parameter identified by the name input_param + n, where n is the index.
string input_param: the string that will be exploded, if input_param is not a string it will be casted to string
string separator: used to define the character or characters used for the explode function
int limit: used to define the max number of items created from the explode, by default there is no limit, same as define limit as 0, if you define a number > 0 the number of returned items will be set to this limit

Example:

RAW data received by the gps:

text_param=hello|world|from|any|gps, event_type=1, others_params=dontcare

Note that can be any GPS no matter wich one, even if it havent an rs232 port, the solution proposed here is for data manipulation, not a especific solution linked to a gps model or application.

Then on 'Sensors' (or any other side, the 'Where' it's a gurtam decision)

We configure:

EXPLODE(text_param,"|",0)

then the new list of params available become

text_param=hello|world|from|any|gps, event_type=1, others_params=dontcare, text_param1=hello,text_param2=world,text_param3=from,text_param4=any,text_param5=gps

Now, same example but using the limit function:

We configure:

EXPLODE(text_param,"|",2)

then the new list of params available become

text_param=hello|world|from|any|gps, event_type=1, others_params=dontcare, text_param1=hello,text_param2=world

Now a real life example:

RAW data received by the gps:

text_param=21.5;22.0;47.8, event_type=1,hdop=12

We configure:

EXPLODE(text_param,";",0)

we get

text_param=21.5;22.0;47.8, event_type=1,hdop=12,text_param1=21.5,text_param2=22.0,text_param3=47.8


End users:

   This will apply to any one that wants to access data present in some param, in order to create sensors and feed applications.
This can be used to track fuel, rpm, speed, etc with third party accesories connected by rs232 to any gps in transparent mode.
We are implementing CAN BUS reading for most trucks usign an external reader that can be connected with any GPS with an available RS232 port.

Today, we got this implemented using our own middleware that receive the data and then feed wialon with the parsed data using IPS. It's works like a charm, but would be better if we can skip this in first place.

Remarks:

Explode function is available in every computer language, thus can be easyly implemented, the only hard part is make the UI in order to set, and configure the function.

Hope that other developers can support this idea, because it will allow to integrate plenty of other  complementary devices to wialon in a quickly manner.

Best regards and happy coding

With love from Chile tongue

Desarrollo e integración de sistemas
System development and integration
Разработка системы и интеграция
www.techdev.cl
2

EXPLODE Function for text params

Re: EXPLODE Function for text params

techdev, sensor can not manipulate the data. Explode function proposed by you require reading parameter and then storing in the message few generated values.

What can be proposed to Gurtam analytics is some kind of function in sensor value that will manipulate with strings and especially extract value as you need. Like:

substr(parameter-name,separator, index)

=>

substr(text_param,;, 0)

The only thing here is how to specify delimiter correctly))

At the dark side of telematics...
3

EXPLODE Function for text params

Re: EXPLODE Function for text params

techdev, first of all, thank you for such detailed description. It can be an example for others.

I think you know, device parameters are parsed first by our hardware scripts. So it's better first to connect our HW team and send them device's protocol.  You can find the list of additional hardware on our site. Seems, they already supported some similar devices.

If you could not find a solution with them, we will try to do it on the software side.

Tatsiana Shmihelskaya
Business Analyst, Gurtam
4

EXPLODE Function for text params

Re: EXPLODE Function for text params

Hello Shal

Just as you noted, it can be a function that manipulate strings of a sensor value. As I said, the 'where' and 'how' it's up to gurtam, I just suggested something between data parsed after hardware script and sensor input data, but it can also be in the end just in sensor data. the goal to do it before was publish the value to be used by several other sensor that depends in that  value, but I think this can also be implemented after.

---

Hello tata

The idea to have this implemented in software side is precicesly avoid the need to make this everytime for a different hw and got to contact to hw team that I assume are very busy all the time, the proposed solution is more general , because text manipulation is an area that need a little improvement in the options available.

Thank to both for your prompt answers

best regards

Desarrollo e integración de sistemas
System development and integration
Разработка системы и интеграция
www.techdev.cl
5

EXPLODE Function for text params

Re: EXPLODE Function for text params

Hi All, anyone could hel p us to understand this :

Conversion of textual parameters

If there is a textual parameter in the sensor formula, it is converted into 53-bit integer. By default, it is interpreted as decimal, however, positional notation can be specified after colon. For example, there is a parameter called text_param and it has the value 100, then:

text_param = 100
text_param:16 = 256
text_param:2 = 4

How to understand positional notation and how wialon calculate it

Thanks,
PaulPak

6

EXPLODE Function for text params

(07/03/2019 13:57:46 отредактировано Diana)

Re: EXPLODE Function for text params

paul.pakpahan пишет:

Hi All, anyone could hel p us to understand this :

....
How to understand positional notation and how wialon calculate it

Thanks,
PaulPak

Hi Paul!

Position notation means one of the base  of the numeral system for example, base-10 (decimal) , base-16 (hexadecimal) and etc.. You just specify the base which you need to recalculate raw value.
For example , row value in hexadecimal format - 'FA' in decimal it will be 250, so it needs to specify param:16 to get hex value to decimal
Calculation in Wialon is the same as standard mathematical conversion from one base numeral system to another, for example here

Diana Cheley
Wialon Hosting Expert
Gurtam