mirror of
https://github.com/JamesonHuang/OpenWrt_Luci_Lua.git
synced 2025-06-19 01:30:37 +00:00
update more
This commit is contained in:
12
1_8.sip_push/nebula_sdk/sdk/test/Makefile
Normal file
12
1_8.sip_push/nebula_sdk/sdk/test/Makefile
Normal file
@ -0,0 +1,12 @@
|
||||
CC=gcc
|
||||
CFALGS=-g
|
||||
INCLUDES=-I..
|
||||
LINK=-L.. -lnebula_sdk
|
||||
|
||||
test:test.c
|
||||
$(CC) $(CFALGS) $^ -o $@ $(INCLUDES) $(LINK)
|
||||
|
||||
.PHONY: clean
|
||||
|
||||
clean:
|
||||
rm test -f
|
5
1_8.sip_push/nebula_sdk/sdk/test/data
Normal file
5
1_8.sip_push/nebula_sdk/sdk/test/data
Normal file
@ -0,0 +1,5 @@
|
||||
2
|
||||
com.meizu.cloud
|
||||
com.meizu.router
|
||||
1
|
||||
R10WZOANC5400EE&0 21
|
BIN
1_8.sip_push/nebula_sdk/sdk/test/libnebula_sdk.so
Normal file
BIN
1_8.sip_push/nebula_sdk/sdk/test/libnebula_sdk.so
Normal file
Binary file not shown.
56
1_8.sip_push/nebula_sdk/sdk/test/nebula_sdk/nebula_sdk.h
Normal file
56
1_8.sip_push/nebula_sdk/sdk/test/nebula_sdk/nebula_sdk.h
Normal file
@ -0,0 +1,56 @@
|
||||
#ifndef NEBULA_SDK_H
|
||||
#define NEBULA_SDK_H
|
||||
|
||||
typedef enum {
|
||||
eNebulaMsg_Push, /// 推送 (路由器只需关心这一类消息)
|
||||
eNebulaMsg_Presence, /// Presence
|
||||
eNebulaMsg_Sms, /// 网络短信
|
||||
eNebulaMsg_Mms, /// 网络彩信
|
||||
eNebulaMsg_Max,
|
||||
} NebulaMsgType;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** 初始化网络连接
|
||||
* @device_tag: 硬件信息 (手机端为IMEI)
|
||||
* @verify_pwd: 鉴权密码 (手机端为SN)
|
||||
* @host: 服务端域名, 例如: https://p.meizu.com (结尾不要带"/", 前面要加上https)
|
||||
* @file: 用于读取/存储持久化数据的文件名, 要求目录存在, 且有创建文件权限。
|
||||
* @return: 如果文件打开成功, 返回0; 否则返回-1, 文件打开失败原因记录在错误码errno中.
|
||||
* @只能调用一次, 重复调用无效并返回-1.
|
||||
*/
|
||||
int NebulaInit(const char* device_tag, const char* host, const char* file);
|
||||
|
||||
/** 设置订阅列表
|
||||
*
|
||||
*
|
||||
*/
|
||||
void NebulaSubScribe(int count, const char** app_name);
|
||||
|
||||
/** 消息处理回调函数
|
||||
* @app: App名
|
||||
* @msg: 消息内容
|
||||
*/
|
||||
typedef void (*NebulaMsgCallback)(const char* app, const char* msg);
|
||||
|
||||
/** 注册消息处理回调函数
|
||||
* @type: 消息类型
|
||||
* @cb: 回调函数
|
||||
* @return: 旧的回调函数
|
||||
* @一次只能注册一个回调函数, 重复注册会覆盖.
|
||||
*/
|
||||
NebulaMsgCallback NebulaRegister(NebulaMsgType type, NebulaMsgCallback cb);
|
||||
|
||||
/** 启动
|
||||
*
|
||||
*/
|
||||
int NebulaStart();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif //NEBULA_SDK_H
|
||||
|
56
1_8.sip_push/nebula_sdk/sdk/test/nebula_sdk/nebula_sdk.h.old
Normal file
56
1_8.sip_push/nebula_sdk/sdk/test/nebula_sdk/nebula_sdk.h.old
Normal file
@ -0,0 +1,56 @@
|
||||
#ifndef NEBULA_SDK_H
|
||||
#define NEBULA_SDK_H
|
||||
|
||||
typedef enum {
|
||||
eNebulaMsg_Push, /// 推送 (路由器只需关心这一类消息)
|
||||
eNebulaMsg_Presence, /// Presence
|
||||
eNebulaMsg_Sms, /// 网络短信
|
||||
eNebulaMsg_Mms, /// 网络彩信
|
||||
eNebulaMsg_Max,
|
||||
} NebulaMsgType;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** 初始化网络连接
|
||||
* @device_tag: 硬件信息 (手机端为IMEI)
|
||||
* @verify_pwd: 鉴权密码 (手机端为SN)
|
||||
* @host: 服务端域名, 例如: https://p.meizu.com (结尾不要带"/", 前面要加上https)
|
||||
* @file: 用于读取/存储持久化数据的文件名, 要求目录存在, 且有创建文件权限。
|
||||
* @return: 如果文件打开成功, 返回0; 否则返回-1, 文件打开失败原因记录在错误码errno中.
|
||||
* @只能调用一次, 重复调用无效并返回-1.
|
||||
*/
|
||||
int NebulaInit(const char* device_tag, const char* host, const char* file);
|
||||
|
||||
/** 设置订阅列表
|
||||
*
|
||||
*
|
||||
*/
|
||||
void NebulaSubScribe(int count, const char** app_name);
|
||||
|
||||
/** 消息处理回调函数
|
||||
* @data: 数据块起始指针
|
||||
* @len: 数据块长度
|
||||
*/
|
||||
typedef void (*NebulaMsgCallback)(const char* data, int len);
|
||||
|
||||
/** 注册消息处理回调函数
|
||||
* @type: 消息类型
|
||||
* @cb: 回调函数
|
||||
* @return: 旧的回调函数
|
||||
* @一次只能注册一个回调函数, 重复注册会覆盖.
|
||||
*/
|
||||
NebulaMsgCallback NebulaRegister(NebulaMsgType type, NebulaMsgCallback cb);
|
||||
|
||||
/** 启动
|
||||
*
|
||||
*/
|
||||
int NebulaStart();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif //NEBULA_SDK_H
|
||||
|
BIN
1_8.sip_push/nebula_sdk/sdk/test/old.libnebula_sdk.so
Executable file
BIN
1_8.sip_push/nebula_sdk/sdk/test/old.libnebula_sdk.so
Executable file
Binary file not shown.
BIN
1_8.sip_push/nebula_sdk/sdk/test/org.test
Executable file
BIN
1_8.sip_push/nebula_sdk/sdk/test/org.test
Executable file
Binary file not shown.
20
1_8.sip_push/nebula_sdk/sdk/test/tags
Normal file
20
1_8.sip_push/nebula_sdk/sdk/test/tags
Normal file
@ -0,0 +1,20 @@
|
||||
!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/
|
||||
!_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/
|
||||
!_TAG_PROGRAM_AUTHOR Darren Hiebert /dhiebert@users.sourceforge.net/
|
||||
!_TAG_PROGRAM_NAME Exuberant Ctags //
|
||||
!_TAG_PROGRAM_URL http://ctags.sourceforge.net /official site/
|
||||
!_TAG_PROGRAM_VERSION 5.9~svn20110310 //
|
||||
CC Makefile /^CC=gcc$/;" m
|
||||
CFALGS Makefile /^CFALGS=-g$/;" m
|
||||
INCLUDES Makefile /^INCLUDES=-I..$/;" m
|
||||
LINK Makefile /^LINK=-L.. -lnebula_sdk$/;" m
|
||||
NEBULA_SDK_H nebula_sdk/nebula_sdk.h 2;" d
|
||||
NebulaMsgCallback nebula_sdk/nebula_sdk.h /^ typedef void (*NebulaMsgCallback)(const char* app, const char* msg);$/;" t
|
||||
NebulaMsgType nebula_sdk/nebula_sdk.h /^} NebulaMsgType;$/;" t typeref:enum:__anon1
|
||||
OnPush test.c /^void OnPush(const char* app, const char *msg)$/;" f
|
||||
eNebulaMsg_Max nebula_sdk/nebula_sdk.h /^ eNebulaMsg_Max,$/;" e enum:__anon1
|
||||
eNebulaMsg_Mms nebula_sdk/nebula_sdk.h /^ eNebulaMsg_Mms, \/\/\/ 网络彩信$/;" e enum:__anon1
|
||||
eNebulaMsg_Presence nebula_sdk/nebula_sdk.h /^ eNebulaMsg_Presence, \/\/\/ Presence$/;" e enum:__anon1
|
||||
eNebulaMsg_Push nebula_sdk/nebula_sdk.h /^ eNebulaMsg_Push, \/\/\/ 推送 (路由器只需关心这一类消息)$/;" e enum:__anon1
|
||||
eNebulaMsg_Sms nebula_sdk/nebula_sdk.h /^ eNebulaMsg_Sms, \/\/\/ 网络短信$/;" e enum:__anon1
|
||||
main test.c /^int main()$/;" f
|
74
1_8.sip_push/nebula_sdk/sdk/test/test.c
Normal file
74
1_8.sip_push/nebula_sdk/sdk/test/test.c
Normal file
@ -0,0 +1,74 @@
|
||||
#include "nebula_sdk/nebula_sdk.h"
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <netinet/in.h>
|
||||
#include <sys/resource.h>
|
||||
#include <limits.h>
|
||||
|
||||
/*
|
||||
*void OnPush(const char* data, int len)
|
||||
*{
|
||||
* char *body = strndup(data, len);
|
||||
* printf("karldbg %s %d\n", __func__, len);
|
||||
* do {
|
||||
* int cnt = 0;
|
||||
* for(cnt=0; cnt<len; cnt++) {
|
||||
* printf("karldbg %s pos: 0x%02x, 0x%02x, %c\n", __func__, cnt, (char)*(body+cnt), *(body+cnt));
|
||||
* }
|
||||
* } while(0);
|
||||
* printf("recv push:%s\n", body);
|
||||
* free(body);
|
||||
*}
|
||||
*/
|
||||
|
||||
void OnPush(const char* app, const char *msg)
|
||||
{
|
||||
printf("karldbg %s %d %s\n", __func__, __LINE__, app);
|
||||
printf("karldbg %s %d %s\n", __func__, __LINE__, msg);
|
||||
/*
|
||||
*do {
|
||||
* int cnt = 0;
|
||||
* for(cnt=0; cnt<len; cnt++) {
|
||||
* printf("karldbg %s pos: 0x%02x, 0x%02x, %c\n", __func__, cnt, (char)*(body+cnt), *(body+cnt));
|
||||
* }
|
||||
*} while(0);
|
||||
*/
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
//??
|
||||
struct rlimit no_limit = {RLIM_INFINITY, RLIM_INFINITY};
|
||||
setrlimit(RLIMIT_CORE, &no_limit);
|
||||
|
||||
/*if (-1 == NebulaInit("1000000010000001", "https://172.16.82.71", "data")) {*/
|
||||
if (-1 == NebulaInit("R10WZOANC5400EE", "https://172.16.82.71", "data")) {
|
||||
printf("Init error.\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*const char * apps[] = {"com.meizu.cloud"};*/
|
||||
const char * apps[] = {"com.meizu.router"};
|
||||
|
||||
NebulaSubScribe(1, apps);
|
||||
|
||||
NebulaMsgCallback cb = OnPush;
|
||||
|
||||
/*NebulaRegister(eNebulaMsg_Push, &OnPush);*/
|
||||
NebulaRegister(eNebulaMsg_Push, cb);
|
||||
|
||||
if (-1 == NebulaStart()) {
|
||||
printf("Start error.\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
printf("start success.\n");
|
||||
|
||||
for (;;)
|
||||
sleep(1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user