Skip to content

Commit

Permalink
Add possibility to perform several actions in 1 click
Browse files Browse the repository at this point in the history
  • Loading branch information
BoubacarDiene committed Jan 27, 2017
1 parent 11c6ff1 commit b740a1d
Show file tree
Hide file tree
Showing 14 changed files with 486 additions and 163 deletions.
4 changes: 2 additions & 2 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ mmstreamer currently includes 4 independent modules :
- Graphics : To locally display video

The application has been designed to make configuring these features as simple as
possible. Unless you have very specific needs, th following xml resources should
possible. Unless you have very specific needs, the following xml resources should
be sufficient to use it :

- res/Main.xml : Choose which modules to launch and how to keep app alive
Expand All @@ -40,7 +40,7 @@ can locally display using "Graphics" module before they are sent to connected c
through "Servers" module.

All kind of clients are supported : Browsers, Applications (VLC, ...)
Connections can also be performed from any type of devices (computers, mobiles).
Connections can also be initiated from any type of devices (computers, mobiles).

mmstreamer provides a dynamic library called "libnet-client-<version>.so" that can be
used to connect and get stream from its servers. However, feel free to implement your
Expand Down
2 changes: 1 addition & 1 deletion build/Makefile.inc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

# Project
PROJECT_NAME := mmstreamer
PROJECT_VERSION := 0.1
PROJECT_VERSION := 0.2

# Path
LOCAL := ${shell pwd}
Expand Down
11 changes: 9 additions & 2 deletions inc/core/Loaders.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ typedef struct XML_SCREEN_S XML_SCREEN_S;
typedef struct XML_ELEMENT_TEXT_S XML_ELEMENT_TEXT_S;
typedef struct XML_ELEMENT_IMAGE_S XML_ELEMENT_IMAGE_S;
typedef struct XML_ELEMENT_NAV_S XML_ELEMENT_NAV_S;
typedef struct XML_ELEMENT_CLICK_S XML_ELEMENT_CLICK_S;
typedef struct XML_ELEMENT_S XML_ELEMENT_S;
typedef struct XML_GRAPHICS_S XML_GRAPHICS_S;

Expand Down Expand Up @@ -214,6 +215,11 @@ struct XML_ELEMENT_NAV_S {
char *down;
};

struct XML_ELEMENT_CLICK_S {
char *name;
char *data;
};

