config: expose get_bool/2

This commit is contained in:
Carlos Martín Nieto
2014-05-19 12:55:12 +02:00
parent d6ad01836f
commit 4b0379f3ee

View File

@@ -14,6 +14,7 @@
-export([start_link/1]). -export([start_link/1]).
-export([open/1]). -export([open/1]).
-export([set/3]). -export([set/3]).
-export([get_bool/2]).
%% gen_server callbacks %% gen_server callbacks
-export([init/1, handle_call/3, handle_cast/2, handle_info/2, -export([init/1, handle_call/3, handle_cast/2, handle_info/2,
@@ -51,6 +52,9 @@ open(Path) ->
set(Pid, Name, Val) when is_boolean(Val) -> set(Pid, Name, Val) when is_boolean(Val) ->
gen_server:call(Pid, {set_bool, Name, Val}). gen_server:call(Pid, {set_bool, Name, Val}).
get_bool(Pid, Name) ->
gen_server:call(Pid, {get_bool, Name}).
%%%=================================================================== %%%===================================================================
%%% gen_server callbacks %%% gen_server callbacks
%%%=================================================================== %%%===================================================================
@@ -75,6 +79,10 @@ init(Handle) ->
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
handle_call({set_bool, Name, Val}, _From, State = #state{handle=Handle}) -> handle_call({set_bool, Name, Val}, _From, State = #state{handle=Handle}) ->
Reply = geef_nif:config_set_bool(Handle, Name, Val), Reply = geef_nif:config_set_bool(Handle, Name, Val),
{reply, Reply, State};
handle_call({get_bool, Name}, _From, State = #state{handle=Handle}) ->
Reply = geef_nif:config_get_bool(Handle, Name),
{reply, Reply, State}. {reply, Reply, State}.
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------