- MaxIndex = 133,
- BadIndex = MaxIndex + 1,
- FakeBlockData = list_to_binary(lists:seq(1, 32)),
- FakeBlockOk = <<MaxIndex:32/little-integer, FakeBlockData/binary>>,
- FakeBlockBadIndex = <<BadIndex:32/little-integer, FakeBlockData/binary>>,
- {error, {block_index_byte_out_of_range, {BadIndex,_,_,_,_,_,_,_,_}}} =
- x_plane_data:of_bin(<<Packet/binary, FakeBlockBadIndex/binary>>),
- {error, packet_unrecognized} =
- x_plane_data:of_bin(<<"bad-header", Packet/binary>>),
- {error, packet_length_invalid} =
- x_plane_data:of_bin(<<Packet/binary, "extra-stuff">>),
- {ok, Data} =
- x_plane_data:of_bin(<<Packet/binary, FakeBlockOk/binary>>),
- {some, #x_plane_datum_speeds{}} =
- hope_kv_list:get(Data, speeds),
- {some, #x_plane_datum_pitch_roll_heading{}} =
- hope_kv_list:get(Data, pitch_roll_heading),
- {some, #x_plane_datum_lat_lon_alt{}} =
- hope_kv_list:get(Data, lat_lon_alt),
- {some, {MaxIndex,_,_,_,_,_,_,_,_}} =
- hope_kv_list:get(Data, MaxIndex),
+ {error, packet_bad_header} =
+ x_plane_data_raw:of_bin(<<"bad-header", Packet/binary>>),
+ {error, packet_bad_length} =
+ x_plane_data_raw:of_bin(<<Packet/binary, "extra-stuff">>),
+ {ok, {Index, Groups}} =
+ x_plane_data_raw:of_bin(<<Packet/binary>>),
+ ct:log("Index: ~p", [Index]),
+ ct:log("Groups: ~p", [Groups]),
+ {some, Group3 } = kv_list_find(Groups, 3),
+ {some, Group17} = kv_list_find(Groups, 17),
+ {some, Group20} = kv_list_find(Groups, 20),
+ { 3.106105089187622
+ , 6.640225887298584
+ , 6.793502330780029
+ , 1.0040892448159866e-5
+ , -999.0
+ , 3.574441909790039
+ , 7.81782341003418
+ , 1.1554855518625118e-5
+ } = Group3,
+ { 2.3310465812683105
+ , 0.22457626461982727
+ , 120.6203384399414
+ , 133.51084899902344
+ , -999.0
+ , -999.0
+ , -999.0
+ , -999.0
+ } = Group17,
+ { 40.64827346801758
+ , -73.81651306152344
+ , 7.969515800476074
+ , 0.226793110370636
+ , 1.0
+ , -70.99662780761719
+ , 40.0
+ , -75.0
+ } = Group20,