struct XML_ELEMENT_S {
char *name;
char *groupName;
Expand All @@ -235,8 +241,9 @@ struct XML_ELEMENT_S {
XML_ELEMENT_TEXT_S *text;
XML_ELEMENT_IMAGE_S *image;
XML_ELEMENT_NAV_S *nav;

char *clickHandlerName;

uint32_t nbClickHandlers;
XML_ELEMENT_CLICK_S *clickHandlers;
};

struct XML_GRAPHICS_S {
Expand Down
4 changes: 3 additions & 1 deletion inc/core/XmlDefines.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ extern "C" {
#define XML_TAG_CONFIG "Config"
#define XML_TAG_TEXT "Text"
#define XML_TAG_NAV "Nav"
#define XML_TAG_ON_CLICK "OnClick"
#define XML_TAG_HANDLER "Handler"
#define XML_TAG_FOCUS "Focus"
#define XML_TAG_BLUR "Blur"
#define XML_TAG_RESET "Reset"
Expand Down Expand Up @@ -112,7 +114,7 @@ extern "C" {
#define XML_ATTR_CLICKABLE "clickable"
#define XML_ATTR_FOCUSABLE "focusable"
#define XML_ATTR_HAS_FOCUS "hasFocus"
#define XML_ATTR_ON_CLICK "onClick"
#define XML_ATTR_DATA "data"
#define XML_ATTR_SIZE "size"
#define XML_ATTR_LEFT "left"
#define XML_ATTR_UP "up"
Expand Down
3 changes: 2 additions & 1 deletion inc/graphics/Graphics.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ enum GRAPHICS_ERROR_E {
GRAPHICS_ERROR_UNINIT,
GRAPHICS_ERROR_LOCK,
GRAPHICS_ERROR_LIST,
GRAPHICS_ERROR_DRAWER
GRAPHICS_ERROR_DRAWER,
GRAPHICS_ERROR_PARAMS
};

struct GRAPHICS_PARAMS_S {
Expand Down
14 changes: 10 additions & 4 deletions inc/specific/Specific.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ extern "C" {

typedef enum SPECIFIC_ERROR_E SPECIFIC_ERROR_E;

typedef struct SPECIFIC_HANDLERS_S SPECIFIC_HANDLERS_S;
typedef struct SPECIFIC_GETTERS_S SPECIFIC_GETTERS_S;
typedef struct SPECIFIC_TEXT_IDS_S SPECIFIC_TEXT_IDS_S;
typedef struct SPECIFIC_IMAGE_IDS_S SPECIFIC_IMAGE_IDS_S;
Expand All @@ -72,8 +73,8 @@ typedef SPECIFIC_ERROR_E (*SPECIFIC_UNSET_ELEMENT_TEXT_IDS_F)(SPECIFIC_S *obj, v
typedef SPECIFIC_ERROR_E (*SPECIFIC_SET_ELEMENT_IMAGE_IDS_F )(SPECIFIC_S *obj, void *data, SPECIFIC_IMAGE_IDS_S *imageIds);
typedef SPECIFIC_ERROR_E (*SPECIFIC_UNSET_ELEMENT_IMAGE_IDS_F)(SPECIFIC_S *obj, void *data);

typedef SPECIFIC_ERROR_E (*SPECIFIC_SET_CLICK_HANDLER_F )(SPECIFIC_S *obj, void *data, char *clickHandlerName, uint32_t index);
typedef SPECIFIC_ERROR_E (*SPECIFIC_UNSET_CLICK_HANDLER_F)(SPECIFIC_S *obj, void *data);
typedef SPECIFIC_ERROR_E (*SPECIFIC_SET_CLICK_HANDLERS_F )(SPECIFIC_S *obj, void *data, SPECIFIC_HANDLERS_S *handlers, uint32_t nbHandlers, uint32_t index);
typedef SPECIFIC_ERROR_E (*SPECIFIC_UNSET_CLICK_HANDLERS_F)(SPECIFIC_S *obj, void *data);

typedef SPECIFIC_ERROR_E (*SPECIFIC_HANDLE_CLICK_F)(CONTEXT_S *ctx, GFX_EVENT_S *gfxEvent);

Expand All @@ -84,6 +85,11 @@ enum SPECIFIC_ERROR_E {
SPECIFIC_ERROR_PARAMS
};

struct SPECIFIC_HANDLERS_S {
char *name;
char *data;
};

struct SPECIFIC_GETTERS_S {
SPECIFIC_GET_STRING_F getString;
SPECIFIC_GET_COLOR_F getColor;
Expand Down Expand Up @@ -120,8 +126,8 @@ struct SPECIFIC_S {
SPECIFIC_SET_ELEMENT_IMAGE_IDS_F setElementImageIds;
SPECIFIC_UNSET_ELEMENT_IMAGE_IDS_F unsetElementImageIds;

SPECIFIC_SET_CLICK_HANDLER_F setClickHandler;
SPECIFIC_UNSET_CLICK_HANDLER_F unsetClickHandler;
SPECIFIC_SET_CLICK_HANDLERS_F setClickHandlers;
SPECIFIC_UNSET_CLICK_HANDLERS_F unsetClickHandlers;

SPECIFIC_HANDLE_CLICK_F handleClick;

Expand Down
6 changes: 3 additions & 3 deletions res/Main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@
Note: Attribute timeout_s="<value in seconds>" is ignored if
method is not Timer_based.
-->
<General appDataDir="/tmp/" xmlRootDir="./out/mmstreamer/res/" keepAliveMethod="0" timeout_s="10" />
<General appDataDir="/tmp/mmstreamer" xmlRootDir="./out/mmstreamer/res/" keepAliveMethod="0" timeout_s="10" />

<!--
Modules
4 independant modules are currently defined:
4 independent modules are currently defined:
+ Video : Capture video signal from video devices
+ Servers : Stream video frames using unix or inet socket
Expand All @@ -54,7 +54,7 @@
You can start it whenever and where you want
1 => Automatic start i.e iniatialized and started in Main.c
Note: autoStart="1" does not need change an update of the source
Note: autoStart="1" => No need to update the source
code as it is already handled (Cf. Main.c)
- xmlFile : Path to the config file of the module
Expand Down
31 changes: 24 additions & 7 deletions res/configs/Graphics.xml
Original file line number Diff line number Diff line change
Expand Up @@ -115,44 +115,61 @@
up <=> Element at top of current element which gains focus when user moves up
right <=> Element at right of current element which gains focus when user moves to right
down <=> Element at bottom of current element which gains focus when user moves down
OnClick : Handlers are called seuentially according to their order of definition
-->
<Elements>
<Element name="videoZone" group="videoView" redrawGroup="1" type="0" x="160" y="160" width="640" height="480">
<Config visible="1" clickable="0" focusable="0" hasFocus="0" onClick="" />
<Config visible="1" clickable="0" focusable="0" hasFocus="0" />
</Element>

<Element name="imageBtn" group="videoView" redrawGroup="1" type="1" x="200" y="200" width="100" height="100">
<Config visible="0" clickable="0" focusable="0" hasFocus="0" onClick="" />
<Config visible="0" clickable="0" focusable="0" hasFocus="0" />
<Image imageId="0" hiddenColorId="1" />
</Element>

<Element name="textBtn1" group="menu" redrawGroup="0" type="2" x="20" y="20" width="100" height="100">
<Config visible="1" clickable="1" focusable="1" hasFocus="1" onClick="closeApplication" />
<Config visible="1" clickable="1" focusable="1" hasFocus="1" />
<Text stringId="0" fontId="2" colorId="6" size="15" />
<Nav left="" up="textBtn3" right="" down="imageBtn1" />
<OnClick>
<Handler name="closeApplication" data="" />
</OnClick>
</Element>

<Element name="imageBtn1" group="menu" redrawGroup="0" type="1" x="20" y="200" width="100" height="100">
<Config visible="1" clickable="1" focusable="1" hasFocus="0" onClick="hideIcon" />
<Config visible="1" clickable="1" focusable="1" hasFocus="0" />
<Image imageId="0" hiddenColorId="1" />
<Nav left="" up="textBtn1" right="" down="textBtn2" />
<OnClick>
<Handler name="takeScreenshot" data="0" />
</OnClick>
</Element>

<Element name="textBtn2" group="menu" redrawGroup="0" type="2" x="20" y="380" width="100" height="100">
<Config visible="1" clickable="1" focusable="1" hasFocus="0" onClick="changeLanguage" />
<Config visible="1" clickable="1" focusable="1" hasFocus="0" />
<Text stringId="1" fontId="1" colorId="0" size="15" />
<Nav left="" up="imageBtn1" right="" down="textBtn3" />
<OnClick>
<Handler name="changeLanguage" data="" />
</OnClick>
</Element>

<Element name="textBtn3" group="menu" redrawGroup="0" type="2" x="20" y="560" width="100" height="100">
<Config visible="1" clickable="1" focusable="1" hasFocus="0" onClick="showIcon" />
<Config visible="1" clickable="1" focusable="1" hasFocus="0" />
<Text stringId="2" fontId="2" colorId="1" size="20" />
<Nav left="" up="textBtn2" right="" down="textBtn1" />
<OnClick>
<Handler name="showElement" data="imageBtn" />
</OnClick>
</Element>

<Element name="textTitle1" group="title" redrawGroup="0" type="2" x="260" y="50" width="100" height="50">
<Config visible="1" clickable="0" focusable="0" hasFocus="0" onClick="stopVideo" />
<Config visible="1" clickable="0" focusable="0" hasFocus="0" />
<Text stringId="4" fontId="2" colorId="2" size="20" />
<OnClick>
<Handler name="stopVideo" data="" />
</OnClick>
</Element>
</Elements>

Expand Down
9 changes: 5 additions & 4 deletions src/core/Core.c
Original file line number Diff line number Diff line change
Expand Up @@ -411,8 +411,9 @@ static CORE_ERROR_E loadGraphicsParams_f(CORE_S *obj)

(void)pData->specificObj->setElementGetters(pData->specificObj, (*gfxElements)[index]->pData, &getters);

(void)pData->specificObj->setClickHandler(pData->specificObj, (*gfxElements)[index]->pData,
xmlGraphics->elements[index].clickHandlerName, index);
(void)pData->specificObj->setClickHandlers(pData->specificObj, (*gfxElements)[index]->pData,
(SPECIFIC_HANDLERS_S*)xmlGraphics->elements[index].clickHandlers,
xmlGraphics->elements[index].nbClickHandlers, index);

if (graphicsObj->pushElement(graphicsObj, (*gfxElements)[index]) != GRAPHICS_ERROR_NONE) {
Loge("Failed to push element \"%s\"", (*gfxElements)[index]->name);
Expand All @@ -435,7 +436,7 @@ static CORE_ERROR_E loadGraphicsParams_f(CORE_S *obj)
for (index = 0; index < *nbGfxElements; index++) {
if ((*gfxElements)[index]) {
if ((*gfxElements)[index]->pData) {
(void)pData->specificObj->unsetClickHandler(pData->specificObj, (*gfxElements)[index]->pData);
(void)pData->specificObj->unsetClickHandlers(pData->specificObj, (*gfxElements)[index]->pData);
(void)pData->specificObj->unsetElementGetters(pData->specificObj, (*gfxElements)[index]->pData);
(void)pData->specificObj->unsetElementTextIds(pData->specificObj, (*gfxElements)[index]->pData);
(void)pData->specificObj->unsetElementImageIds(pData->specificObj, (*gfxElements)[index]->pData);
Expand Down Expand Up @@ -489,7 +490,7 @@ static CORE_ERROR_E unloadGraphicsParams_f(CORE_S *obj)
for (index = 0; index < nbGfxElements; index++) {
if ((*gfxElements)[index]) {
if ((*gfxElements)[index]->pData) {
(void)pData->specificObj->unsetClickHandler(pData->specificObj, (*gfxElements)[index]->pData);
(void)pData->specificObj->unsetClickHandlers(pData->specificObj, (*gfxElements)[index]->pData);
(void)pData->specificObj->unsetElementGetters(pData->specificObj, (*gfxElements)[index]->pData);
(void)pData->specificObj->unsetElementTextIds(pData->specificObj, (*gfxElements)[index]->pData);
(void)pData->specificObj->unsetElementImageIds(pData->specificObj, (*gfxElements)[index]->pData);
Expand Down
Loading

0 comments on commit b740a1d

Please sign in to comment.