blob: 69f6ba38472d84b137e6afd9170f61c4b031b2b0 (
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
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
|
#include "devdetails.h"
#include "functions.h"
#include <pthread.h>
#include <string.h>
#include <assert.h>
#include <stdbool.h>
#include <libusb-1.0/libusb.h>
// #include <stdlib.h>
// #include <stdio.h>
#include <hidapi/hidapi.h>
#include <pthread.h>
#include "util.h"
#define IMAGE_REPORT_LENGTH 8191
/* may or may not use these. Might use enumerations */
// #define STREAMDECK_ORIG 1
// #define STREAMDECK_MINI 2
struct Image {
void* data;
size_t size;
};
struct Key {
bool isFolder;
void* command;
struct Image* key;
pthread_mutex_t key_mutex;
};
/* How should we deal with invalid keys with nothing? Well we can use
* a bitmask */
/*
* Keys are numbered left to right.
* so in the mini streamdeck we have
* 0 1 2
* 3 4 5
*/
struct Screen {
struct Key* keys;
};
struct Handler {
hid_device* handler;
};
struct Streamdeck {
struct Handler* hid_handle;
void* callback_funcs;
struct Screen* curr_screen;
int numkeys;
int devicetype;
};
typedef struct Image image;
typedef struct Key key;
typedef struct Screen screen;
typedef struct Streamdeck streamdeck;
typedef struct Handler handler;
streamdeck* connect();
int reset(handler* deck);
int resetkeystream(handler* deck);
int callback(handler* deck, void* key, void* state);
int readhandler(handler* deck);
int set_key_image(streamdeck* deck, int key, image* img);
int init ();
void destroy_streamdeck (streamdeck* target);
handler* create_hid_handler ();
// handler* create_hid_handler ();
|