TLMoto / Nextion

Dependents:   Display

Revision:
1:e4163fd9aa4c
Parent:
0:67bae57e0b73
diff -r 67bae57e0b73 -r e4163fd9aa4c NexObject.h
--- a/NexObject.h	Wed Apr 15 17:02:54 2020 +0000
+++ b/NexObject.h	Mon May 04 17:52:49 2020 +0000
@@ -1,84 +1,20 @@
-/**
- * @file NexObject.h
- *
- * The definition of class NexObject. 
- *
- * @author Wu Pengfei (email:<pengfei.wu@itead.cc>)
- * @date 2015/8/13
- *
- * @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 __NEXOBJECT_H__
 #define __NEXOBJECT_H__
-//#include <Arduino.h>
+#include "mbed.h"
 #include "NexConfig.h"
-/**
- * @addtogroup CoreAPI 
- * @{ 
- */
+#include "Utilities.h"
 
-/**
- * Root class of all Nextion components. 
- *
- * Provides the essential attributes of a Nextion component and the methods accessing
- * them. At least, Page ID(pid), Component ID(pid) and an unique name are needed for
- * creating a component in Nexiton library. 
- */
-class NexObject 
-{
-public: /* methods */
-
-    /**
-     * Constructor. 
-     *
-     * @param pid - page id. 
-     * @param cid - component id.    
-     * @param name - pointer to an unique name in range of all components. 
-     */
-    NexObject(uint8_t pid, uint8_t cid, const char *name);
-
-    /**
-     * Print current object'address, page id, component id and name. 
-     *
-     * @warning this method does nothing, unless debug message enabled. 
-     */
-    void printObjInfo(void);
+typedef void (*NexTouchEventCb)(void *ptr);
 
-protected: /* methods */
-
-    /*
-     * Get page id.
-     *
-     * @return the id of page.  
-     */
-    uint8_t getObjPid(void);    
-
-    /*
-     * Get component id.
-     *
-     * @return the id of component.  
-     */
-    uint8_t getObjCid(void);
+struct NexObject
+{
+    uint8_t __pid;      /* Page ID */
+    uint8_t __cid;      /* Component ID */
+    char __name[16]; /* An unique name */
+    NexTouchEventCb __cb_push;
+    void *__cbpush_ptr;
+    NexTouchEventCb __cb_pop;
+    void *__cbpop_ptr;
+};
 
-    /*
-     * Get component name.
-     *
-     * @return the name of component. 
-     */
-    const char *getObjName(void);    
-    
-private: /* data */ 
-    uint8_t __pid; /* Page ID */
-    uint8_t __cid; /* Component ID */
-    const char *__name; /* An unique name */
-};
-/**
- * @}
- */
-
-#endif /* #ifndef __NEXOBJECT_H__ */
\ No newline at end of file
+#endif
\ No newline at end of file