Skip to content

cli, location: Fix multi-sentence NMEA message output

Teemu Ikonen requested to merge tpikonen/ModemManager:cli-nmea-multi into master

Multi-sentence NMEA messages were printed as is, that is with linebreaks, which made mmcli --location-get output look broken.

Split NMEA sentences with linebreaks to separate output list items, so that they line up correctly.

mmcli --location-get output before patch (these are after applying !607 (merged)):

  --------------------------
  GPS  |               nmea: $GPGSA,A,1,,,,,,,,,,,,,,,,*32
       |                     $GNGNS,104720.00,,,,,NNN,,,,,,*33
       |                     $GPRMC,,V,,,,,,,,,,N*53
       |                     $GAGSV,2,1,07,02,11,001,,07,24,047,,11,13,299,,12,64,274,,7*76
$GAGSV,2,2,07,19,36,178,,24,00,264,,25,14,312,,7*43
       |                     $PQGSV,2,1,08,20,51,073,17,22,13,222,25,29,23,163,25,02,05,116,,0,4*6B
$PQGSV,2,2,08,05,16,140,,06,42,075,,12,12,314,,13,04,104,,0,4*63
       |                     $GNGSA,A,1,,,,,,,,,,,,,,,,*2C
       |                     $GPGSV,2,1,07,01,54,281,20,03,19,241,17,08,28,195,26,27,06,175,22,1*68
$GPGSV,2,2,07,32,51,098,15,10,26,073,,14,16,298,,1*53
       |                     $GLGSV,2,1,08,74,20,354,,66,71,073,,82,78,267,,73,07,307,,1*737
$GLGSV,2,2,08,65,11,042,,83,32,313,,81,40,151,,67,45,203,,1*77
       |                     $GPVTG,,T,,M,,N,,K,N*2C
       |                     $GPGGA,,,,,,0,,,,,,,,*66

After patch:

  -----------
  GPS | nmea: $GPGSA,A,1,,,,,,,,,,,,,,,,*32
      |       $GNGNS,102953.00,,,,,NNN,,,,,,*3F
      |       $GPRMC,,V,,,,,,,,,,N*53
      |       $GAGSV,2,1,07,02,08,007,,07,29,050,,11,07,298,,12,58,281,,7*72
      |       $GAGSV,2,2,07,19,29,178,,24,06,267,,25,17,319,,7*40
      |       $PQGSV,3,1,09,01,,,33,02,05,116,,05,16,140,,06,41,080,,0,4*5C
      |       $PQGSV,3,2,09,12,05,314,,13,06,099,,16,41,074,,19,54,195,,0,4*62
      |       $PQGSV,3,3,09,20,57,080,,0,4*5A
      |       $GNGSA,A,1,,,,,,,,,,,,,,,,*2C
      |       $GPGSV,2,1,06,01,46,282,,03,12,239,,08,35,198,,10,33,071,,1*6B
      |       $GPGSV,2,2,06,14,19,305,,17,10,323,,1*6C
      |       $GLGSV,3,1,09,74,20,002,,66,75,102,,82,71,295,,73,13,314,,1*73
      |       $GLGSV,3,2,09,65,19,040,,88,00,139,,83,23,313,,81,50,147,,1*71
      |       $GLGSV,3,3,09,67,36,201,,1*46
      |       $GPVTG,,T,,M,,N,,K,N*2C
      |       $GPGGA,,,,,,0,,,,,,,,*66
Edited by Aleksander Morgado

Merge request reports

Loading