<configurationDescriptor version="97">
<logicalFolder name="root" displayName="root" projectFiles="true" kind="ROOT">
<df root="." name="0">
+ <df name="plugins">
+ <df name="audio">
+ <in>audio-api.c</in>
+ </df>
+ <df name="radio">
+ <in>radio-api.c</in>
+ <in>radio-rtlsdr.c</in>
+ </df>
+ <df name="samples">
+ <in>HelloWorld.c</in>
+ </df>
+ <df name="session">
+ <in>token-api.c</in>
+ </df>
+ </df>
<df name="src">
<in>afbs-api.c</in>
<in>alsa-api.c</in>
<flagsDictionary>
<element flagsID="0" commonFlags="-fPIE"/>
<element flagsID="1" commonFlags="-mtune=generic -march=x86-64 -fPIC"/>
- <element flagsID="2" commonFlags="-mtune=generic -march=x86-64 -fPIE"/>
</flagsDictionary>
<codeAssistance>
</codeAssistance>
<cleanCommand>${MAKE} -f Makefile clean</cleanCommand>
<executablePath>build/afb-daemon</executablePath>
<cTool flags="1">
- <incDir>
- <pElem>plugins/audio</pElem>
- <pElem>/usr/include/json-c</pElem>
- <pElem>include</pElem>
- <pElem>/usr/include/uuid</pElem>
- <pElem>build/plugins</pElem>
- <pElem>plugins/samples</pElem>
- <pElem>/usr/include/json-c</pElem>
- <pElem>include</pElem>
- <pElem>/usr/include/uuid</pElem>
- <pElem>build/plugins</pElem>
- <pElem>plugins/session</pElem>
- <pElem>/usr/include/json-c</pElem>
- <pElem>include</pElem>
- <pElem>/usr/include/uuid</pElem>
- <pElem>build/plugins</pElem>
- </incDir>
</cTool>
</makeTool>
<preBuild>
<preBuildFirst>true</preBuildFirst>
</preBuild>
</makefileType>
+ <folder path="0/plugins">
+ <cTool>
+ <incDir>
+ <pElem>include</pElem>
+ <pElem>/usr/include/json-c</pElem>
+ <pElem>/usr/include/libusb-1.0</pElem>
+ <pElem>build/plugins</pElem>
+ </incDir>
+ </cTool>
+ </folder>
+ <folder path="0/plugins/audio">
+ <cTool>
+ <incDir>
+ <pElem>plugins/audio</pElem>
+ <pElem>/usr/include/uuid</pElem>
+ </incDir>
+ </cTool>
+ </folder>
+ <folder path="0/plugins/radio">
+ <cTool>
+ <incDir>
+ <pElem>plugins/radio</pElem>
+ </incDir>
+ </cTool>
+ </folder>
+ <folder path="0/plugins/samples">
+ <cTool>
+ <incDir>
+ <pElem>plugins/samples</pElem>
+ <pElem>/usr/include/uuid</pElem>
+ </incDir>
+ </cTool>
+ </folder>
+ <folder path="0/plugins/session">
+ <cTool>
+ <incDir>
+ <pElem>plugins/session</pElem>
+ <pElem>/usr/include/uuid</pElem>
+ </incDir>
+ </cTool>
+ </folder>
+ <item path="plugins/audio/audio-api.c" ex="false" tool="0" flavor2="2">
+ <cTool flags="1">
+ </cTool>
+ </item>
+ <item path="plugins/radio/radio-api.c" ex="false" tool="0" flavor2="2">
+ <cTool flags="1">
+ <incDir>
+ <pElem>/usr/include/json-c</pElem>
+ <pElem>include</pElem>
+ <pElem>/usr/include/uuid</pElem>
+ <pElem>build/plugins</pElem>
+ </incDir>
+ </cTool>
+ </item>
+ <item path="plugins/radio/radio-rtlsdr.c" ex="false" tool="0" flavor2="2">
+ <cTool flags="1">
+ <incDir>
+ <pElem>include</pElem>
+ <pElem>/usr/include/json-c</pElem>
+ <pElem>/usr/include/uuid</pElem>
+ <pElem>build/plugins</pElem>
+ </incDir>
+ </cTool>
+ </item>
+ <item path="plugins/samples/HelloWorld.c" ex="false" tool="0" flavor2="2">
+ <cTool flags="1">
+ </cTool>
+ </item>
+ <item path="plugins/session/token-api.c" ex="false" tool="0" flavor2="2">
+ <cTool flags="1">
+ </cTool>
+ </item>
<item path="src/afbs-api.c" ex="false" tool="0" flavor2="2">
<cTool flags="0">
<incDir>
- <pElem>include</pElem>
+ <pElem>plugins/audio</pElem>
<pElem>/usr/include/json-c</pElem>
+ <pElem>include</pElem>
+ <pElem>/usr/include/uuid</pElem>
+ <pElem>build/plugins</pElem>
+ <pElem>plugins/samples</pElem>
+ <pElem>plugins/session</pElem>
<pElem>build/src</pElem>
</incDir>
</cTool>
<item path="src/alsa-api.c" ex="false" tool="0" flavor2="2">
<cTool flags="0">
<incDir>
- <pElem>include</pElem>
+ <pElem>plugins/audio</pElem>
<pElem>/usr/include/json-c</pElem>
+ <pElem>include</pElem>
+ <pElem>/usr/include/uuid</pElem>
+ <pElem>build/plugins</pElem>
+ <pElem>plugins/samples</pElem>
+ <pElem>plugins/session</pElem>
<pElem>build/src</pElem>
</incDir>
</cTool>
</item>
<item path="src/config.c" ex="false" tool="0" flavor2="2">
- <cTool flags="2">
+ <cTool flags="1">
<incDir>
<pElem>src</pElem>
<pElem>/usr/include/json-c</pElem>
<pElem>build/src</pElem>
</incDir>
<preprocessorList>
+ <Elem>HAVE_RADIO_PLUGIN=1</Elem>
<Elem>__PIC__=2</Elem>
- <Elem>__PIE__=2</Elem>
<Elem>__REGISTER_PREFIX__=</Elem>
<Elem>__USER_LABEL_PREFIX__=</Elem>
<Elem>__pic__=2</Elem>
- <Elem>__pie__=2</Elem>
</preprocessorList>
</cTool>
</item>
<item path="src/dbus-api.c" ex="false" tool="0" flavor2="2">
<cTool flags="0">
<incDir>
- <pElem>include</pElem>
+ <pElem>plugins/audio</pElem>
<pElem>/usr/include/json-c</pElem>
+ <pElem>include</pElem>
+ <pElem>/usr/include/uuid</pElem>
+ <pElem>build/plugins</pElem>
+ <pElem>plugins/samples</pElem>
+ <pElem>plugins/session</pElem>
<pElem>build/src</pElem>
</incDir>
</cTool>
<pElem>/usr/include/uuid</pElem>
<pElem>build/src</pElem>
</incDir>
+ <preprocessorList>
+ <Elem>HAVE_RADIO_PLUGIN=1</Elem>
+ <Elem>__PIC__=2</Elem>
+ <Elem>__REGISTER_PREFIX__=</Elem>
+ <Elem>__USER_LABEL_PREFIX__=</Elem>
+ <Elem>__pic__=2</Elem>
+ </preprocessorList>
</cTool>
</item>
<item path="src/main.c" ex="false" tool="0" flavor2="2">
- <cTool flags="2">
+ <cTool flags="1">
<incDir>
<pElem>src</pElem>
<pElem>/usr/include/json-c</pElem>
<pElem>build/src</pElem>
</incDir>
<preprocessorList>
+ <Elem>HAVE_RADIO_PLUGIN=1</Elem>
<Elem>__PIC__=2</Elem>
- <Elem>__PIE__=2</Elem>
<Elem>__REGISTER_PREFIX__=</Elem>
<Elem>__USER_LABEL_PREFIX__=</Elem>
<Elem>__pic__=2</Elem>
- <Elem>__pie__=2</Elem>
</preprocessorList>
</cTool>
</item>
<item path="src/radio-api.c" ex="false" tool="0" flavor2="2">
<cTool flags="0">
<incDir>
- <pElem>include</pElem>
+ <pElem>plugins/audio</pElem>
<pElem>/usr/include/json-c</pElem>
+ <pElem>include</pElem>
+ <pElem>/usr/include/uuid</pElem>
+ <pElem>build/plugins</pElem>
+ <pElem>plugins/samples</pElem>
+ <pElem>plugins/session</pElem>
<pElem>/usr/include/libusb-1.0</pElem>
<pElem>build/src</pElem>
</incDir>
</cTool>
</item>
<item path="src/rest-api.c" ex="false" tool="0" flavor2="2">
- <cTool flags="2">
+ <cTool flags="1">
<incDir>
<pElem>src</pElem>
<pElem>/usr/include/json-c</pElem>
<pElem>/usr/include/uuid</pElem>
<pElem>build/src</pElem>
</incDir>
+ <preprocessorList>
+ <Elem>HAVE_RADIO_PLUGIN=1</Elem>
+ <Elem>__PIC__=2</Elem>
+ <Elem>__REGISTER_PREFIX__=</Elem>
+ <Elem>__USER_LABEL_PREFIX__=</Elem>
+ <Elem>__pic__=2</Elem>
+ </preprocessorList>
</cTool>
</item>
<item path="src/session.c" ex="false" tool="0" flavor2="2">
- <cTool flags="2">
+ <cTool flags="1">
<incDir>
<pElem>src</pElem>
<pElem>/usr/include/json-c</pElem>
<pElem>build/src</pElem>
</incDir>
<preprocessorList>
+ <Elem>HAVE_RADIO_PLUGIN=1</Elem>
<Elem>__PIC__=2</Elem>
- <Elem>__PIE__=2</Elem>
<Elem>__REGISTER_PREFIX__=</Elem>
<Elem>__USER_LABEL_PREFIX__=</Elem>
<Elem>__pic__=2</Elem>
- <Elem>__pie__=2</Elem>
</preprocessorList>
</cTool>
</item>
<configurationDescriptor version="97">
<logicalFolder name="root" displayName="root" projectFiles="true" kind="ROOT">
<df root="." name="0">
+ <df name="build">
+ <df name="CMakeFiles">
+ <df name="3.3.2">
+ <df name="CompilerIdC">
+ <in>CMakeCCompilerId.c</in>
+ </df>
+ </df>
+ <df name="afb-daemon.dir">
+ </df>
+ <df name="CMakeTmp">
+ </df>
+ <in>feature_tests.c</in>
+ </df>
+ <df name="plugins">
+ <df name="CMakeFiles">
+ <df name="plugins.dir">
+ <df name="audio">
+ </df>
+ <df name="radio">
+ </df>
+ <df name="samples">
+ </df>
+ <df name="session">
+ </df>
+ </df>
+ </df>
+ </df>
+ <df name="src">
+ <df name="CMakeFiles">
+ <df name="src.dir">
+ </df>
+ </df>
+ </df>
+ </df>
<df name="doc">
<df name="nbproject.template">
<df name="private">
</df>
<df name="radio">
<in>radio-api.c</in>
+ <in>radio-api.h</in>
+ <in>radio-rtlsdr.c</in>
+ <in>radio-rtlsdr.h</in>
</df>
<df name="samples">
<in>HelloWorld.c</in>
</df>
</df>
<df root="." name="1">
+ <df name="build">
+ <df name="CMakeFiles">
+ <df name="3.3.2">
+ <df name="CompilerIdC">
+ </df>
+ </df>
+ <df name="afb-daemon.dir">
+ </df>
+ <df name="CMakeTmp">
+ </df>
+ </df>
+ <df name="plugins">
+ <df name="CMakeFiles">
+ <df name="plugins.dir">
+ <df name="audio">
+ </df>
+ <df name="radio">
+ </df>
+ <df name="samples">
+ </df>
+ <df name="session">
+ </df>
+ </df>
+ </df>
+ </df>
+ <df name="src">
+ <df name="CMakeFiles">
+ <df name="src.dir">
+ </df>
+ </df>
+ </df>
+ </df>
<df name="doc">
<df name="nbproject.template">
<df name="private">
<gdb_interceptlist>
<gdbinterceptoptions gdb_all="false" gdb_unhandled="true" gdb_unexpected="true"/>
</gdb_interceptlist>
+ <gdb_signals>
+ </gdb_signals>
<gdb_options>
<DebugOptions>
</DebugOptions>
--token=123456789</runcommandpicklistitem>
<runcommandpicklistitem>"${OUTPUT_PATH}" --verbose --alias=icons:/usr/share/icons --token=123456789</runcommandpicklistitem>
<runcommandpicklistitem>"${OUTPUT_PATH}" --verbose --alias=icons:/usr/share/icons --token=123456789 --rootdir=/home/fulup/Workspace/afb-client/dist.dev</runcommandpicklistitem>
+ <runcommandpicklistitem>"${OUTPUT_PATH}" --verbose --alias=icons:/usr/share/icons --token=123456789 --rootdir=/home/fulup/Workspace/afb-client/dist.dev --sessiondir=/tmp --port=1235</runcommandpicklistitem>
</runcommandpicklist>
- <runcommand>"${OUTPUT_PATH}" --verbose --alias=icons:/usr/share/icons --token=123456789 --rootdir=/home/fulup/Workspace/afb-client/dist.dev</runcommand>
+ <runcommand>"${OUTPUT_PATH}" --verbose --alias=icons:/usr/share/icons --token=123456789 --rootdir=/home/fulup/Workspace/afb-client/dist.dev --sessiondir=/tmp --port=1235</runcommand>
<rundir>build</rundir>
<buildfirst>true</buildfirst>
<terminal-type>0</terminal-type>
/* ------ PUBLIC PLUGIN FUNCTIONS --------- */
-STATIC json_object* power (AFB_request *request) { /* AFB_SESSION_CREATE */
+STATIC json_object* init (AFB_request *request) { /* AFB_SESSION_CREATE */
+
+ radioCtxHandleT *ctx;
+ json_object *jresp;
+
+ /* create a private client context */
+ ctx = initRadioCtx();
+ request->client->ctx = (radioCtxHandleT*)ctx;
+
+ jresp = json_object_new_object();
+ json_object_object_add(jresp, "token", json_object_new_string (request->client->token));
+}
+
+STATIC json_object* power (AFB_request *request) { /* AFB_SESSION_CHECK */
pluginHandleT *handle = request->client->plugin->handle;
radioCtxHandleT *ctx = (radioCtxHandleT*)request->client->ctx;
const char *value = getQueryValue (request, "value");
json_object *jresp;
- /* create a private client context if needed */
- if (!ctx) ctx = initRadioCtx();
-
/* no "?value=" parameter : return current state */
if (!value) {
jresp = json_object_new_object();
radioCtxHandleT *ctx = (radioCtxHandleT*)request->client->ctx;
const char *value = getQueryValue (request, "value");
- json_object *jresp;
+ json_object *jresp = json_object_new_object();
/* no "?value=" parameter : return current state */
if (!value) {
/* radio playback */
ctx->is_playing = 1;
_radio_play (ctx->idx);
-
- jresp = json_object_new_object();
json_object_object_add (jresp, "play", json_object_new_string ("on"));
}
/* radio stop */
ctx->is_playing = 0;
_radio_stop (ctx->idx);
-
- jresp = json_object_new_object();
json_object_object_add (jresp, "play-on", json_object_new_string ("off"));
}
STATIC AFB_restapi pluginApis[]= {
- {"power" , AFB_SESSION_CREATE, (AFB_apiCB)power , "Radio API - power"},
+ {"init" , AFB_SESSION_CREATE, (AFB_apiCB)init , "Radio API - init"},
+ {"power" , AFB_SESSION_CHECK, (AFB_apiCB)power , "Radio API - power"},
{"mode" , AFB_SESSION_CHECK, (AFB_apiCB)mode , "Radio API - mode"},
{"freq" , AFB_SESSION_CHECK, (AFB_apiCB)freq , "Radio API - freq"},
{"mute" , AFB_SESSION_CHECK, (AFB_apiCB)mute , "Radio API - mute"},