-
Notifications
You must be signed in to change notification settings - Fork 323
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
2,049 additions
and
1,405 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,84 @@ | ||
#include "NexButton.h" | ||
|
||
NexButton::NexButton(NexPid pid, NexCid cid, char *name, NexTouchEventCb pop, void *pop_ptr) | ||
:NexTouch(pid, cid, name, pop, pop_ptr) | ||
{ | ||
} | ||
|
||
uint16_t NexButton::getText(char *buffer, uint16_t len) | ||
{ | ||
String cmd; | ||
cmd += "get "; | ||
cmd += getObjName(); | ||
cmd += ".txt"; | ||
sendCommand(cmd.c_str()); | ||
return recvRetString(buffer,len); | ||
} | ||
|
||
bool NexButton::setText(const char *buffer) | ||
{ | ||
String cmd; | ||
cmd += getObjName(); | ||
cmd += ".txt=\""; | ||
cmd += buffer; | ||
cmd += "\""; | ||
sendCommand(cmd.c_str()); | ||
return recvRetCommandFinished(); | ||
} | ||
|
||
void NexButton::attachPop(NexTouchEventCb pop, void *ptr) | ||
{ | ||
NexTouch::attachPop(pop, ptr); | ||
} | ||
|
||
void NexButton::detachPop(void) | ||
{ | ||
NexTouch::detachPop(); | ||
} | ||
|
||
|
||
/** | ||
* @file NexButton.cpp | ||
* | ||
* API of NexButton. | ||
* | ||
* @author Wu Pengfei (email:<[email protected]>) | ||
* @date 2015/7/10 | ||
* @copyright | ||
* Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public License as | ||
* published by the Free Software Foundation; either version 2 of | ||
* the License, or (at your option) any later version. | ||
*/ | ||
|
||
#include "NexButton.h" | ||
|
||
/** | ||
* Constructor,inherited NexTouch's constructor function. | ||
* | ||
*/ | ||
NexButton::NexButton(NexPid pid, NexCid cid, char *name, NexTouchEventCb pop, void *pop_ptr) | ||
:NexTouch(pid, cid, name, pop, pop_ptr) | ||
{ | ||
} | ||
|
||
/** | ||
* Get text value from button component. | ||
* | ||
* @param buffer - text buffer. | ||
* @param len - text buffer length. | ||
* | ||
* @return the text buffer length | ||
*/ | ||
uint16_t NexButton::getText(char *buffer, uint16_t len) | ||
{ | ||
String cmd; | ||
cmd += "get "; | ||
cmd += getObjName(); | ||
cmd += ".txt"; | ||
sendCommand(cmd.c_str()); | ||
return recvRetString(buffer,len); | ||
} | ||
|
||
/** | ||
* Set text value of button component. | ||
* | ||
* @param buffer - text buffer. | ||
* | ||
* @retval true - success. | ||
* @retval false - failed. | ||
*/ | ||
bool NexButton::setText(const char *buffer) | ||
{ | ||
String cmd; | ||
cmd += getObjName(); | ||
cmd += ".txt=\""; | ||
cmd += buffer; | ||
cmd += "\""; | ||
sendCommand(cmd.c_str()); | ||
return recvRetCommandFinished(); | ||
} | ||
|
||
/** | ||
* Register button pop callback function. | ||
* | ||
* @param pop - the pointer to button pop callback function. | ||
* @param ptr - the parameter to be transmitted to button pop callback function. | ||
*/ | ||
void NexButton::attachPop(NexTouchEventCb pop, void *ptr) | ||
{ | ||
NexTouch::attachPop(pop, ptr); | ||
} | ||
|
||
/** | ||
* Unload button pop callback function. | ||
* | ||
*/ | ||
void NexButton::detachPop(void) | ||
{ | ||
NexTouch::detachPop(); | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,38 @@ | ||
#ifndef __NEXBUTTON_H__ | ||
#define __NEXBUTTON_H__ | ||
#ifdef __cplusplus | ||
#include "NexTouch.h" | ||
|
||
|
||
/* | ||
* Button | ||
*/ | ||
class NexButton: public NexTouch | ||
{ | ||
public: /* methods */ | ||
NexButton(NexPid pid, NexCid cid, char *name, NexTouchEventCb pop = NULL, void *pop_ptr = NULL); | ||
|
||
void attachPop(NexTouchEventCb pop, void *ptr = NULL); | ||
void detachPop(void); | ||
|
||
uint16_t getText(char *buffer, uint16_t len); | ||
bool setText(const char *buffer); | ||
}; | ||
|
||
#endif /* #ifdef __cplusplus */ | ||
#endif /* #ifndef __NEXBUTTON_H__ */ | ||
/** | ||
* @file NexButton.h | ||
* | ||
* API of NexButton. | ||
* | ||
* @author Wu Pengfei (email:<[email protected]>) | ||
* @date 2015/7/10 | ||
* @copyright | ||
* Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public License as | ||
* published by the Free Software Foundation; either version 2 of | ||
* the License, or (at your option) any later version. | ||
*/ | ||
|
||
#ifndef __NEXBUTTON_H__ | ||
#define __NEXBUTTON_H__ | ||
#ifdef __cplusplus | ||
#include "NexTouch.h" | ||
|
||
/** | ||
* NexButton,subclass of NexTouch,provides simple methods to control button component. | ||
* | ||
*/ | ||
class NexButton: public NexTouch | ||
{ | ||
public: /* methods */ | ||
NexButton(NexPid pid, NexCid cid, char *name, NexTouchEventCb pop = NULL, void *pop_ptr = NULL); | ||
|
||
void attachPop(NexTouchEventCb pop, void *ptr = NULL); | ||
void detachPop(void); | ||
|
||
uint16_t getText(char *buffer, uint16_t len); | ||
bool setText(const char *buffer); | ||
}; | ||
|
||
#endif /* #ifdef __cplusplus */ | ||
#endif /* #ifndef __NEXBUTTON_H__ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,67 @@ | ||
#include "NexHotspot.h" | ||
|
||
NexHotspot::NexHotspot(NexPid pid, NexCid cid, char *name, | ||
NexTouchEventCb pop, void *pop_ptr, | ||
NexTouchEventCb push, void *push_ptr) | ||
:NexTouch(pid, cid, name, pop, pop_ptr, push, push_ptr) | ||
{ | ||
} | ||
|
||
void NexHotspot::attachPush(NexTouchEventCb push, void *ptr) | ||
{ | ||
NexTouch::attachPush(push, ptr); | ||
} | ||
|
||
void NexHotspot::detachPush(void) | ||
{ | ||
NexTouch::detachPush(); | ||
} | ||
|
||
void NexHotspot::attachPop(NexTouchEventCb pop, void *ptr) | ||
{ | ||
NexTouch::attachPop(pop, ptr); | ||
} | ||
|
||
void NexHotspot::detachPop(void) | ||
{ | ||
NexTouch::detachPop(); | ||
} | ||
/** | ||
* @file NexHotspot.cpp | ||
* | ||
* API of NexHotspot. | ||
* | ||
* @author Wu Pengfei (email:<[email protected]>) | ||
* @date 2015/7/10 | ||
* @copyright | ||
* Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public License as | ||
* published by the Free Software Foundation; either version 2 of | ||
* the License, or (at your option) any later version. | ||
*/ | ||
|
||
#include "NexHotspot.h" | ||
|
||
/** | ||
* Constructor,inherited NexTouch's constructor function. | ||
* | ||
*/ | ||
NexHotspot::NexHotspot(NexPid pid, NexCid cid, char *name, | ||
NexTouchEventCb pop, void *pop_ptr, | ||
NexTouchEventCb push, void *push_ptr) | ||
:NexTouch(pid, cid, name, pop, pop_ptr, push, push_ptr) | ||
{ | ||
} | ||
|
||
/** | ||
* Register hotspot push callback function. | ||
* | ||
* @param pop - the pointer to hotspot push callback function. | ||
* @param ptr - the parameter to be transmitted to hotspot push callback function. | ||
*/ | ||
void NexHotspot::attachPush(NexTouchEventCb push, void *ptr) | ||
{ | ||
NexTouch::attachPush(push, ptr); | ||
} | ||
|
||
/** | ||
* Unload hotsopt push callback function. | ||
* | ||
*/ | ||
void NexHotspot::detachPush(void) | ||
{ | ||
NexTouch::detachPush(); | ||
} | ||
|
||
/** | ||
* Register hotspot pop callback function. | ||
* | ||
* @param pop - the pointer to hotspot pot callback function. | ||
* @param ptr - the parameter to be transmitted to hotspot pop callback function. | ||
*/ | ||
void NexHotspot::attachPop(NexTouchEventCb pop, void *ptr) | ||
{ | ||
NexTouch::attachPop(pop, ptr); | ||
} | ||
|
||
/** | ||
* Unload hotsopt pop callback function. | ||
* | ||
*/ | ||
void NexHotspot::detachPop(void) | ||
{ | ||
NexTouch::detachPop(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,40 @@ | ||
#ifndef __NEXHOTSPOT_H__ | ||
#define __NEXHOTSPOT_H__ | ||
#ifdef __cplusplus | ||
#include "NexTouch.h" | ||
|
||
|
||
/* | ||
* Hotspot | ||
*/ | ||
class NexHotspot: public NexTouch | ||
{ | ||
public: /* methods */ | ||
NexHotspot(NexPid pid, NexCid cid, char *name, | ||
NexTouchEventCb pop = NULL, void *pop_ptr = NULL, | ||
NexTouchEventCb push = NULL, void *push_ptr = NULL); | ||
|
||
void attachPush(NexTouchEventCb push, void *ptr = NULL); | ||
void detachPush(void); | ||
void attachPop(NexTouchEventCb pop, void *ptr = NULL); | ||
void detachPop(void); | ||
|
||
}; | ||
|
||
#endif /* #ifdef __cplusplus */ | ||
#endif /* #ifndef __NEXHOTSPOT_H__ */ | ||
/** | ||
* @file NexHotspot.h | ||
* | ||
* API of NexHotspot. | ||
* | ||
* @author Wu Pengfei (email:<[email protected]>) | ||
* @date 2015/7/10 | ||
* @copyright | ||
* Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public License as | ||
* published by the Free Software Foundation; either version 2 of | ||
* the License, or (at your option) any later version. | ||
*/ | ||
|
||
#ifndef __NEXHOTSPOT_H__ | ||
#define __NEXHOTSPOT_H__ | ||
#ifdef __cplusplus | ||
#include "NexTouch.h" | ||
|
||
/** | ||
* NexHotspot,subclass of NexTouch,provides simple methods to control hotspot component. | ||
* | ||
*/ | ||
class NexHotspot: public NexTouch | ||
{ | ||
public: /* methods */ | ||
NexHotspot(NexPid pid, NexCid cid, char *name, | ||
NexTouchEventCb pop = NULL, void *pop_ptr = NULL, | ||
NexTouchEventCb push = NULL, void *push_ptr = NULL); | ||
|
||
void attachPush(NexTouchEventCb push, void *ptr = NULL); | ||
void detachPush(void); | ||
void attachPop(NexTouchEventCb pop, void *ptr = NULL); | ||
void detachPop(void); | ||
|
||
}; | ||
|
||
#endif /* #ifdef __cplusplus */ | ||
#endif /* #ifndef __NEXHOTSPOT_H__ */ |
Oops, something went wrong.