anchor.diff:  	  [LocalServices, RemoteAddress, RemoteChannel]),
   
       bt_connection:send(FromPid, 
  -		       term_to_binary(
  -			 { service_announce, 2, available,
  -			   LocalServices, { signature, {}}})),
  +		       term_to_json(
  +			 {struct, 		     
  +			  [ { "tid", 1 },
  +			    { "cmd", "service_announce" },
  +			    { "status", "available" },
  +			    { "services", { array, LocalServices }},
  +			    { "signature", "" } ]})),
   
       %% Setup ping interval
  -    gen_server:call(?SERVER, { setup_initial_ping, RemoteAddress, RemoteChannel, FromPid }),
  +    gen_server:call(?SERVER, { setup_initial_ping, PeerBTChannel, RemoteChannel, FromPid }),
       ok.
   
   
   
   handle_socket(FromPid, PeerBTAddr, PeerChannel, data, 
  -	      Data, CompSpec) ->
  -
  -    try binary_to_term(Data) of
  -	{ authorize, TransactionID, RemoteAddress, RemoteChannel, 
  -	  Protocol, Certificate, Signature}  -> 
  +	      Payload, CompSpec) ->
  +
  +    {ok, {struct, Elems}} = exo_json:decode_string(binary_to_list(Payload)),
  +    ?debug("dlink_bt:data(): Got ~p", [ Elems ]),
  +
  +    case opt("cmd", Elems, undefined) of
  +	"authorize" ->
  +	    [ TransactionID, RemoteAddress, RemoteChannel, 
  +	      RVIProtocol, Certificate, Signature ] = 
  +		opts(["tid", "addr", "channel", "rvi_proto", 
  +		      "certificate", "signature"], Elems, undefined),
  +
   	    process_authorize(FromPid, PeerBTAddr, RemoteChannel,
   			     TransactionID, RemoteAddress, RemoteChannel, 
  -			     Protocol,  Certificate, Signature, CompSpec);
  -
  -	{ service_announce, TransactionID, Available, Services, Signature } ->
  -	    process_announce(FromPid, PeerBTAddr, PeerChannel,
  -			    TransactionID, Available, Services, 
  -			    Signature, CompSpec);
  -
  -	{ receive_data, ProtocolMod, Data } ->
  -	    process_data(FromPid, PeerBTAddr, PeerChannel, 
  -			ProtocolMod, Data, CompSpec);
  -	ping ->
  +			     RVIProtocol,  Certificate, Signature, CompSpec);
  +
  +	"service_announce" ->
  +	    [ TransactionID, Available, Services, Signature ] = 
  +		opts(["tid", "status", "services", "signature"],
  +		     Elems, undefined),
  +	    
  +	     	    process_announce(FromPid, PeerBTAddr, PeerChannel,
  +				     TransactionID, Available, Services, 
  +				     Signature, CompSpec);
  +	"receive_data" ->
  +	    [ _TransactionID, ProtocolMod, Payload ] = 
  +		opts(["tid", "proto_mod", "paylaod"],
  +		     Elems, undefined),
  +	    process_data(FromPid, PeerBTAddr, PeerChannel,
  +			 ProtocolMod, Payload, CompSpec);
  +	
  +	"ping" ->
   	    ?info("dlink_bt:ping(): Pinged from: ~p:~p", [ PeerBTAddr, PeerChannel]),
   	    ok;
   
  -	Unknown ->
  -	    ?warning("dlink_bt:handle_socket(): Unknown data: ~p", [ Unknown]),
  +	undefined -> 
  +	    ?warning("dlink_bt:data() cmd undefined., ~p", [ Elems ]),
   	    ok
  -    catch
  -	_:_ ->
  -	    ?warning("dlink_bt:handle_socket(data): Data could not be decoded: ~p", 
  -		     [ Data]),
  -	    ok
  -
       end.
  -
   
   
   %% We lost the socket connection.
  
positive.code: 	    ?info("dlink_bt:authorize(): New connection!"),
  	    bt_connection_manager:add_connection(RemoteAddress, RemoteChannel, FromPid),
  	    ?debug("dlink_bt:authorize(): Sending authorize."),
  	    Res = bt_connection:send(FromPid, 
  				     term_to_binary(
  				       { authorize, 
  					 1, LocalAddress, LocalChannel, rvi_json, 
  					 {certificate, {}}, { signature, {}}})),
  	    ?debug("dlink_bt:authorize(): Sending authorize: ~p", [ Res]),
  	    ok;
  	_ -> ok
  
negative.code: 		 RemoteBTAddr, 
  		 RemoteChannel,
  		 TransactionID,
  		 "unavailable",
  		 {array, Services},
  		 Signature ,
  		 CompSpec) ->
      ?debug("dlink_bt:service_announce(unavailable): Address:       ~p-~p",
  