/
main.cc
79 lines (66 loc) · 2.26 KB
/
main.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
//-------------------------------------------------------------------------------------------------
// File : main.cc
// Author : Eric Liang <eric@bmxlabs.com>
// Purpose : bmx embedded demo file.
// Created : 12 Sep 24 by Eric Liang <eric@bmxlabs.com>
//-------------------------------------------------------------------------------------------------
//
// Copyright (C) 2018-2019 MaxIM.Top
//
// You may obtain a copy of the licence at http://www.maxim.top/LICENCE-MAXIM.md
//
//-------------------------------------------------------------------------------------------------
#include "global.h"
#include "bmx_cursor.h"
using namespace floo;
using namespace std;
/*
测试账号 密码
maximtest1 1 6597271134048
maximtest2 1 6597271134656
*/
void initSDK() {
std::string path = "/home/jwfan/code/bmx/lanying-im-embedded/test/data";
config = BMXSDKConfigPtr(new BMXSDKConfig(BMXClientType::Linux, "", path, path, "3.0", "1234", "userAgent"));
config->setAppID("welovemaxim");
config->setDBCryptoKey("testkey");
config->setDeviceUuid("b81f412e-fcb2-44fb-9f44-5e8e5b1e809e");
config->setConsoleOutput(false);
config->setLogLevel(BMXLogLevel::Debug);
client = BMXClient::create(config);
chatListener = new ChatListener();
chatListener->setClient(client);
userListener = new UserListener();
userListener->setClient(client);
rosterListener = new RosterListener();
rosterListener->setClient(client);
groupListener = new GroupListener();
groupListener->setClient(client);
}
int main(int argc, char* argv[])
{
initSDK();
initWindow();
int key;
do {
WINDOW **menu_items;
key = getch();
if (key == KEY_F(1)) {
menu_items = draw_chat_menu(0);
scroll_chat_menu(menu_items, CHAT_MENU_SIZE - 1);
} else if (key == KEY_F(2)) {
menu_items = draw_user_menu(10);
scroll_user_menu(menu_items, USER_MENU_SIZE - 1);
} else if (key == KEY_F(3)) {
menu_items = draw_roster_menu(20);
scroll_roster_menu(menu_items, ROSTER_MENU_SIZE - 1);
} else if (key == KEY_F(4)) {
menu_items = draw_group_menu(30);
scroll_group_menu(menu_items, GROUP_MENU_SIZE - 1);
}
touchwin(stdscr);
refresh();
} while (key!=ESCAPE);
deleteWindow();
return 0;
}