Mstdlib-1.24.0
m_io_mfi.h
1/* The MIT License (MIT)
2 *
3 * Copyright (c) 2017 Monetra Technologies, LLC.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the "Software"), to deal
7 * in the Software without restriction, including without limitation the rights
8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 * copies of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 * THE SOFTWARE.
22 */
23
24#ifndef __M_IO_MFI_H__
25#define __M_IO_MFI_H__
26
27#include <mstdlib/base/m_defs.h>
28#include <mstdlib/base/m_types.h>
29#include <mstdlib/io/m_io.h>
30#include <mstdlib/io/m_event.h>
31
32__BEGIN_DECLS
33
34/*! \addtogroup m_io_mfi Made for iPod/iPhone/iPad IO functions
35 * \ingroup m_eventio_base
36 *
37 * Made for iPod/iPhone/iPad IO functions
38 *
39 * Supported OS:
40 * - iOS
41 *
42 * This is the External Accessory EAAccessory protocol. Devices that
43 * are part of the Made for iPhone/iPod/iPad (MFi) program. BLE is not supported
44 * by this interface use m_io_mfi for BLE on iOS.
45 *
46 * @{
47 */
48
49
50struct M_io_mfi_enum;
52
53
54/*! Create a mfi enumeration object.
55 *
56 * Use to determine what mfi devices are connected. On some OS's this may
57 * be a list of associated devices not necessarily what's actively connected.
58 *
59 * A device can expose multiple protocols.
60 *
61 * \return mfi enumeration object.
62 */
64
65
66/*! Destroy a mfi enumeration object.
67 *
68 * \param[in] mfienum mfi enumeration object.
69 */
71
72
73/*! Number of mfi objects in the enumeration.
74 *
75 * \param[in] mfienum mfi enumeration object.
76 *
77 * \return Count of mfi devices.
78 */
79M_API size_t M_io_mfi_enum_count(const M_io_mfi_enum_t *mfienum);
80
81
82/*! Name of mfi device as reported by the device.
83 *
84 * \param[in] mfienum mfi enumeration object.
85 * \param[in] idx Index in mfi enumeration.
86 *
87 * \return String.
88 */
89M_API const char *M_io_mfi_enum_name(const M_io_mfi_enum_t *mfienum, size_t idx);
90
91
92/*! Protocol exposed by of mfi device.
93 *
94 * \param[in] mfienum mfi enumeration object.
95 * \param[in] idx Index in mfi enumeration.
96 *
97 * \return String.
98 */
99M_API const char *M_io_mfi_enum_protocol(const M_io_mfi_enum_t *mfienum, size_t idx);
100
101
102/*! Serial number.
103 *
104 * \param[in] mfienum mfi enumeration object.
105 * \param[in] idx Index in mfi enumeration.
106 *
107 * \return String
108 */
109M_API const char *M_io_mfi_enum_serialnum(const M_io_mfi_enum_t *mfienum, size_t idx);
110
111
112/*! Manufacturer.
113 *
114 * \param[in] mfienum mfi enumeration object.
115 * \param[in] idx Index in mfi enumeration.
116 *
117 * \return String
118 */
119M_API const char *M_io_mfi_enum_manufacturer(const M_io_mfi_enum_t *mfienum, size_t idx);
120
121
122/*! Model number.
123 *
124 * \param[in] mfienum mfi enumeration object.
125 * \param[in] idx Index in mfi enumeration.
126 *
127 * \return String
128 */
129M_API const char *M_io_mfi_enum_model_number(const M_io_mfi_enum_t *mfienum, size_t idx);
130
131
132/*! Firmware revision.
133 *
134 * \param[in] mfienum mfi enumeration object.
135 * \param[in] idx Index in mfi enumeration.
136 *
137 * \return String
138 */
139M_API const char *M_io_mfi_enum_firmware_revision(const M_io_mfi_enum_t *mfienum, size_t idx);
140
141
142/*! Hardware revision.
143 *
144 * \param[in] mfienum mfi enumeration object.
145 * \param[in] idx Index in mfi enumeration.
146 *
147 * \return String
148 */
149M_API const char *M_io_mfi_enum_hardware_revision(const M_io_mfi_enum_t *mfienum, size_t idx);
150
151
152/*! Create a mfi connection.
153 *
154 * \param[out] io_out io object for communication.
155 * \param[in] protocol Protocol to use. Required.
156 * \param[in] serialnum Serial number of device to use.
157 *
158 * \return Result.
159 */
160M_API M_io_error_t M_io_mfi_create(M_io_t **io_out, const char *protocol, const char *serialnum);
161
162/*! @} */
163
164__END_DECLS
165
166#endif /* __M_IO_MFI_H__ */
void M_io_mfi_enum_destroy(M_io_mfi_enum_t *mfienum)
const char * M_io_mfi_enum_manufacturer(const M_io_mfi_enum_t *mfienum, size_t idx)
const char * M_io_mfi_enum_hardware_revision(const M_io_mfi_enum_t *mfienum, size_t idx)
const char * M_io_mfi_enum_serialnum(const M_io_mfi_enum_t *mfienum, size_t idx)
size_t M_io_mfi_enum_count(const M_io_mfi_enum_t *mfienum)
const char * M_io_mfi_enum_model_number(const M_io_mfi_enum_t *mfienum, size_t idx)
M_io_mfi_enum_t * M_io_mfi_enum(void)
M_io_error_t M_io_mfi_create(M_io_t **io_out, const char *protocol, const char *serialnum)
const char * M_io_mfi_enum_name(const M_io_mfi_enum_t *mfienum, size_t idx)
const char * M_io_mfi_enum_firmware_revision(const M_io_mfi_enum_t *mfienum, size_t idx)
struct M_io_mfi_enum M_io_mfi_enum_t
Definition: m_io_mfi.h:51
const char * M_io_mfi_enum_protocol(const M_io_mfi_enum_t *mfienum, size_t idx)
enum M_io_error M_io_error_t
Definition: m_io.h:93
struct M_io M_io_t
Definition: m_io.h:59