summaryrefslogtreecommitdiff
path: root/src/libclient/client.h
blob: 70b5b271c2ea0dfee7d11c919c404251ce1a5842 (plain)
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
#pragma once

#include <nnwt/rpc2.h>

enum {
    CAMU_CLIENT_LOGGED_IN = 0,
    CAMU_CLIENT_SEARCH_CREATED,
    CAMU_CLIENT_GOT_RESULTS,
    CAMU_CLIENT_GOT_META,
    CAMU_CLIENT_GOT_VISUAL_DATA
};

struct camu_client {
    struct nn_event_loop *loop;
    str username;
    struct nn_rpc client;
    struct nn_rpc_connection *conn;
    void (*callback)(void *, u8, void *);
    void *userdata;
};

bool camu_client_login(struct camu_client *client, str *username,
    struct nn_event_loop *loop, u8 type, str *addr, u16 port);

void camu_client_create_list(struct camu_client *client, str *name,
    void (*callback)(void *, struct nn_rpc_connection *conn, struct nn_packet *), void *userdata);
void camu_client_toggle_sink(struct camu_client *client, str *sink, str *list, bool enable,
    void (*callback)(void *, struct nn_rpc_connection *conn, struct nn_packet *), void *userdata);

void camu_client_create_search(struct camu_client *client, str *module, str *query);
void camu_client_get_page(struct camu_client *client, s32 id, u32 num);

void camu_client_request_visual_data(struct camu_client *client, u32 node_id);

void camu_client_skipto(struct camu_client *client, str *list, s32 i);
void camu_client_seek(struct camu_client *client, str *list, u32 id, u64 pos);

void camu_client_disconnect(struct camu_client *client);