Portman Protocol

Gerardo Rivera7 years ago

Hi my friend

I have a new device (Portman NT1000) this is the string

$PTMLA,865609020890069,A,170428163331,N2726.7180W09938.4055,90,194,NA,09820020,NA,108,9,47765.98,16,GNA
what listener can i use?

this is the parse

        // 0 $PTMLA
        // 1 ID 			=	860998025525449
        // 2 GPS Valid		=	A,B,L			
        // 3 Date			=	160729165920
        // 4 Lat/Long		=	N2541.5278W10027.1167
        // 5 Speed		=	0			
        // 6 Orientation	=	114		
        // 7 Temp			=	NA		
        // 8 Entradas		=	00820000
        // 9 RFID			=	NA
        // 10 Event		=	253	
        // 11 Satelites	=	0			
        // 12 Odometer	=	3.00		
        // 13 GS Signal	=	15
        // 14 OIL High		=	GNA

And this is how i'm parsing now but its fail with his error:

WARN: [7B106717] error - No match found - IllegalStateException (... < Parser:61 < NT1000ProtocolDecoder:134 < ExtendedObjectDecoder:58 < ...)
private static final Pattern PATTERN = new PatternBuilder()
            .text("$PTMLA,")
            .number("(d+),")                     // imei
            .expression("([AV]),")               // validity
            .number("(d+),")                     // DateTime
            .expression("([NS])")
            .number("(dd)(dd.d+)")               // latitude
            .expression("([EW])")
            .number("(ddd)(dd.d+),")             // longitude
            .number("(d+.?d*)?,?")               // speed
            .number("(d+.?d*)?,?")               // course
            .text("NA,")                         // Thermo
            .text("(d+),")                       // Inputs
            .text("NA,")                         // rfid
            .number("(d+),")                     // Event
            .text("(d+),")                       // satellite
            .number("(d+.?d*)?,?")               // odo
            .number("(d+),")                     // signal
            .any().optional()
            .compile();

Can you help me?
What im doing wrong?

thanks a lot
GR

Anton Tananaev7 years ago

You can use PatternUtil class to debug regular expression pattern.

Gerardo Rivera7 years ago

Hi Anton

Im tryng to match this but i canĀ“t do it.
How can i use PatternUtil?
Please show me the way, this is my first listener here.

Thanks!!

Anton Tananaev7 years ago

I would recommend to study Java code.

Gerardo Rivera7 years ago

ok, thanks any way...