1 #include "lightserver_mqtt_plugin.h"
2 #include "lightserver.h"
4 #include <pthread.h> // 2
6 //int start_fanserver(void*); // 1
7 void *start_lightserver(void *d); // 2
9 typedef struct plugin_data_t plugin_data_t;
14 pthread_t m_thread; // 2
25 static void *create(cp_context_t *ctx)
27 plugin_data_t *data = (plugin_data_t *)malloc(sizeof(plugin_data_t));
36 printf("[MQTT] ERROR: Plug-in Data - NULL\n");
42 static int start(void *d)
44 plugin_data_t *data = (plugin_data_t *)d;
46 //data->str = (void *)cp_resolve_symbol(data->ctx, "lightserver_mqtt_plugin", "START_ARGUMENT", NULL);
48 //cp_run_function(data->ctx, (cp_run_func_t)start_fanserver); // 1
49 pthread_create(&(data->m_thread), NULL, start_lightserver, data); // 2
53 static void stop(void *d)
55 printf("function_stop\n");
56 plugin_data_t *data = (plugin_data_t *)d;
59 //cp_release_symbol(data->ctx, data->str);
60 pthread_join(data->m_thread, (void **)NULL);
63 static void destroy(void *d)
65 printf("function_destroy\n");
66 plugin_data_t *data = (plugin_data_t *)d;
70 CP_EXPORT cp_plugin_runtime_t mqtt_plugin_lightserver_funcs =