--[[ 2021-08-12 * Fix Sattelites ]] egoV5 = Proto("egoV5","Ego V5 Protocol") -- create a function to dissect it function egoV5.dissector(buffer,pinfo,tree) -- check the ports if(pinfo.dst_port ~= 1025 or buffer:len() < 108 ) then return 0 end pinfo.cols.protocol = "egoV5" local tree = tree:add(egoV5,buffer(),"Ego V5 Data") local headerTree = tree:add(buffer(0,7),"Header") local DataTree = tree:add(buffer(8,100),"Data") LongitudeInt = buffer(8,4):le_int() LongitudeFract = buffer(12,4):le_float() local LongTree = DataTree:add(buffer(8,8),string.format("Longitude: %f[deg]",(LongitudeInt + LongitudeFract)/1000)) LongTree:add(buffer(8,4),string.format("LongitudeInt: %d",LongitudeInt)) LongTree:add(buffer(12,4),string.format("LongitudeFract: %f",LongitudeFract)) --- LatitudeInt = buffer(16,4):le_int() LatitudeFract = buffer(20,4):le_float() local LatTree = DataTree:add(buffer(16,8),string.format("Latitude: %f [deg]",(LatitudeInt + LatitudeFract)/1000)) LatTree:add(buffer(16,4),string.format("LatitudeInt: %d",LatitudeInt)) LatTree:add(buffer(20,4),string.format("LatitudeFract: %f",LatitudeFract)) --- DataTree:add(buffer(24,4),string.format("Height: %f [m]",buffer(24,4):le_float())) --- DataTree:add(buffer(28,4),string.format("Velocity North: %f [m/s]",buffer(28,4):le_float())) --- DataTree:add(buffer(32,4),string.format("Velocity East: %f [m/s]",buffer(32,4):le_float())) --- DataTree:add(buffer(36,4),string.format("Velocity Z: %f [m/s]",buffer(36,4):le_float())) --- DataTree:add(buffer(40,4),string.format("Acc Horizontal X: %f [m/s^2]",buffer(40,4):le_float())) --- DataTree:add(buffer(44,4),string.format("Acc Horizontal Y: %f [m/s^2]",buffer(44,4):le_float())) --- DataTree:add(buffer(48,4),string.format("Acc Horizontal Z: %f [m/s^2]",buffer(48,4):le_float())) --- DataTree:add(buffer(52,4),string.format("Roll: %f [deg]",buffer(52,4):le_float())) --- DataTree:add(buffer(56,4),string.format("Pitch: %f [deg]",buffer(56,4):le_float())) --- DataTree:add(buffer(60,4),string.format("Yaw: %f [deg]",buffer(60,4):le_float())) --- DataTree:add(buffer(64,4),string.format("Roll Velocity: %f [deg/s]",buffer(64,4):le_float())) --- DataTree:add(buffer(68,4),string.format("Pitch Velocity: %f [deg/s]",buffer(68,4):le_float())) --- DataTree:add(buffer(72,4),string.format("Yaw Velocity: %f [deg/s]",buffer(72,4):le_float())) --- DataTree:add(buffer(76,4),string.format("Tracking Angle: %f [deg]",buffer(76,4):le_float())) --- DataTree:add(buffer(80,4),string.format("Slip Angle: %f [deg]",buffer(80,4):le_float())) --- DataTree:add(buffer(84,4),string.format("Slip Angle Offset: %f [deg]",buffer(84,4):le_float())) --- DataTree:add(buffer(88,4),string.format("Slip Angle Error: %f [deg]",buffer(88,4):le_float())) --- DataTree:add(buffer(92,4),string.format("Acc Yaw: %f [deg/s^2]",buffer(92,4):le_float())) --- DataTree:add(buffer(96,4),string.format("GPS Time : %d [ms]",buffer(96,4):le_uint())) --- sat = bit.rshift(buffer(100,1):le_uint() and 0xf0,4 ) DataTree:add(buffer(100,1),string.format("Satellites Used: %d []",sat)) --- status = buffer(102,1):le_uint() status_def = { [0]='ERROR', [1]='Gyro not initialized', [2]='Waiting for Initialisation (not exceeded threshold speed for heading)', [3]='Not real time mode', [5]='accuracy worse than 10m', [6]='accuracy 2m to 10m', [7]='accuracy 0.5m to 2m', [8]='accuracy 0.1m to 0.5m', [9]='accuracy better than 0.1m', } if status_def[status] ~= nil then status_str = status_def[status] else status_str = '' end DataTree:add(buffer(102,1),string.format("GPS Status: %d (%s) ",status,status_str)) --- diffAge= buffer(104,1):le_uint() DataTree:add(buffer(104,1),string.format("Diff Age: %d ",buffer(104,1):le_uint())) --- --tree:add_expert_info(PI_DEBUG,PI_WARN,"Low Gps Accuracy") pinfo.cols.info = string.format("Status=%s, DiffAge=%d, Satellites=%d",status_str,diffAge,sat) end udp_table = DissectorTable.get("udp.port") udp_table:add(1025,egoV5)