libmirisdr  0.0.20130608
MiriSDR library
mirisdr.h
1 /*
2  * Copyright (C) 2012 by Steve Markgraf <steve@steve-m.de>
3  * Copyright (C) 2012 by Dimitri Stolnikov <horiz0n@gmx.net>
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #ifndef __MIRISDR_H
20 #define __MIRISDR_H
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 #include <stdint.h>
27 #include <mirisdr_export.h>
28 
29 typedef struct mirisdr_dev mirisdr_dev_t;
30 
31 MIRISDR_API uint32_t mirisdr_get_device_count(void);
32 
33 MIRISDR_API const char* mirisdr_get_device_name(uint32_t index);
34 
46 MIRISDR_API int mirisdr_get_device_usb_strings(uint32_t index,
47  char *manufact,
48  char *product,
49  char *serial);
50 
51 MIRISDR_API int mirisdr_open(mirisdr_dev_t **dev, uint32_t index);
52 
53 MIRISDR_API int mirisdr_close(mirisdr_dev_t *dev);
54 
55 /* configuration functions */
56 
68 MIRISDR_API int mirisdr_get_usb_strings(mirisdr_dev_t *dev, char *manufact,
69  char *product, char *serial);
70 
78 MIRISDR_API int mirisdr_set_center_freq(mirisdr_dev_t *dev, uint32_t freq);
79 
86 MIRISDR_API uint32_t mirisdr_get_center_freq(mirisdr_dev_t *dev);
87 
98 MIRISDR_API int mirisdr_get_tuner_gains(mirisdr_dev_t *dev, int *gains);
99 
110 MIRISDR_API int mirisdr_set_tuner_gain(mirisdr_dev_t *dev, int gain);
111 
118 MIRISDR_API int mirisdr_get_tuner_gain(mirisdr_dev_t *dev);
119 
128 MIRISDR_API int mirisdr_set_tuner_gain_mode(mirisdr_dev_t *dev, int manual);
129 
137 MIRISDR_API int mirisdr_set_sample_rate(mirisdr_dev_t *dev, uint32_t rate);
138 
145 MIRISDR_API uint32_t mirisdr_get_sample_rate(mirisdr_dev_t *dev);
146 
147 /* streaming functions */
148 
149 MIRISDR_API int mirisdr_reset_buffer(mirisdr_dev_t *dev);
150 
151 MIRISDR_API int mirisdr_read_sync(mirisdr_dev_t *dev, void *buf, int len, int *n_read);
152 
153 typedef void(*mirisdr_read_async_cb_t)(unsigned char *buf, uint32_t len, void *ctx);
154 
168 MIRISDR_API int mirisdr_read_async(mirisdr_dev_t *dev,
169  mirisdr_read_async_cb_t cb,
170  void *ctx,
171  uint32_t buf_num,
172  uint32_t buf_len);
173 
180 MIRISDR_API int mirisdr_cancel_async(mirisdr_dev_t *dev);
181 
182 #ifdef __cplusplus
183 }
184 #endif
185 
186 #endif /* __MIRISDR_H */
Definition: libmirisdr.c:68