-
Notifications
You must be signed in to change notification settings - Fork 85
/
sweep.h
84 lines (66 loc) · 2.88 KB
/
sweep.h
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
80
81
82
83
84
#ifndef SWEEP_6144CCE8BA67_H
#define SWEEP_6144CCE8BA67_H
#include <stdbool.h>
#include <stdint.h>
#include <sweep/config.h>
#ifdef __cplusplus
extern "C" {
#endif
#if defined _WIN32 || defined __CYGWIN__ || defined __MINGW32__
// If we are building a dll, set SWEEP_API to export symbols
#ifdef SWEEP_EXPORTS
#ifdef __GNUC__
#define SWEEP_API __attribute__((dllexport))
#else
#define SWEEP_API __declspec(dllexport)
#endif
#else
#ifdef __GNUC__
#define SWEEP_API __attribute__((dllimport))
#else
#define SWEEP_API __declspec(dllimport)
#endif
#endif
#else
#if __GNUC__ >= 4
#define SWEEP_API __attribute__((visibility("default")))
#else
#define SWEEP_API
#endif
#endif
#ifndef SWEEP_ASSERT
#include <assert.h>
#define SWEEP_ASSERT(x) assert(x)
#endif
SWEEP_API int32_t sweep_get_version(void);
SWEEP_API bool sweep_is_abi_compatible(void);
typedef struct sweep_error* sweep_error_s;
typedef struct sweep_device* sweep_device_s;
typedef struct sweep_scan* sweep_scan_s;
SWEEP_API const char* sweep_error_message(sweep_error_s error);
SWEEP_API void sweep_error_destruct(sweep_error_s error);
SWEEP_API sweep_device_s sweep_device_construct_simple(const char* port, sweep_error_s* error);
SWEEP_API sweep_device_s sweep_device_construct(const char* port, int32_t bitrate, sweep_error_s* error);
SWEEP_API void sweep_device_destruct(sweep_device_s device);
// Blocks until device is ready to start scanning, then starts scanning
SWEEP_API void sweep_device_start_scanning(sweep_device_s device, sweep_error_s* error);
// Stops stream, blocks while leftover stream is flushed, and sends stop once more to validate response
SWEEP_API void sweep_device_stop_scanning(sweep_device_s device, sweep_error_s* error);
// Retrieves a scan from the queue (will block until scan is available)
SWEEP_API sweep_scan_s sweep_device_get_scan(sweep_device_s device, sweep_error_s* error);
SWEEP_API bool sweep_device_get_motor_ready(sweep_device_s device, sweep_error_s* error);
SWEEP_API int32_t sweep_device_get_motor_speed(sweep_device_s device, sweep_error_s* error);
// Blocks until device is ready to adjust motor speed, then adjusts motor speed
SWEEP_API void sweep_device_set_motor_speed(sweep_device_s device, int32_t hz, sweep_error_s* error);
SWEEP_API int32_t sweep_device_get_sample_rate(sweep_device_s device, sweep_error_s* error);
SWEEP_API void sweep_device_set_sample_rate(sweep_device_s device, int32_t hz, sweep_error_s* error);
SWEEP_API int32_t sweep_scan_get_number_of_samples(sweep_scan_s scan);
SWEEP_API int32_t sweep_scan_get_angle(sweep_scan_s scan, int32_t sample);
SWEEP_API int32_t sweep_scan_get_distance(sweep_scan_s scan, int32_t sample);
SWEEP_API int32_t sweep_scan_get_signal_strength(sweep_scan_s scan, int32_t sample);
SWEEP_API void sweep_scan_destruct(sweep_scan_s scan);
SWEEP_API void sweep_device_reset(sweep_device_s device, sweep_error_s* error);
#ifdef __cplusplus
}
#endif
#endif // SWEEP_6144CCE8BA67_H