-module(pt_144).
-include("common.hrl").
-export([
        read/2,
        write/2
    ]).

read(14400, _) ->
    {ok, []};
read(14401, Bin0) ->
    <<UseNum:16, _Bin1/binary>> = Bin0, 
    {ok, [UseNum]};
read(14402, _) ->
    {ok, []};
read(14403, _) ->
    {ok, []};
read(_Cmd, _R) -> {error, no_match}.

write (14400,[
    Grade,
    Lv,
    Power,
    Energy
] = Src_Data) ->
    Data = <<
        Grade:16,
        Lv:16,
        Power:64,
        Energy:32
    >>,
    {ok, pt:encode(14400, Data, Src_Data)};

write (14401,[
    Res
] = Src_Data) ->
    Data = <<
        Res:32
    >>,
    {ok, pt:encode(14401, Data, Src_Data)};

write (14402,[
    Res
] = Src_Data) ->
    Data = <<
        Res:32
    >>,
    {ok, pt:encode(14402, Data, Src_Data)};

write (14403,[
    Res
] = Src_Data) ->
    Data = <<
        Res:32
    >>,
    {ok, pt:encode(14403, Data, Src_Data)};

write(_Cmd, _R) -> ?DEBUG("no_match:~p,~p~n", [_Cmd, _R]), {ok, pt:pack(0, <<>>)}.


