├── .gitignore
├── LICENSE
├── README.md
├── examples
├── ArduinoJson
│ ├── ArduinoJson.ino
│ └── Secrets.h
├── ESP32_FreeRTOS
│ ├── ESP32_FreeRTOS.ino
│ └── Secrets.h
├── GoProControl
│ ├── GoProControl.ino
│ └── Secrets.h
└── MultiCam
│ ├── MultiCam.ino
│ └── Secrets.h
├── extras
├── gopro3_and_nodemcu.jpg
└── gopros_and_esps.jpg
├── keywords.txt
├── library.properties
├── platformio.ini
└── src
├── GoProControl.cpp
├── GoProControl.h
└── Settings.h
/.gitignore:
--------------------------------------------------------------------------------
1 | .pio/**
2 | .vscode/**
3 | .travis.yml
4 | lib/**
5 | test/**
6 | include/**
7 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU General Public License is a free, copyleft license for
11 | software and other kinds of works.
12 |
13 | The licenses for most software and other practical works are designed
14 | to take away your freedom to share and change the works. By contrast,
15 | the GNU General Public License is intended to guarantee your freedom to
16 | share and change all versions of a program--to make sure it remains free
17 | software for all its users. We, the Free Software Foundation, use the
18 | GNU General Public License for most of our software; it applies also to
19 | any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | them if you wish), that you receive source code or can get it if you
26 | want it, that you can change the software or use pieces of it in new
27 | free programs, and that you know you can do these things.
28 |
29 | To protect your rights, we need to prevent others from denying you
30 | these rights or asking you to surrender the rights. Therefore, you have
31 | certain responsibilities if you distribute copies of the software, or if
32 | you modify it: responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must pass on to the recipients the same
36 | freedoms that you received. You must make sure that they, too, receive
37 | or can get the source code. And you must show them these terms so they
38 | know their rights.
39 |
40 | Developers that use the GNU GPL protect your rights with two steps:
41 | (1) assert copyright on the software, and (2) offer you this License
42 | giving you legal permission to copy, distribute and/or modify it.
43 |
44 | For the developers' and authors' protection, the GPL clearly explains
45 | that there is no warranty for this free software. For both users' and
46 | authors' sake, the GPL requires that modified versions be marked as
47 | changed, so that their problems will not be attributed erroneously to
48 | authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run
51 | modified versions of the software inside them, although the manufacturer
52 | can do so. This is fundamentally incompatible with the aim of
53 | protecting users' freedom to change the software. The systematic
54 | pattern of such abuse occurs in the area of products for individuals to
55 | use, which is precisely where it is most unacceptable. Therefore, we
56 | have designed this version of the GPL to prohibit the practice for those
57 | products. If such problems arise substantially in other domains, we
58 | stand ready to extend this provision to those domains in future versions
59 | of the GPL, as needed to protect the freedom of users.
60 |
61 | Finally, every program is threatened constantly by software patents.
62 | States should not allow patents to restrict development and use of
63 | software on general-purpose computers, but in those that do, we wish to
64 | avoid the special danger that patents applied to a free program could
65 | make it effectively proprietary. To prevent this, the GPL assures that
66 | patents cannot be used to render the program non-free.
67 |
68 | The precise terms and conditions for copying, distribution and
69 | modification follow.
70 |
71 | TERMS AND CONDITIONS
72 |
73 | 0. Definitions.
74 |
75 | "This License" refers to version 3 of the GNU General Public License.
76 |
77 | "Copyright" also means copyright-like laws that apply to other kinds of
78 | works, such as semiconductor masks.
79 |
80 | "The Program" refers to any copyrightable work licensed under this
81 | License. Each licensee is addressed as "you". "Licensees" and
82 | "recipients" may be individuals or organizations.
83 |
84 | To "modify" a work means to copy from or adapt all or part of the work
85 | in a fashion requiring copyright permission, other than the making of an
86 | exact copy. The resulting work is called a "modified version" of the
87 | earlier work or a work "based on" the earlier work.
88 |
89 | A "covered work" means either the unmodified Program or a work based
90 | on the Program.
91 |
92 | To "propagate" a work means to do anything with it that, without
93 | permission, would make you directly or secondarily liable for
94 | infringement under applicable copyright law, except executing it on a
95 | computer or modifying a private copy. Propagation includes copying,
96 | distribution (with or without modification), making available to the
97 | public, and in some countries other activities as well.
98 |
99 | To "convey" a work means any kind of propagation that enables other
100 | parties to make or receive copies. Mere interaction with a user through
101 | a computer network, with no transfer of a copy, is not conveying.
102 |
103 | An interactive user interface displays "Appropriate Legal Notices"
104 | to the extent that it includes a convenient and prominently visible
105 | feature that (1) displays an appropriate copyright notice, and (2)
106 | tells the user that there is no warranty for the work (except to the
107 | extent that warranties are provided), that licensees may convey the
108 | work under this License, and how to view a copy of this License. If
109 | the interface presents a list of user commands or options, such as a
110 | menu, a prominent item in the list meets this criterion.
111 |
112 | 1. Source Code.
113 |
114 | The "source code" for a work means the preferred form of the work
115 | for making modifications to it. "Object code" means any non-source
116 | form of a work.
117 |
118 | A "Standard Interface" means an interface that either is an official
119 | standard defined by a recognized standards body, or, in the case of
120 | interfaces specified for a particular programming language, one that
121 | is widely used among developers working in that language.
122 |
123 | The "System Libraries" of an executable work include anything, other
124 | than the work as a whole, that (a) is included in the normal form of
125 | packaging a Major Component, but which is not part of that Major
126 | Component, and (b) serves only to enable use of the work with that
127 | Major Component, or to implement a Standard Interface for which an
128 | implementation is available to the public in source code form. A
129 | "Major Component", in this context, means a major essential component
130 | (kernel, window system, and so on) of the specific operating system
131 | (if any) on which the executable work runs, or a compiler used to
132 | produce the work, or an object code interpreter used to run it.
133 |
134 | The "Corresponding Source" for a work in object code form means all
135 | the source code needed to generate, install, and (for an executable
136 | work) run the object code and to modify the work, including scripts to
137 | control those activities. However, it does not include the work's
138 | System Libraries, or general-purpose tools or generally available free
139 | programs which are used unmodified in performing those activities but
140 | which are not part of the work. For example, Corresponding Source
141 | includes interface definition files associated with source files for
142 | the work, and the source code for shared libraries and dynamically
143 | linked subprograms that the work is specifically designed to require,
144 | such as by intimate data communication or control flow between those
145 | subprograms and other parts of the work.
146 |
147 | The Corresponding Source need not include anything that users
148 | can regenerate automatically from other parts of the Corresponding
149 | Source.
150 |
151 | The Corresponding Source for a work in source code form is that
152 | same work.
153 |
154 | 2. Basic Permissions.
155 |
156 | All rights granted under this License are granted for the term of
157 | copyright on the Program, and are irrevocable provided the stated
158 | conditions are met. This License explicitly affirms your unlimited
159 | permission to run the unmodified Program. The output from running a
160 | covered work is covered by this License only if the output, given its
161 | content, constitutes a covered work. This License acknowledges your
162 | rights of fair use or other equivalent, as provided by copyright law.
163 |
164 | You may make, run and propagate covered works that you do not
165 | convey, without conditions so long as your license otherwise remains
166 | in force. You may convey covered works to others for the sole purpose
167 | of having them make modifications exclusively for you, or provide you
168 | with facilities for running those works, provided that you comply with
169 | the terms of this License in conveying all material for which you do
170 | not control copyright. Those thus making or running the covered works
171 | for you must do so exclusively on your behalf, under your direction
172 | and control, on terms that prohibit them from making any copies of
173 | your copyrighted material outside their relationship with you.
174 |
175 | Conveying under any other circumstances is permitted solely under
176 | the conditions stated below. Sublicensing is not allowed; section 10
177 | makes it unnecessary.
178 |
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180 |
181 | No covered work shall be deemed part of an effective technological
182 | measure under any applicable law fulfilling obligations under article
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 | similar laws prohibiting or restricting circumvention of such
185 | measures.
186 |
187 | When you convey a covered work, you waive any legal power to forbid
188 | circumvention of technological measures to the extent such circumvention
189 | is effected by exercising rights under this License with respect to
190 | the covered work, and you disclaim any intention to limit operation or
191 | modification of the work as a means of enforcing, against the work's
192 | users, your or third parties' legal rights to forbid circumvention of
193 | technological measures.
194 |
195 | 4. Conveying Verbatim Copies.
196 |
197 | You may convey verbatim copies of the Program's source code as you
198 | receive it, in any medium, provided that you conspicuously and
199 | appropriately publish on each copy an appropriate copyright notice;
200 | keep intact all notices stating that this License and any
201 | non-permissive terms added in accord with section 7 apply to the code;
202 | keep intact all notices of the absence of any warranty; and give all
203 | recipients a copy of this License along with the Program.
204 |
205 | You may charge any price or no price for each copy that you convey,
206 | and you may offer support or warranty protection for a fee.
207 |
208 | 5. Conveying Modified Source Versions.
209 |
210 | You may convey a work based on the Program, or the modifications to
211 | produce it from the Program, in the form of source code under the
212 | terms of section 4, provided that you also meet all of these conditions:
213 |
214 | a) The work must carry prominent notices stating that you modified
215 | it, and giving a relevant date.
216 |
217 | b) The work must carry prominent notices stating that it is
218 | released under this License and any conditions added under section
219 | 7. This requirement modifies the requirement in section 4 to
220 | "keep intact all notices".
221 |
222 | c) You must license the entire work, as a whole, under this
223 | License to anyone who comes into possession of a copy. This
224 | License will therefore apply, along with any applicable section 7
225 | additional terms, to the whole of the work, and all its parts,
226 | regardless of how they are packaged. This License gives no
227 | permission to license the work in any other way, but it does not
228 | invalidate such permission if you have separately received it.
229 |
230 | d) If the work has interactive user interfaces, each must display
231 | Appropriate Legal Notices; however, if the Program has interactive
232 | interfaces that do not display Appropriate Legal Notices, your
233 | work need not make them do so.
234 |
235 | A compilation of a covered work with other separate and independent
236 | works, which are not by their nature extensions of the covered work,
237 | and which are not combined with it such as to form a larger program,
238 | in or on a volume of a storage or distribution medium, is called an
239 | "aggregate" if the compilation and its resulting copyright are not
240 | used to limit the access or legal rights of the compilation's users
241 | beyond what the individual works permit. Inclusion of a covered work
242 | in an aggregate does not cause this License to apply to the other
243 | parts of the aggregate.
244 |
245 | 6. Conveying Non-Source Forms.
246 |
247 | You may convey a covered work in object code form under the terms
248 | of sections 4 and 5, provided that you also convey the
249 | machine-readable Corresponding Source under the terms of this License,
250 | in one of these ways:
251 |
252 | a) Convey the object code in, or embodied in, a physical product
253 | (including a physical distribution medium), accompanied by the
254 | Corresponding Source fixed on a durable physical medium
255 | customarily used for software interchange.
256 |
257 | b) Convey the object code in, or embodied in, a physical product
258 | (including a physical distribution medium), accompanied by a
259 | written offer, valid for at least three years and valid for as
260 | long as you offer spare parts or customer support for that product
261 | model, to give anyone who possesses the object code either (1) a
262 | copy of the Corresponding Source for all the software in the
263 | product that is covered by this License, on a durable physical
264 | medium customarily used for software interchange, for a price no
265 | more than your reasonable cost of physically performing this
266 | conveying of source, or (2) access to copy the
267 | Corresponding Source from a network server at no charge.
268 |
269 | c) Convey individual copies of the object code with a copy of the
270 | written offer to provide the Corresponding Source. This
271 | alternative is allowed only occasionally and noncommercially, and
272 | only if you received the object code with such an offer, in accord
273 | with subsection 6b.
274 |
275 | d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 |
288 | e) Convey the object code using peer-to-peer transmission, provided
289 | you inform other peers where the object code and Corresponding
290 | Source of the work are being offered to the general public at no
291 | charge under subsection 6d.
292 |
293 | A separable portion of the object code, whose source code is excluded
294 | from the Corresponding Source as a System Library, need not be
295 | included in conveying the object code work.
296 |
297 | A "User Product" is either (1) a "consumer product", which means any
298 | tangible personal property which is normally used for personal, family,
299 | or household purposes, or (2) anything designed or sold for incorporation
300 | into a dwelling. In determining whether a product is a consumer product,
301 | doubtful cases shall be resolved in favor of coverage. For a particular
302 | product received by a particular user, "normally used" refers to a
303 | typical or common use of that class of product, regardless of the status
304 | of the particular user or of the way in which the particular user
305 | actually uses, or expects or is expected to use, the product. A product
306 | is a consumer product regardless of whether the product has substantial
307 | commercial, industrial or non-consumer uses, unless such uses represent
308 | the only significant mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to install
312 | and execute modified versions of a covered work in that User Product from
313 | a modified version of its Corresponding Source. The information must
314 | suffice to ensure that the continued functioning of the modified object
315 | code is in no case prevented or interfered with solely because
316 | modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or updates
331 | for a work that has been modified or installed by the recipient, or for
332 | the User Product in which it has been modified or installed. Access to a
333 | network may be denied when the modification itself materially and
334 | adversely affects the operation of the network or violates the rules and
335 | protocols for communication across the network.
336 |
337 | Corresponding Source conveyed, and Installation Information provided,
338 | in accord with this section must be in a format that is publicly
339 | documented (and with an implementation available to the public in
340 | source code form), and must require no special password or key for
341 | unpacking, reading or copying.
342 |
343 | 7. Additional Terms.
344 |
345 | "Additional permissions" are terms that supplement the terms of this
346 | License by making exceptions from one or more of its conditions.
347 | Additional permissions that are applicable to the entire Program shall
348 | be treated as though they were included in this License, to the extent
349 | that they are valid under applicable law. If additional permissions
350 | apply only to part of the Program, that part may be used separately
351 | under those permissions, but the entire Program remains governed by
352 | this License without regard to the additional permissions.
353 |
354 | When you convey a copy of a covered work, you may at your option
355 | remove any additional permissions from that copy, or from any part of
356 | it. (Additional permissions may be written to require their own
357 | removal in certain cases when you modify the work.) You may place
358 | additional permissions on material, added by you to a covered work,
359 | for which you have or can give appropriate copyright permission.
360 |
361 | Notwithstanding any other provision of this License, for material you
362 | add to a covered work, you may (if authorized by the copyright holders of
363 | that material) supplement the terms of this License with terms:
364 |
365 | a) Disclaiming warranty or limiting liability differently from the
366 | terms of sections 15 and 16 of this License; or
367 |
368 | b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 |
372 | c) Prohibiting misrepresentation of the origin of that material, or
373 | requiring that modified versions of such material be marked in
374 | reasonable ways as different from the original version; or
375 |
376 | d) Limiting the use for publicity purposes of names of licensors or
377 | authors of the material; or
378 |
379 | e) Declining to grant rights under trademark law for use of some
380 | trade names, trademarks, or service marks; or
381 |
382 | f) Requiring indemnification of licensors and authors of that
383 | material by anyone who conveys the material (or modified versions of
384 | it) with contractual assumptions of liability to the recipient, for
385 | any liability that these contractual assumptions directly impose on
386 | those licensors and authors.
387 |
388 | All other non-permissive additional terms are considered "further
389 | restrictions" within the meaning of section 10. If the Program as you
390 | received it, or any part of it, contains a notice stating that it is
391 | governed by this License along with a term that is a further
392 | restriction, you may remove that term. If a license document contains
393 | a further restriction but permits relicensing or conveying under this
394 | License, you may add to a covered work material governed by the terms
395 | of that license document, provided that the further restriction does
396 | not survive such relicensing or conveying.
397 |
398 | If you add terms to a covered work in accord with this section, you
399 | must place, in the relevant source files, a statement of the
400 | additional terms that apply to those files, or a notice indicating
401 | where to find the applicable terms.
402 |
403 | Additional terms, permissive or non-permissive, may be stated in the
404 | form of a separately written license, or stated as exceptions;
405 | the above requirements apply either way.
406 |
407 | 8. Termination.
408 |
409 | You may not propagate or modify a covered work except as expressly
410 | provided under this License. Any attempt otherwise to propagate or
411 | modify it is void, and will automatically terminate your rights under
412 | this License (including any patent licenses granted under the third
413 | paragraph of section 11).
414 |
415 | However, if you cease all violation of this License, then your
416 | license from a particular copyright holder is reinstated (a)
417 | provisionally, unless and until the copyright holder explicitly and
418 | finally terminates your license, and (b) permanently, if the copyright
419 | holder fails to notify you of the violation by some reasonable means
420 | prior to 60 days after the cessation.
421 |
422 | Moreover, your license from a particular copyright holder is
423 | reinstated permanently if the copyright holder notifies you of the
424 | violation by some reasonable means, this is the first time you have
425 | received notice of violation of this License (for any work) from that
426 | copyright holder, and you cure the violation prior to 30 days after
427 | your receipt of the notice.
428 |
429 | Termination of your rights under this section does not terminate the
430 | licenses of parties who have received copies or rights from you under
431 | this License. If your rights have been terminated and not permanently
432 | reinstated, you do not qualify to receive new licenses for the same
433 | material under section 10.
434 |
435 | 9. Acceptance Not Required for Having Copies.
436 |
437 | You are not required to accept this License in order to receive or
438 | run a copy of the Program. Ancillary propagation of a covered work
439 | occurring solely as a consequence of using peer-to-peer transmission
440 | to receive a copy likewise does not require acceptance. However,
441 | nothing other than this License grants you permission to propagate or
442 | modify any covered work. These actions infringe copyright if you do
443 | not accept this License. Therefore, by modifying or propagating a
444 | covered work, you indicate your acceptance of this License to do so.
445 |
446 | 10. Automatic Licensing of Downstream Recipients.
447 |
448 | Each time you convey a covered work, the recipient automatically
449 | receives a license from the original licensors, to run, modify and
450 | propagate that work, subject to this License. You are not responsible
451 | for enforcing compliance by third parties with this License.
452 |
453 | An "entity transaction" is a transaction transferring control of an
454 | organization, or substantially all assets of one, or subdividing an
455 | organization, or merging organizations. If propagation of a covered
456 | work results from an entity transaction, each party to that
457 | transaction who receives a copy of the work also receives whatever
458 | licenses to the work the party's predecessor in interest had or could
459 | give under the previous paragraph, plus a right to possession of the
460 | Corresponding Source of the work from the predecessor in interest, if
461 | the predecessor has it or can get it with reasonable efforts.
462 |
463 | You may not impose any further restrictions on the exercise of the
464 | rights granted or affirmed under this License. For example, you may
465 | not impose a license fee, royalty, or other charge for exercise of
466 | rights granted under this License, and you may not initiate litigation
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that
468 | any patent claim is infringed by making, using, selling, offering for
469 | sale, or importing the Program or any portion of it.
470 |
471 | 11. Patents.
472 |
473 | A "contributor" is a copyright holder who authorizes use under this
474 | License of the Program or a work on which the Program is based. The
475 | work thus licensed is called the contributor's "contributor version".
476 |
477 | A contributor's "essential patent claims" are all patent claims
478 | owned or controlled by the contributor, whether already acquired or
479 | hereafter acquired, that would be infringed by some manner, permitted
480 | by this License, of making, using, or selling its contributor version,
481 | but do not include claims that would be infringed only as a
482 | consequence of further modification of the contributor version. For
483 | purposes of this definition, "control" includes the right to grant
484 | patent sublicenses in a manner consistent with the requirements of
485 | this License.
486 |
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free
488 | patent license under the contributor's essential patent claims, to
489 | make, use, sell, offer for sale, import and otherwise run, modify and
490 | propagate the contents of its contributor version.
491 |
492 | In the following three paragraphs, a "patent license" is any express
493 | agreement or commitment, however denominated, not to enforce a patent
494 | (such as an express permission to practice a patent or covenant not to
495 | sue for patent infringement). To "grant" such a patent license to a
496 | party means to make such an agreement or commitment not to enforce a
497 | patent against the party.
498 |
499 | If you convey a covered work, knowingly relying on a patent license,
500 | and the Corresponding Source of the work is not available for anyone
501 | to copy, free of charge and under the terms of this License, through a
502 | publicly available network server or other readily accessible means,
503 | then you must either (1) cause the Corresponding Source to be so
504 | available, or (2) arrange to deprive yourself of the benefit of the
505 | patent license for this particular work, or (3) arrange, in a manner
506 | consistent with the requirements of this License, to extend the patent
507 | license to downstream recipients. "Knowingly relying" means you have
508 | actual knowledge that, but for the patent license, your conveying the
509 | covered work in a country, or your recipient's use of the covered work
510 | in a country, would infringe one or more identifiable patents in that
511 | country that you have reason to believe are valid.
512 |
513 | If, pursuant to or in connection with a single transaction or
514 | arrangement, you convey, or propagate by procuring conveyance of, a
515 | covered work, and grant a patent license to some of the parties
516 | receiving the covered work authorizing them to use, propagate, modify
517 | or convey a specific copy of the covered work, then the patent license
518 | you grant is automatically extended to all recipients of the covered
519 | work and works based on it.
520 |
521 | A patent license is "discriminatory" if it does not include within
522 | the scope of its coverage, prohibits the exercise of, or is
523 | conditioned on the non-exercise of one or more of the rights that are
524 | specifically granted under this License. You may not convey a covered
525 | work if you are a party to an arrangement with a third party that is
526 | in the business of distributing software, under which you make payment
527 | to the third party based on the extent of your activity of conveying
528 | the work, and under which the third party grants, to any of the
529 | parties who would receive the covered work from you, a discriminatory
530 | patent license (a) in connection with copies of the covered work
531 | conveyed by you (or copies made from those copies), or (b) primarily
532 | for and in connection with specific products or compilations that
533 | contain the covered work, unless you entered into that arrangement,
534 | or that patent license was granted, prior to 28 March 2007.
535 |
536 | Nothing in this License shall be construed as excluding or limiting
537 | any implied license or other defenses to infringement that may
538 | otherwise be available to you under applicable patent law.
539 |
540 | 12. No Surrender of Others' Freedom.
541 |
542 | If conditions are imposed on you (whether by court order, agreement or
543 | otherwise) that contradict the conditions of this License, they do not
544 | excuse you from the conditions of this License. If you cannot convey a
545 | covered work so as to satisfy simultaneously your obligations under this
546 | License and any other pertinent obligations, then as a consequence you may
547 | not convey it at all. For example, if you agree to terms that obligate you
548 | to collect a royalty for further conveying from those to whom you convey
549 | the Program, the only way you could satisfy both those terms and this
550 | License would be to refrain entirely from conveying the Program.
551 |
552 | 13. Use with the GNU Affero General Public License.
553 |
554 | Notwithstanding any other provision of this License, you have
555 | permission to link or combine any covered work with a work licensed
556 | under version 3 of the GNU Affero General Public License into a single
557 | combined work, and to convey the resulting work. The terms of this
558 | License will continue to apply to the part which is the covered work,
559 | but the special requirements of the GNU Affero General Public License,
560 | section 13, concerning interaction through a network will apply to the
561 | combination as such.
562 |
563 | 14. Revised Versions of this License.
564 |
565 | The Free Software Foundation may publish revised and/or new versions of
566 | the GNU General Public License from time to time. Such new versions will
567 | be similar in spirit to the present version, but may differ in detail to
568 | address new problems or concerns.
569 |
570 | Each version is given a distinguishing version number. If the
571 | Program specifies that a certain numbered version of the GNU General
572 | Public License "or any later version" applies to it, you have the
573 | option of following the terms and conditions either of that numbered
574 | version or of any later version published by the Free Software
575 | Foundation. If the Program does not specify a version number of the
576 | GNU General Public License, you may choose any version ever published
577 | by the Free Software Foundation.
578 |
579 | If the Program specifies that a proxy can decide which future
580 | versions of the GNU General Public License can be used, that proxy's
581 | public statement of acceptance of a version permanently authorizes you
582 | to choose that version for the Program.
583 |
584 | Later license versions may give you additional or different
585 | permissions. However, no additional obligations are imposed on any
586 | author or copyright holder as a result of your choosing to follow a
587 | later version.
588 |
589 | 15. Disclaimer of Warranty.
590 |
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599 |
600 | 16. Limitation of Liability.
601 |
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 | SUCH DAMAGES.
611 |
612 | 17. Interpretation of Sections 15 and 16.
613 |
614 | If the disclaimer of warranty and limitation of liability provided
615 | above cannot be given local legal effect according to their terms,
616 | reviewing courts shall apply local law that most closely approximates
617 | an absolute waiver of all civil liability in connection with the
618 | Program, unless a warranty or assumption of liability accompanies a
619 | copy of the Program in return for a fee.
620 |
621 | END OF TERMS AND CONDITIONS
622 |
623 | How to Apply These Terms to Your New Programs
624 |
625 | If you develop a new program, and you want it to be of the greatest
626 | possible use to the public, the best way to achieve this is to make it
627 | free software which everyone can redistribute and change under these terms.
628 |
629 | To do so, attach the following notices to the program. It is safest
630 | to attach them to the start of each source file to most effectively
631 | state the exclusion of warranty; and each file should have at least
632 | the "copyright" line and a pointer to where the full notice is found.
633 |
634 |
635 | Copyright (C)
636 |
637 | This program is free software: you can redistribute it and/or modify
638 | it under the terms of the GNU General Public License as published by
639 | the Free Software Foundation, either version 3 of the License, or
640 | (at your option) any later version.
641 |
642 | This program is distributed in the hope that it will be useful,
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 | GNU General Public License for more details.
646 |
647 | You should have received a copy of the GNU General Public License
648 | along with this program. If not, see .
649 |
650 | Also add information on how to contact you by electronic and paper mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | Copyright (C)
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands `show w' and `show c' should show the appropriate
661 | parts of the General Public License. Of course, your program's commands
662 | might be different; for a GUI interface, you would use an "about box".
663 |
664 | You should also get your employer (if you work as a programmer) or school,
665 | if any, to sign a "copyright disclaimer" for the program, if necessary.
666 | For more information on this, and how to apply and follow the GNU GPL, see
667 | .
668 |
669 | The GNU General Public License does not permit incorporating your program
670 | into proprietary programs. If your program is a subroutine library, you
671 | may consider it more useful to permit linking proprietary applications with
672 | the library. If this is what you want to do, use the GNU Lesser General
673 | Public License instead of this License. But first, please read
674 | .
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # GoPro Control for Arduino
2 |
3 | This is a library to interface with GoPro cameras over WiFi using Arduino!
4 |
5 | 
6 |
7 | 
8 |
9 | Here there is a short video that shows the potential of the library (click below to play)
10 |
11 | [](https://www.youtube.com/watch?v=PuM-ZQ2tMW0)
12 |
13 | ## Projects
14 |
15 | Check out these nice projects:
16 | - [RTLapseCAM](http://www.plastibots.com/index.php/2021/12/25/rtlapsecam-resin-printer-time-lapse-with-m5stick-c-plus-gopro/)
17 | - [RTLapseCAM V2](http://www.plastibots.com/index.php/2022/02/02/rtlapsecam-resin-printer-time-lapse-with-m5stick-c-plus-gopro-2/)
18 |
19 | If you want to show your project make a pull request
20 |
21 | ## Supported actions
22 |
23 | - take a picture
24 | - start and stop a video
25 | - change the mode (photo, video, etc)
26 | - delete last file
27 | - format the SD
28 | - turn the camera on/off
29 | - change the field of view (FOV)
30 | - change frame rate
31 | - change photo and video resolution
32 | - turn the localization on/off
33 | - change the orientation
34 | - more
35 |
36 | ## Supported boards:
37 |
38 | - ESP32
39 | - ESP8266
40 | - MKR1000
41 | - MKR WiFi 1010
42 | - MKR VIDOR 4000
43 | - UNO WiFi Rev.2
44 | - Raspberry Pi Boards
45 | - any other boards (UNO, NANO, bluepill) attached to an ESP01 using AT commands with [this library](https://github.com/bportaluri/WiFiEsp)
46 |
47 | ## Supported cameras:
48 |
49 | - HERO3
50 | - HERO4
51 | - HERO5
52 | - HERO6
53 | - HERO7
54 | - FUSION
55 | - HERO8
56 | - MAX
57 |
58 | I made the library with a style which would be quite easy to add other cameras (not only GoPro). I would be very happy to accept pull requests 😃
59 |
60 | ## Installation
61 |
62 | - Arduino IDE:
63 | - Go to Tools > Manage libraries
64 | - Search for `GoProControl`
65 | - PlatformIO:
66 | - From command line: run `pio lib install "GoProControl"` or use the ID `pio lib install 5599`
67 | - Or if you prefer a GUI from [Platformio IDE](https://docs.platformio.org/en/latest/librarymanager/)
68 | - Raspberry Pi:
69 | - Follow this: https://github.com/earlephilhower/arduino-pico
70 | - Manually:
71 | - `cd $HOME/Arduino/libraries` ([see Arduino library paths for other operating systems](https://www.arduino.cc/en/hacking/libraries))
72 | - `git clone https://github.com/aster94/GoProControl.git`
73 | - Restart Arduino IDE
74 |
75 | ## Examples
76 |
77 | Start with the [`GoProControl.ino`](examples/GoProControl/GoProControl.ino) to get used with the library
78 |
79 | If you wish to control two (or more) camera at the same time check [`MultiCam.ino`](examples/MultiCam/MultiCam.ino)
80 |
81 | On the ESP32 there is the possibility to use the dual core architecture with the FreeRTOS framework, check [`ESP32_FreeRTOS.ino`](examples/ESP32_FreeRTOS/ESP32_FreeRTOS.ino)
82 |
83 | An advantage use of the `getStatus()` and `getMediaList()` can be seen in [`ArduinoJson.ino`](examples/ArduinoJson/ArduinoJson.ino), you would need to download the `ArduinoJson` library
84 |
85 | To improve the connection stability is very important to always close the connection with `end()`
86 |
87 | **Important:** Before uploading to your board you have to change the SSID, password and camera model from `Secrets.h`
88 |
89 | ## Supported Settings
90 |
91 | You can see the available settings in the manual of your camera or [here](https://github.com/KonradIT/goprowifihack/blob/master/HERO3/Framerates-Resolutions.md) for HERO3 and [here](https://github.com/KonradIT/goprowifihack/blob/master/HERO4/Framerates-Resolutions.md) for HERO4 and newer.
92 |
93 | In the file [Settings.h](src/Settings.h) you can see how them are defined
94 |
95 | **NOTE:** Not all the combination of settings are available for all the cameras (for example on a HERO3 you can't set 8K at 240 frame per second 😲).
96 |
97 | ## To Do list and known issues
98 |
99 | - ESP8266 can't get the BSSID of the camera. So if you want to turn it on you need to manually pass it to the constructor, [see the docs](https://arduino-esp8266.readthedocs.io/en/latest/esp8266wifi/station-class.html#bssid)
100 | - There is no way to know if an HERO3 camera is on or off so the function `isOn()` will always return `true` on this camera - open an issue if you found a way
101 | - BLE not implemented: the ESP32 core is not enough stable, especially if used together with wifi: [see here](https://github.com/espressif/arduino-esp32/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+ble)
102 | - No confirm pairing for HERO4: [see here](https://github.com/KonradIT/goprowifihack/blob/master/HERO4/WifiCommands.md#code-pairing) - PR are welcome
103 | - on STM32 there is a known bug with [WiFiEsp](https://github.com/bportaluri/WiFiEsp/pull/179)
104 | - Arduino official WiFi API doesn't support `getHostname()`, [see here](https://github.com/arduino-libraries/WiFiNINA/issues/57)
105 | - HERO4 and later camera can't be turned on, this is due to a bug inside this library which I wasn't able to fix yet
106 |
107 | ## Reference
108 |
109 | All the commands came from the great work of [KonradIT](https://github.com/KonradIT/goprowifihack)
110 |
111 | The idea of making a GoPro library for arduino comes from another [library](https://github.com/agdl/GoPRO) which works only on arduino WiFi boards and only with GoPro HERO3
112 |
113 | ## Donate
114 |
115 | If you liked the library and wish to donate you can sent to [PayPal](https://paypal.me/aster94)
116 |
--------------------------------------------------------------------------------
/examples/ArduinoJson/ArduinoJson.ino:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include "Secrets.h"
4 |
5 | // Allocate the JSON document
6 | StaticJsonDocument<4000> status;
7 | StaticJsonDocument<1000> media; // media list
8 | GoProControl gp(GOPRO_SSID, GOPRO_PASS, CAMERA);
9 |
10 | void setup()
11 | {
12 | Serial.begin(115200);
13 | //gp.enableDebug(&Serial);
14 | }
15 |
16 | void compute_status()
17 | {
18 | // Deserialize the JSON document
19 | DeserializationError error = deserializeJson(status, gp.getStatus());
20 |
21 | // Test if parsing succeeds.
22 | if (error)
23 | {
24 | Serial.print(F("deserializeJson() failed: "));
25 | Serial.println(error.c_str());
26 | return;
27 | }
28 |
29 | // Print values
30 | // To understand these values see the camera status file, for example for MAX:
31 | // https://github.com/KonradIT/goprowifihack/blob/master/MAX/CameraStatus.md
32 | byte battery = status["status"]["1"];
33 | byte charge = status["status"]["2"];
34 | byte mode = status["settings"]["1"];
35 | byte vr = status["settings"]["2"];
36 |
37 | Serial.print("Battery: ");
38 | Serial.println(battery);
39 | Serial.print("Charge: ");
40 | Serial.println(charge);
41 | Serial.print("Mode: ");
42 | Serial.println(mode);
43 | Serial.print("Video Resolution: ");
44 | Serial.println(vr);
45 | }
46 |
47 | void compute_mediaList()
48 | {
49 | // Deserialize the JSON document
50 | DeserializationError error = deserializeJson(media, gp.getMediaList());
51 |
52 | // Test if parsing succeeds.
53 | if (error)
54 | {
55 | Serial.print(F("deserializeJson() failed: "));
56 | Serial.println(error.c_str());
57 | return;
58 | }
59 |
60 | // Print values.
61 | const char *id = media["id"];
62 | const char *folder = media["media"][0]["d"];
63 | JsonArray array = media["media"][0]["fs"];
64 | byte pic = array.size();
65 |
66 | Serial.print("ID: ");
67 | Serial.println(id);
68 | Serial.print("Folder: ");
69 | Serial.println(folder);
70 | Serial.print("Number of pic: ");
71 | Serial.println(pic);
72 | }
73 |
74 | void loop()
75 | {
76 | char in = 0;
77 | if (Serial.available() > 0)
78 | {
79 | in = Serial.read();
80 | }
81 |
82 | switch (in)
83 | {
84 | default:
85 | break;
86 |
87 | // Connect
88 | case 'b':
89 | if (gp.begin() == 1)
90 | {
91 | Serial.println("Connected!");
92 | }
93 | break;
94 |
95 | case 'c':
96 | Serial.print("Connected: ");
97 | Serial.println(gp.isConnected() == true ? "Yes" : "No");
98 | break;
99 |
100 | case 's':
101 | Serial.println("Status");
102 | compute_status();
103 | break;
104 |
105 | case 'm':
106 | Serial.println("Media list");
107 | compute_mediaList();
108 | break;
109 |
110 | case 'x':
111 | Serial.println("Closing");
112 | gp.end();
113 | break;
114 | }
115 | gp.keepAlive();
116 | }
117 |
--------------------------------------------------------------------------------
/examples/ArduinoJson/Secrets.h:
--------------------------------------------------------------------------------
1 | #ifndef SECRETS_H
2 | #define SECRETS_H
3 |
4 | // Replace the following:
5 | #define GOPRO_SSID "__YOUR_CAMERA_NAME__"
6 | #define GOPRO_PASS "__YOUR_CAMERA_PASS__"
7 |
8 | #endif
9 |
--------------------------------------------------------------------------------
/examples/ESP32_FreeRTOS/ESP32_FreeRTOS.ino:
--------------------------------------------------------------------------------
1 | #include
2 | #include "Secrets.h"
3 |
4 | /*
5 | Example with the FreeRTOS framework
6 | */
7 |
8 | GoProControl gp(GOPRO_SSID, GOPRO_PASS, CAMERA);
9 |
10 | void setup()
11 | {
12 | gp.enableDebug(&Serial);
13 | xTaskCreate(keep_alive, "keep_alive", 10000, NULL, 1, NULL);
14 | }
15 |
16 | void loop()
17 | {
18 | char in = 0;
19 | if (Serial.available() > 0)
20 | {
21 | in = Serial.read();
22 | }
23 |
24 | switch (in)
25 | {
26 | default:
27 | break;
28 |
29 | // Connect
30 | case 'C':
31 | gp.begin();
32 | break;
33 |
34 | // Turn on and off
35 | case 'T':
36 | gp.turnOn();
37 | break;
38 |
39 | case 't':
40 | gp.turnOff();
41 | break;
42 |
43 | // Take a picture of start a video
44 | case 'A':
45 | gp.shoot();
46 | break;
47 |
48 | // Stop the video
49 | case 'S':
50 | gp.stopShoot();
51 | break;
52 |
53 | // Set modes
54 | case 'V':
55 | gp.setMode(VIDEO_MODE);
56 | break;
57 |
58 | case 'P':
59 | gp.setMode(PHOTO_MODE);
60 | break;
61 |
62 | case 'M':
63 | gp.setMode(MULTISHOT_MODE);
64 | break;
65 |
66 | // Change the orientation
67 | case 'u':
68 | gp.setOrientation(ORIENTATION_UP);
69 | break;
70 |
71 | case 'd':
72 | gp.setOrientation(ORIENTATION_DOWN);
73 | break;
74 |
75 | // Change other parameters
76 | case 'W':
77 | gp.setVideoFov(MEDIUM_FOV);
78 | break;
79 |
80 | case 'E':
81 | gp.setFrameRate(FR_120);
82 | break;
83 |
84 | case 'f':
85 | gp.setPhotoResolution(PR_11MP_WIDE);
86 | break;
87 |
88 | case 'F':
89 | gp.setVideoResolution(VR_1080p);
90 | break;
91 |
92 | case 'L':
93 | gp.setTimeLapseInterval(60);
94 | break;
95 |
96 | // Localize the camera
97 | case 'O':
98 | gp.localizationOn();
99 | break;
100 |
101 | case 'I':
102 | gp.localizationOff();
103 | break;
104 |
105 | // Delete some files, be carefull!
106 | case 'l':
107 | gp.deleteLast();
108 | break;
109 |
110 | case 'D':
111 | gp.deleteAll();
112 | break;
113 |
114 | // Print useful data
115 | case 'p':
116 | gp.printStatus();
117 | break;
118 |
119 | // Close the connection
120 | case 'X':
121 | gp.end();
122 | break;
123 | }
124 | }
125 |
126 | void keep_alive(void *parameter)
127 | {
128 | while (1)
129 | {
130 | gp.keepAlive();
131 | }
132 | vTaskDelete(NULL);
133 | }
134 |
--------------------------------------------------------------------------------
/examples/ESP32_FreeRTOS/Secrets.h:
--------------------------------------------------------------------------------
1 | #ifndef SECRETS_H
2 | #define SECRETS_H
3 |
4 | // Replace the following:
5 | #define GOPRO_SSID "__YOUR_CAMERA_NAME__"
6 | #define GOPRO_PASS "__YOUR_CAMERA_PASS__"
7 |
8 | #endif
9 |
--------------------------------------------------------------------------------
/examples/GoProControl/GoProControl.ino:
--------------------------------------------------------------------------------
1 | #include
2 | #include "Secrets.h"
3 |
4 | /*
5 | Control your GoPro with the Serial Monitor
6 | edit the file Secrets.h with your camera netword name and password
7 | CAMERA could be: HERO3, HERO4, HERO5, HERO6, HERO7, FUSION, HERO8, MAX
8 | */
9 |
10 | #define CAMERA HERO3 // Change here for your camera
11 |
12 | GoProControl gp(GOPRO_SSID, GOPRO_PASS, CAMERA);
13 |
14 | void setup()
15 | {
16 | gp.enableDebug(&Serial);
17 | }
18 |
19 | void loop()
20 | {
21 | char in = 0;
22 | if (Serial.available() > 0)
23 | {
24 | in = Serial.read();
25 | }
26 |
27 | switch (in)
28 | {
29 | default:
30 | break;
31 |
32 | // Connect
33 | case 'b':
34 | gp.begin();
35 | break;
36 |
37 | case 'c':
38 | Serial.print("Connected: ");
39 | Serial.println(gp.isConnected() == true ? "Yes" : "No");
40 | break;
41 |
42 | case 'p':
43 | gp.confirmPairing();
44 | break;
45 |
46 | case 's':
47 |
48 | if (CAMERA == HERO3)
49 | {
50 | char * statusChar;
51 | statusChar = gp.getStatus();
52 | Serial.println("Status :");
53 | for(int i = 0; i < 56; i++)
54 | {
55 | Serial.print(statusChar[i], HEX);Serial.print(" ");
56 | }
57 | Serial.println("");
58 | Serial.println("End Status.");
59 | if (statusChar[0] == 0x00){Serial.println("camera ON");}
60 | else{Serial.println("camera OFF");}
61 | free(statusChar); // Don't forget to free memory
62 | }
63 |
64 | else
65 | {
66 | char * statusChar;
67 | statusChar = gp.getStatus();
68 | Serial.println("Status :");
69 | Serial.println(statusChar);
70 | free(statusChar); // Don't forget to free memory
71 | }
72 |
73 | break;
74 |
75 | case 'm': // DO NOT USE WHEN CAMERA IS OFF, IT FREEZE ESP
76 | char* medialist;
77 | medialist = gp.getMediaList();
78 | Serial.println("Media List:");
79 | Serial.println(medialist);
80 | free(medialist); // Don't forget to free memory
81 | break;
82 |
83 | // Turn on and off
84 | case 'T':
85 | gp.turnOn();
86 | break;
87 |
88 | case 't':
89 | gp.turnOff();
90 | break;
91 |
92 | // Take a picture of start a video
93 | case 'A':
94 | gp.shoot();
95 | break;
96 |
97 | // Stop the video
98 | case 'S':
99 | gp.stopShoot();
100 | break;
101 |
102 | // Check if it is recording
103 | case 'r':
104 | Serial.print("Recording: ");
105 | Serial.println(gp.isRecording() == true ? "Yes" : "No");
106 | break;
107 |
108 | // Set modes
109 | case 'V':
110 | gp.setMode(VIDEO_MODE);
111 | break;
112 |
113 | case 'P':
114 | gp.setMode(PHOTO_MODE);
115 | break;
116 |
117 | case 'M':
118 | gp.setMode(MULTISHOT_MODE);
119 | break;
120 |
121 | // Change the orientation
122 | case 'U':
123 | gp.setOrientation(ORIENTATION_UP);
124 | break;
125 |
126 | case 'D':
127 | gp.setOrientation(ORIENTATION_DOWN);
128 | break;
129 |
130 | // Change other parameters
131 | case 'f':
132 | gp.setVideoFov(MEDIUM_FOV);
133 | break;
134 |
135 | case 'F':
136 | gp.setFrameRate(FR_120);
137 | break;
138 |
139 | case 'R':
140 | gp.setVideoResolution(VR_1080p);
141 | break;
142 |
143 | case 'h':
144 | gp.setPhotoResolution(PR_12MP_WIDE);
145 | break;
146 |
147 | case 'L':
148 | gp.setTimeLapseInterval(60);
149 | break;
150 |
151 | // Localize the camera
152 | case 'O':
153 | gp.localizationOn();
154 | break;
155 |
156 | case 'o':
157 | gp.localizationOff();
158 | break;
159 |
160 | // Delete some files, be carefull!
161 | case 'l':
162 | gp.deleteLast();
163 | break;
164 |
165 | case 'g':
166 | gp.deleteAll();
167 | break;
168 |
169 | // Print useful data
170 | case 'd':
171 | gp.printStatus();
172 | break;
173 |
174 | // Close the connection
175 | case 'X':
176 | gp.end();
177 | break;
178 | }
179 | gp.keepAlive(); // not needed on HERO3
180 | }
181 |
--------------------------------------------------------------------------------
/examples/GoProControl/Secrets.h:
--------------------------------------------------------------------------------
1 | #ifndef SECRETS_H
2 | #define SECRETS_H
3 |
4 | // Replace the following:
5 | #define GOPRO_SSID "__YOUR_CAMERA_NAME__"
6 | #define GOPRO_PASS "__YOUR_CAMERA_PASS__"
7 |
8 | #endif
9 |
--------------------------------------------------------------------------------
/examples/MultiCam/MultiCam.ino:
--------------------------------------------------------------------------------
1 | #include
2 | #include "Secrets.h"
3 |
4 | /*
5 | Control two or more GoPro
6 | */
7 |
8 | GoProControl Hero_Four(GOPRO_1_SSID, GOPRO_1_PASS, YOUR_CAMERA_1);
9 | GoProControl Hero_Seven(GOPRO_2_SSID, GOPRO_2_PASS, YOUR_CAMERA_2);
10 |
11 | void setup()
12 | {
13 | Hero_Seven.enableDebug(&Serial);
14 | Hero_Four.enableDebug(&Serial);
15 |
16 | Hero_Four.begin();
17 | Hero_Seven.begin();
18 | }
19 |
20 | void loop()
21 | {
22 | Hero_Four.shoot();
23 | delay(1000);
24 | Hero_Seven.shoot();
25 | delay(500);
26 | }
27 |
--------------------------------------------------------------------------------
/examples/MultiCam/Secrets.h:
--------------------------------------------------------------------------------
1 | #ifndef SECRETS_H
2 | #define SECRETS_H
3 |
4 | // replace the following:
5 | #define GOPRO_1_SSID "__YOUR_CAMERA_NAME__"
6 | #define GOPRO_1_PASS "__YOUR_CAMERA_PASS__"
7 |
8 | // same for the second camera:
9 | #define GOPRO_2_SSID "__YOUR_CAMERA_NAME__"
10 | #define GOPRO_2_PASS "__YOUR_CAMERA_PASS__"
11 |
12 | #endif
13 |
--------------------------------------------------------------------------------
/extras/gopro3_and_nodemcu.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aster94/GoProControl/ef566472c375f2090d9d3db9aab9a9309ff02708/extras/gopro3_and_nodemcu.jpg
--------------------------------------------------------------------------------
/extras/gopros_and_esps.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aster94/GoProControl/ef566472c375f2090d9d3db9aab9a9309ff02708/extras/gopros_and_esps.jpg
--------------------------------------------------------------------------------
/keywords.txt:
--------------------------------------------------------------------------------
1 | #######################################
2 | # Syntax Coloring Map
3 | #######################################
4 |
5 | #######################################
6 | # Datatypes (KEYWORD1)
7 | #######################################
8 | GoProControl KEYWORD1
9 |
10 |
11 | #######################################
12 | # Methods and Functions (KEYWORD2)
13 | #######################################
14 | begin KEYWORD2
15 | end KEYWORD2
16 | keepAlive KEYWORD2
17 | confirmPairing KEYWORD2
18 | enableBLE KEYWORD2
19 | disableBLE KEYWORD2
20 | wifiOff KEYWORD2
21 | wifiOn KEYWORD2
22 | turnOn KEYWORD2
23 | turnOff KEYWORD2
24 | status KEYWORD2
25 | isOn KEYWORD2
26 | isConnected KEYWORD2
27 | isRecording KEYWORD2
28 | shoot KEYWORD2
29 | stopShoot KEYWORD2
30 | setMode KEYWORD2
31 | setOrientation KEYWORD2
32 | setVideoResolution KEYWORD2
33 | setVideoFov KEYWORD2
34 | setFrameRate KEYWORD2
35 | setVideoEncoding KEYWORD2
36 | setPhotoResolution KEYWORD2
37 | setTimeLapseInterval KEYWORD2
38 | setContinuousShot KEYWORD2
39 | localizationOn KEYWORD2
40 | localizationOff KEYWORD2
41 | deleteLast KEYWORD2
42 | deleteAll KEYWORD2
43 | enableDebug KEYWORD2
44 | disableDebug KEYWORD2
45 | printStatus KEYWORD2
46 |
47 |
48 | ######################################
49 | # Constants (LITERAL1)
50 | ######################################
51 | HERO LITERAL1
52 | HERO2 LITERAL1
53 | HERO3 LITERAL1
54 | HERO4 LITERAL1
55 | HERO5 LITERAL1
56 | HERO6 LITERAL1
57 | HERO7 LITERAL1
58 | FUSION LITERAL1
59 | HERO8 LITERAL1
60 | MAX LITERAL1
61 | VIDEO_MODE LITERAL1
62 | PHOTO_MODE LITERAL1
63 | BURST_MODE LITERAL1
64 | TIMELAPSE_MODE LITERAL1
65 | TIMER_MODE LITERAL1
66 | PLAY_HDMI_MODE LITERAL1
67 | MULTISHOT_MODE LITERAL1
68 | VIDEO_SUB_MODE LITERAL1
69 | VIDEO_PHOTO_MODE LITERAL1
70 | VIDEO_TIMELAPSE_MODE LITERAL1
71 | VIDEO_LOOPING_MODE LITERAL1
72 | VIDEO_TIMEWARP_MODE LITERAL1
73 | PHOTO_SINGLE_MODE LITERAL1
74 | PHOTO_NIGHT_MODE LITERAL1
75 | MULTISHOT_BURST_MODE LITERAL1
76 | MULTISHOT_TIMELAPSE_MODE LITERAL1
77 | MULTISHOT_NIGHTLAPSE_MODE LITERAL1
78 | ORIENTATION_UP LITERAL1
79 | ORIENTATION_DOWN LITERAL1
80 | ORIENTATION_AUTO LITERAL1
81 | VR_5p6K LITERAL1
82 | VR_4K LITERAL1
83 | VR_2K LITERAL1
84 | VR_2K_SuperView LITERAL1
85 | VR_1440p LITERAL1
86 | VR_1080p_SuperView LITERAL1
87 | VR_1080p LITERAL1
88 | VR_960p LITERAL1
89 | VR_720p_SuperView LITERAL1
90 | VR_720p LITERAL1
91 | VR_WVGA LITERAL1
92 | DUAL360_FOV LITERAL1
93 | WIDE_FOV LITERAL1
94 | MEDIUM_FOV LITERAL1
95 | NARROW_FOV LITERAL1
96 | LINEAR_FOV LITERAL1
97 | FR_240 LITERAL1
98 | FR_120 LITERAL1
99 | FR_100 LITERAL1
100 | FR_90 LITERAL1
101 | FR_80 LITERAL1
102 | FR_60 LITERAL1
103 | FR_50 LITERAL1
104 | FR_48 LITERAL1
105 | FR_30 LITERAL1
106 | FR_25 LITERAL1
107 | FR_24 LITERAL1
108 | FR_15 LITERAL1
109 | FR_12p5 LITERAL1
110 | FR_12 LITERAL1
111 | NTSC LITERAL1
112 | PAL LITERAL1
113 | PR_12MP_WIDE LITERAL1
114 | PR_12MP_MEDIUM LITERAL1
115 | PR_12MP_NARROW LITERAL1
116 | PR_12MP_LINEAR LITERAL1
117 | PR_11MP_WIDE LITERAL1
118 | PR_8MP_WIDE LITERAL1
119 | PR_8MP_MEDIUM LITERAL1
120 | PR_7MP_WIDE LITERAL1
121 | PR_7MP_MEDIUM LITERAL1
122 | PR_5MP_WIDE LITERAL1
123 | PR_5MP_MEDIUM LITERAL1
124 |
--------------------------------------------------------------------------------
/library.properties:
--------------------------------------------------------------------------------
1 | name=GoProControl
2 | version=1.3.2
3 | author=aster94
4 | maintainer=aster94, KonradIT
5 | sentence=A library that makes using GoPro Cameras a breeze.
6 | paragraph=Control your GoPro HERO3, HERO4, HERO5, HERO6, HERO7, FUSION, HERO8, MAX from Arduino
7 | category=Device Control
8 | url=https://github.com/aster94/GoProControl/
9 | architectures=*
10 | depends=WiFi101, WiFiNINA, VidorPeripherals, WiFiEsp, Utilities
11 |
--------------------------------------------------------------------------------
/platformio.ini:
--------------------------------------------------------------------------------
1 | ; PlatformIO Project Configuration File
2 |
3 | [platformio]
4 | ;src_dir = examples/ArduinoJson
5 | ;src_dir = examples/ESP32_FreeRTOS
6 | src_dir = examples/GoProControl
7 | ;src_dir = examples/MultiCam
8 | lib_dir = .
9 | ;default_envs = esp32
10 |
11 | [env]
12 | framework = arduino
13 | monitor_speed = 115200
14 | lib_deps =
15 | 6235 ; Utilities
16 | 64 ; ArduinoJson
17 |
18 | [env:stm32]
19 | platform = ststm32
20 | board = maple_mini_b20
21 | lib_deps =
22 | ${env.lib_deps}
23 | 509 ; WiFiEsp
24 |
25 | [env:avr]
26 | platform = atmelavr
27 | board = nanoatmega328
28 | lib_deps =
29 | ${env.lib_deps}
30 | 509 ; WiFiEsp
31 |
32 | [env:esp8266]
33 | platform = espressif8266
34 | board = d1_mini
35 |
36 | [env:esp32]
37 | platform = espressif32
38 | board = lolin32
39 |
40 | [env:mkrwifi1010]
41 | platform = atmelsam
42 | board = mkrwifi1010
43 | lib_deps =
44 | ${env.lib_deps}
45 | 5538 ; WiFiNINA
46 |
--------------------------------------------------------------------------------
/src/GoProControl.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | GoProControl.cpp
3 |
4 | Permission is hereby granted, free of charge, to any person obtaining a copy of
5 | this software and associated documentation files (the "Software"), to deal in
6 | the Software without restriction, including without limitation the rights to
7 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
8 | the Software, and to permit persons to whom the Software is furnished to do so,
9 | subject to the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be included in all
12 | copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
16 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
17 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
18 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20 | */
21 |
22 | #include
23 | #include
24 |
25 | // todo _request as char array
26 |
27 | ////////////////////////////////////////////////////////////
28 | //////// Constructor ////////
29 | ////////////////////////////////////////////////////////////
30 |
31 | GoProControl::GoProControl(const char *ssid, const char *pwd, const uint8_t camera,
32 | const uint8_t gopro_mac[], const char *board_name)
33 | {
34 | _ssid = (char *)ssid;
35 | _pwd = (char *)pwd;
36 | _camera = camera;
37 |
38 | // GoPro MAC
39 | if (gopro_mac != NULL)
40 | {
41 | memcpy(_gopro_mac, gopro_mac, MAC_ADDRESS_LENGTH);
42 | }
43 | else
44 | {
45 | memset(_gopro_mac, 0, MAC_ADDRESS_LENGTH); // Empty the array
46 | }
47 |
48 | // Board Hostname
49 | #if defined(ARDUINO_ARCH_ESP32)
50 | if (strcmp(board_name, "") != 0)
51 | {
52 | WiFi.setHostname(board_name);
53 | }
54 | #endif
55 | _board_name = (char *)"";
56 |
57 | memset(_board_mac, 0, MAC_ADDRESS_LENGTH); // Empty the array
58 | }
59 |
60 | ////////////////////////////////////////////////////////////
61 | //////// Communication /////////
62 | ////////////////////////////////////////////////////////////
63 |
64 | uint8_t GoProControl::begin()
65 | {
66 | if (_connected == true)
67 | {
68 | if (_debug)
69 | {
70 | _debug_port->println("Already connected");
71 | }
72 | return false;
73 | }
74 |
75 | if (_camera <= HERO2)
76 | {
77 | if (_debug)
78 | {
79 | _debug_port->println("Camera not supported");
80 | }
81 | return -1;
82 | }
83 |
84 | if (_debug)
85 | {
86 | _debug_port->print("Attempting to connect to SSID: \"");
87 | _debug_port->print(_ssid);
88 | _debug_port->print("\"\nUsing password: \"");
89 | _debug_port->print(_pwd);
90 | _debug_port->print("\"\n");
91 | }
92 |
93 | WiFi.begin(_ssid, _pwd);
94 |
95 | uint32_t start_time = millis();
96 | while (WiFi.status() != WL_CONNECTED && start_time + MAX_WAIT_TIME > millis())
97 | {
98 | if (_debug)
99 | {
100 | _debug_port->print(".");
101 | }
102 | delay(100);
103 | }
104 |
105 | if (WiFi.status() == WL_CONNECTED)
106 | {
107 | if (_debug)
108 | {
109 | _debug_port->println("\nConnected to GoPro");
110 | }
111 | _connected = true;
112 | getWiFiData();
113 | return true;
114 | }
115 | else
116 | {
117 | if (_debug)
118 | {
119 | _debug_port->print("\nConnection failed with status: ");
120 | _debug_port->println(WiFi.status());
121 | }
122 | _connected = false;
123 | }
124 |
125 | return -(WiFi.status());
126 | }
127 |
128 | void GoProControl::end()
129 | {
130 | if (_connected == false)
131 | {
132 | if (_debug)
133 | {
134 | _debug_port->println("Camera not connected yet");
135 | }
136 | return;
137 | }
138 |
139 | if (_debug)
140 | {
141 | _debug_port->println("Closing connection");
142 | }
143 | _udp_client.stop();
144 | _wifi_client.stop();
145 | WiFi.disconnect();
146 | _connected = false;
147 | _recording = false;
148 | memset(_gopro_mac, 0, MAC_ADDRESS_LENGTH);
149 | }
150 |
151 | uint8_t GoProControl::keepAlive()
152 | {
153 | if (_connected == false) // camera not connected
154 | {
155 | return false;
156 | }
157 |
158 | if (millis() - _last_request <= KEEP_ALIVE)
159 | {
160 | // we made a request not so much earlier
161 | return false;
162 | }
163 | else
164 | { // time to ask something to the camera
165 | if (_camera == HERO3)
166 | {
167 | // not needed since the connection won't be closed by the camera (tested
168 | // for more then 6 minutes)
169 | return true;
170 | }
171 | else if (_camera >= HERO4)
172 | {
173 | if (_debug)
174 | {
175 | _debug_port->println("Keeping connection alive");
176 | }
177 | sendRequest("_GPHD_:0:0:2:0.000000\n");
178 | }
179 | }
180 | return true;
181 | }
182 |
183 | uint8_t GoProControl::confirmPairing()
184 | {
185 | if (_connected == false) // not connected
186 | {
187 | if (_debug)
188 | {
189 | _debug_port->println("Connect the camera first");
190 | }
191 | return false;
192 | }
193 |
194 | if (_camera == HERO3)
195 | {
196 | if (_debug)
197 | {
198 | _debug_port->println("Not supported by HERO3");
199 | }
200 | return false;
201 | }
202 | else if (_camera == HERO4)
203 | {
204 | if (_debug)
205 | {
206 | _debug_port->println("Not implemented yet, see readME");
207 | }
208 | return false;
209 | }
210 | else if (_camera >= HERO5)
211 | {
212 | makeRequest(_request, "/gp/gpControl/command/wireless/pair/complete?success=1&deviceName=",
213 | _board_name);
214 | }
215 |
216 | return handleHTTPRequest(_request);
217 | }
218 |
219 | ////////////////////////////////////////////////////////////
220 | //////// BLE /////////
221 | ////////////////////////////////////////////////////////////
222 |
223 | #if defined(ARDUINO_ARCH_ESP32)
224 | // none of these function will work, I am adding these for a future release, see
225 | // the readME
226 | // https://github.com/KonradIT/goprowifihack/blob/master/HERO5/HERO5-Commands.md#bluetooth-pairing
227 | uint8_t GoProControl::enableBLE()
228 | {
229 | if (_camera <= HERO3)
230 | {
231 | if (_debug)
232 | {
233 | _debug_port->println("Your camera doesn't have Bluetooth");
234 | }
235 | return false;
236 | }
237 | BLE_ENABLED = true;
238 | return true;
239 | }
240 |
241 | uint8_t GoProControl::disableBLE()
242 | {
243 | if (_camera <= HERO3)
244 | {
245 | if (_debug)
246 | {
247 | _debug_port->println("Your camera doesn't have Bluetooth");
248 | }
249 | return false;
250 | }
251 | BLE_ENABLED = false;
252 | return true;
253 | }
254 |
255 | uint8_t GoProControl::wifiOff()
256 | {
257 | if (_camera <= HERO3)
258 | {
259 | if (_debug)
260 | {
261 | _debug_port->println("Your camera doesn't have Bluetooth");
262 | }
263 | return false;
264 | }
265 |
266 | if (BLE_ENABLED == false) // prevent stupid error like turn off the wifi
267 | // while we didn't connected to the BL yet
268 | {
269 | if (_debug)
270 | {
271 | _debug_port->println("First run enableBLE()");
272 | }
273 | return false;
274 | }
275 |
276 | WIFI_MODE = false;
277 | return sendBLERequest(BLE_WiFiOff);
278 | }
279 |
280 | uint8_t GoProControl::wifiOn()
281 | {
282 | if (_camera <= HERO3)
283 | {
284 | if (_debug)
285 | {
286 | _debug_port->println("Your camera doesn't have Bluetooth");
287 | }
288 | return false;
289 | }
290 | WIFI_MODE = true;
291 | return sendBLERequest(BLE_WiFiOn);
292 | }
293 | #endif // BLE functions
294 |
295 | ////////////////////////////////////////////////////////////
296 | //////// Control /////////
297 | ////////////////////////////////////////////////////////////
298 |
299 | uint8_t GoProControl::turnOn()
300 | {
301 | if (_connected == false) // not connected
302 | {
303 | if (_debug)
304 | {
305 | _debug_port->println("Connect the camera first");
306 | }
307 | return false;
308 | }
309 |
310 | if (_camera == HERO3)
311 | {
312 | makeRequest(_request, "/bacpac/PW?t=", _pwd, "&p=%01");
313 | }
314 | else if (_camera >= HERO4)
315 | {
316 | if (_gopro_mac[0] == 0)
317 | {
318 | if (_debug)
319 | {
320 | _debug_port->println("No BSSID, unable to turn on the camera");
321 | #if defined(ARDUINO_ARCH_ESP8266)
322 | _debug_port->println("The ESP8266 can't get the BSSID, you need to pass it in the "
323 | "constructor, see the README");
324 | #endif
325 | }
326 | return false;
327 | }
328 | else
329 | {
330 | sendWoL();
331 | if (isOn())
332 | {
333 | return true;
334 | }
335 | else
336 | {
337 | return false;
338 | }
339 | }
340 | }
341 |
342 | return handleHTTPRequest(_request);
343 | }
344 |
345 | uint8_t GoProControl::turnOff(const bool force)
346 | {
347 | if (_connected == false) // not connected
348 | {
349 | if (_debug)
350 | {
351 | _debug_port->println("Connect the camera first");
352 | }
353 | return false;
354 | }
355 |
356 | if (_camera == HERO3)
357 | {
358 | makeRequest(_request, "/bacpac/PW?t=", _pwd, "&p=%00");
359 | }
360 | else if (_camera >= HERO4)
361 | {
362 | if (_gopro_mac[0] == 0 && force == false)
363 | {
364 | getBSSID();
365 | if (_debug)
366 | {
367 | _debug_port->println("BSSID not ready, try again");
368 | }
369 | return false;
370 | }
371 | else if (_gopro_mac[0] == 0 && force)
372 | {
373 | if (_debug)
374 | {
375 | _debug_port->println(
376 | "Forcing turnOff, you won't be able to turnOn again from arduino");
377 | }
378 | }
379 | makeRequest(_request, "/gp/gpControl/command/system/sleep");
380 | }
381 |
382 | return handleHTTPRequest(_request);
383 | }
384 |
385 | ////////////////////////////////////////////////////////////
386 | ////// Status //////
387 | ////////////////////////////////////////////////////////////
388 |
389 | char *GoProControl::getStatus()
390 | {
391 | if (_connected == false) // not connected
392 | {
393 | if (_debug)
394 | {
395 | _debug_port->println("Connect the camera first");
396 | }
397 | return (char *)'\0';
398 | }
399 |
400 | if (_camera == HERO3)
401 | {
402 | makeRequest(_request, "/camera/sx?t=", _pwd);
403 | sendHTTPRequest(_request);
404 | if (listenResponse(true)) // set the parameter to true to add a delay waiting the response
405 | {
406 | int16_t len = extractResponselength();
407 | char *status_buffer = (char *)malloc((len * sizeof(char))); // Allocate memory
408 | int16_t start = stringSearch(_response_buffer, "\r\n\r\n") + 4;
409 | int16_t end = start + len;
410 | for(int i = 0; i < len; i++)
411 | {
412 | status_buffer[i] = _response_buffer[i + start];
413 | }
414 | if (len > 0)
415 | {
416 | return status_buffer;
417 | }
418 | }
419 | }
420 |
421 | else if (_camera >= HERO4)
422 | {
423 | makeRequest(_request, "/gp/gpControl/status");
424 | sendHTTPRequest(_request);
425 | if (listenResponse(true)) // set the parameter to true to add a delay waiting the response
426 | {
427 | int16_t start = stringSearch(_response_buffer, "{\"s");
428 | int16_t end = stringSearch(_response_buffer, "}}") + 2;
429 | if (start != -1 && end != -1)
430 | {
431 | return stringCut(_response_buffer, start, end);
432 | }
433 | }
434 | }
435 | return (char *)'\0';
436 | }
437 |
438 | char *GoProControl::getMediaList()
439 | {
440 | if (_connected == false) // not connected
441 | {
442 | if (_debug)
443 | {
444 | _debug_port->println("Connect the camera first");
445 | }
446 | return (char *)'\0';
447 | }
448 |
449 | sendHTTPRequest("/gp/gpMediaList", 8080);
450 | if (listenResponse(true))
451 | {
452 | int16_t start = stringSearch(_response_buffer, "{\"i");
453 | int16_t end = stringSearch(_response_buffer, "}]}]}") + 5; // 5 is the length of the pattern
454 | if (start != -1 && end != -1)
455 | {
456 | return stringCut(_response_buffer, start, end);
457 | }
458 | }
459 | return (char *)'\0';
460 | }
461 |
462 | bool GoProControl::isOn()
463 | {
464 | if (_connected == false) // not connected
465 | {
466 | if (_debug)
467 | {
468 | _debug_port->println("Connect the camera first");
469 | }
470 | return false;
471 | }
472 |
473 | if (_camera == HERO3)
474 | {
475 | // this isn't supported by this camera so this function will always return
476 | // true => with status on Hero3 we can see if camera is on with the Byte 0. if byte[0]=0 camera ON, if byte[0]=1 camera OFF
477 | return true;
478 | }
479 | else if (_camera >= HERO4)
480 | {
481 | makeRequest(_request, "/gp/gpControl/status");
482 | }
483 |
484 | if (sendHTTPRequest(_request) == true)
485 | {
486 | return true;
487 | }
488 | else
489 | {
490 | return false;
491 | }
492 | }
493 |
494 | bool GoProControl::isConnected(const bool silent)
495 | {
496 | if (_connected == true)
497 | {
498 | if (_debug && silent == false)
499 | {
500 | _debug_port->println("\nCamera connected");
501 | }
502 | return true;
503 | }
504 | else
505 | {
506 | if (_debug && silent == false)
507 | {
508 | _debug_port->println("\nNot connected");
509 | }
510 | return false;
511 | }
512 | }
513 |
514 | bool GoProControl::getConnection() // Add, test if gopro still connected without any action on camera. isConnected() need action on camera (shoot for example) to see if the camera is disconnected.
515 | {
516 |
517 | if (WiFi.status() == WL_CONNECTED)
518 | {
519 | if (_debug)
520 | {
521 | _debug_port->println("\nConnected to GoPro");
522 | }
523 | _connected = true;
524 | getWiFiData();
525 | return true;
526 | }
527 | else
528 | {
529 | if (_debug)
530 | {
531 | _debug_port->print("\nConnection failed with status: ");
532 | _debug_port->println(WiFi.status());
533 | }
534 | _connected = false;
535 | return false;
536 | }
537 | }
538 |
539 | bool GoProControl::isRecording()
540 | {
541 | if (_connected == false) // not connected
542 | {
543 | if (_debug)
544 | {
545 | _debug_port->println("Connect the camera first");
546 | }
547 | return false;
548 | }
549 |
550 | return _recording;
551 | }
552 |
553 | ////////////////////////////////////////////////////////////
554 | //////// Shoot /////////
555 | ////////////////////////////////////////////////////////////
556 |
557 | uint8_t GoProControl::shoot()
558 | {
559 | if (_connected == false) // not connected
560 | {
561 | if (_debug)
562 | {
563 | _debug_port->println("Connect the camera first");
564 | }
565 | return false;
566 | }
567 |
568 | bool result = false;
569 |
570 | if (WIFI_MODE)
571 | {
572 | if (_camera == HERO3)
573 | {
574 | makeRequest(_request, "/bacpac/SH?t=", _pwd, "&p=%01");
575 | }
576 | else if (_camera >= HERO4)
577 | {
578 | makeRequest(_request, "/gp/gpControl/command/shutter?p=1");
579 | }
580 |
581 | result = handleHTTPRequest(_request);
582 | }
583 | else
584 | { // BLE
585 | #if defined(ARDUINO_ARCH_ESP32)
586 | result = sendBLERequest(BLE_RecordStart);
587 | #endif
588 | }
589 | if (result == true && _mode >= VIDEO_MODE && _mode <= VIDEO_TIMEWARP_MODE)
590 | {
591 | _recording = true;
592 | }
593 | return result;
594 | }
595 |
596 | uint8_t GoProControl::stopShoot()
597 | {
598 | if (_connected == false) // not connected
599 | {
600 | if (_debug)
601 | {
602 | _debug_port->println("Connect the camera first");
603 | }
604 | return false;
605 | }
606 |
607 | bool result = false;
608 |
609 | if (WIFI_MODE)
610 | {
611 | if (_camera == HERO3)
612 | {
613 | makeRequest(_request, "/bacpac/SH?t=", _pwd, "&p=%00");
614 | }
615 | else if (_camera >= HERO4)
616 | {
617 | makeRequest(_request, "/gp/gpControl/command/shutter?p=0");
618 | }
619 |
620 | result = handleHTTPRequest(_request);
621 | }
622 | else // BLE
623 | {
624 | #if defined(ARDUINO_ARCH_ESP32)
625 | result = sendBLERequest(BLE_RecordStop);
626 | #endif
627 | }
628 | if (result == true)
629 | {
630 | _recording = false;
631 | }
632 | return result;
633 | }
634 |
635 | ////////////////////////////////////////////////////////////
636 | //////// Settings ////////
637 | ////////////////////////////////////////////////////////////
638 |
639 | uint8_t GoProControl::setMode(const uint8_t option)
640 | {
641 | if (_connected == false) // not connected
642 | {
643 | if (_debug)
644 | {
645 | _debug_port->println("Connect the camera first");
646 | }
647 | return false;
648 | }
649 |
650 | bool result = false;
651 |
652 | if (WIFI_MODE)
653 | {
654 | if (_camera == HERO3)
655 | {
656 | switch (option)
657 | {
658 | case VIDEO_MODE:
659 | _parameter = (char *)"00";
660 | break;
661 | case PHOTO_MODE:
662 | _parameter = (char *)"01";
663 | break;
664 | case BURST_MODE:
665 | _parameter = (char *)"02";
666 | break;
667 | case TIMELAPSE_MODE:
668 | _parameter = (char *)"03";
669 | break;
670 | case TIMER_MODE:
671 | _parameter = (char *)"04";
672 | break;
673 | case PLAY_HDMI_MODE:
674 | _parameter = (char *)"05";
675 | break;
676 | default:
677 | if (_debug)
678 | {
679 | _debug_port->println("Wrong parameter for setMode");
680 | }
681 | return -1;
682 | }
683 | makeRequest(_request, "camera/CM?t=", _pwd, "&p=%", _parameter);
684 | }
685 | else if (_camera >= HERO4)
686 | {
687 | _sub_parameter = (char *)"";
688 | switch (option)
689 | {
690 | case VIDEO_MODE:
691 | _parameter = (char *)"0";
692 | break;
693 | case VIDEO_SUB_MODE:
694 | _parameter = (char *)"0";
695 | _sub_parameter = (char *)"0";
696 | break;
697 | case VIDEO_TIMELAPSE_MODE:
698 | _parameter = (char *)"0";
699 | _sub_parameter = (char *)"1";
700 | break;
701 | case VIDEO_PHOTO_MODE:
702 | _parameter = (char *)"0";
703 | _sub_parameter = (char *)"2";
704 | break;
705 | case VIDEO_LOOPING_MODE:
706 | _parameter = (char *)"0";
707 | _sub_parameter = (char *)"3";
708 | break;
709 | case VIDEO_TIMEWARP_MODE:
710 | _parameter = (char *)"0";
711 | _sub_parameter = (char *)"4";
712 | break;
713 |
714 | case PHOTO_MODE:
715 | _parameter = (char *)"1";
716 | break;
717 | case PHOTO_SINGLE_MODE:
718 | _parameter = (char *)"1";
719 | _sub_parameter = (char *)"1";
720 | break;
721 | case PHOTO_NIGHT_MODE:
722 | _parameter = (char *)"1";
723 | _sub_parameter = (char *)"2";
724 | break;
725 |
726 | case MULTISHOT_MODE:
727 | _parameter = (char *)"2";
728 | break;
729 | case MULTISHOT_BURST_MODE:
730 | _parameter = (char *)"2";
731 | _sub_parameter = (char *)"0";
732 | break;
733 | case MULTISHOT_TIMELAPSE_MODE:
734 | _parameter = (char *)"2";
735 | _sub_parameter = (char *)"1";
736 | break;
737 | case MULTISHOT_NIGHTLAPSE_MODE:
738 | _parameter = (char *)"2";
739 | _sub_parameter = (char *)"2";
740 | break;
741 |
742 | default:
743 | if (_debug)
744 | {
745 | _debug_port->println("Wrong parameter for setMode");
746 | }
747 | return -1;
748 | }
749 |
750 | if (_sub_parameter == (char *)"")
751 | {
752 | makeRequest(_request, "/gp/gpControl/command/mode?p=", _parameter);
753 | }
754 | else
755 | {
756 | makeRequest(_request, "/gp/gpControl/command/sub_mode?mode=", _parameter,
757 | "&sub_mode=", _sub_parameter);
758 | }
759 | }
760 | _mode = option;
761 | result = handleHTTPRequest(_request);
762 | }
763 | else
764 | { // BLE
765 | #if defined(ARDUINO_ARCH_ESP32)
766 | switch (option)
767 | {
768 | case VIDEO_MODE:
769 | result = sendBLERequest(BLE_ModeVideo);
770 | break;
771 | case PHOTO_MODE:
772 | result = sendBLERequest(BLE_ModePhoto);
773 | break;
774 | case MULTISHOT_MODE:
775 | result = sendBLERequest(BLE_ModeMultiShot);
776 | break;
777 | default:
778 | if (_debug)
779 | {
780 | _debug_port->println("Wrong parameter for setMode");
781 | }
782 | return -1;
783 | }
784 | #endif
785 | }
786 | return result;
787 | }
788 |
789 | uint8_t GoProControl::setOrientation(const uint8_t option)
790 | {
791 | if (_connected == false) // not connected
792 | {
793 | if (_debug)
794 | {
795 | _debug_port->println("Connect the camera first");
796 | }
797 | return false;
798 | }
799 |
800 | if (_camera == HERO3)
801 | {
802 | switch (option)
803 | {
804 | case ORIENTATION_UP:
805 | _parameter = (char *)"00";
806 | break;
807 | case ORIENTATION_DOWN:
808 | _parameter = (char *)"01";
809 | break;
810 | default:
811 | if (_debug)
812 | {
813 | _debug_port->println("Wrong parameter for setOrientation");
814 | }
815 | return -1;
816 | }
817 | makeRequest(_request, "camera/UP?t=", _pwd, "&p=%", _parameter);
818 | }
819 | else if (_camera >= HERO4)
820 | {
821 | switch (option)
822 | {
823 | case ORIENTATION_UP:
824 | _parameter = (char *)"0";
825 | break;
826 | case ORIENTATION_DOWN:
827 | _parameter = (char *)"1";
828 | break;
829 | case ORIENTATION_AUTO:
830 | _parameter = (char *)"2";
831 | break;
832 | default:
833 | if (_debug)
834 | {
835 | _debug_port->println("Wrong parameter for setOrientation");
836 | }
837 | return -1;
838 | }
839 | makeRequest(_request, "/gp/gpControl/setting/52/", _parameter);
840 | }
841 |
842 | return handleHTTPRequest(_request);
843 | }
844 |
845 | ////////////////////////////////////////////////////////////
846 | //////// Video /////////
847 | ////////////////////////////////////////////////////////////
848 |
849 | uint8_t GoProControl::setVideoResolution(const uint8_t option)
850 | {
851 | if (_connected == false) // not connected
852 | {
853 | if (_debug)
854 | {
855 | _debug_port->println("Connect the camera first");
856 | }
857 | return false;
858 | }
859 |
860 | if (_camera == HERO3)
861 | {
862 | switch (option)
863 | {
864 | case VR_1080p:
865 | _parameter = (char *)"06";
866 | break;
867 | case VR_960p:
868 | _parameter = (char *)"05";
869 | break;
870 | case VR_720p:
871 | _parameter = (char *)"03";
872 | break;
873 | case VR_WVGA:
874 | _parameter = (char *)"01";
875 | break;
876 | default:
877 | if (_debug)
878 | {
879 | _debug_port->println("Wrong parameter for setVideoResolution");
880 | }
881 | return -1;
882 | }
883 | makeRequest(_request, "camera/VR?t=", _pwd, "&p=%", _parameter);
884 | }
885 | else if (_camera >= HERO4)
886 | {
887 | switch (option)
888 | {
889 | case VR_5p6K:
890 | _parameter = (char *)"21";
891 | break;
892 | case VR_4K:
893 | _parameter = (char *)"1";
894 | break;
895 | case VR_2K:
896 | _parameter = (char *)"4";
897 | break;
898 | case VR_2K_SuperView:
899 | _parameter = (char *)"5";
900 | break;
901 | case VR_1440p:
902 | _parameter = (char *)"7";
903 | break;
904 | case VR_1080p_SuperView:
905 | _parameter = (char *)"8";
906 | break;
907 | case VR_1080p:
908 | _parameter = (char *)"9";
909 | break;
910 | case VR_960p:
911 | _parameter = (char *)"10";
912 | break;
913 | case VR_720p_SuperView:
914 | _parameter = (char *)"11";
915 | break;
916 | case VR_720p:
917 | _parameter = (char *)"12";
918 | break;
919 | case VR_WVGA:
920 | _parameter = (char *)"13";
921 | break;
922 | default:
923 | if (_debug)
924 | {
925 | _debug_port->println("Wrong parameter for setVideoResolution");
926 | }
927 | return -1;
928 | }
929 | makeRequest(_request, "/gp/gpControl/setting/2/", _parameter);
930 | }
931 |
932 | return handleHTTPRequest(_request);
933 | }
934 |
935 | uint8_t GoProControl::setVideoFov(const uint8_t option)
936 | {
937 | if (_connected == false) // not connected
938 | {
939 | if (_debug)
940 | {
941 | _debug_port->println("Connect the camera first");
942 | }
943 | return false;
944 | }
945 |
946 | if (_camera == HERO3)
947 | {
948 | switch (option)
949 | {
950 | case WIDE_FOV:
951 | _parameter = (char *)"00";
952 | break;
953 | case MEDIUM_FOV:
954 | _parameter = (char *)"01";
955 | break;
956 | case NARROW_FOV:
957 | _parameter = (char *)"02";
958 | break;
959 | default:
960 | if (_debug)
961 | {
962 | _debug_port->println("Wrong parameter for setVideoFov");
963 | }
964 | return -1;
965 | }
966 |
967 | makeRequest(_request, "camera/FV?t=", _pwd, "&p=%", _parameter);
968 | }
969 | else if (_camera >= HERO4 && _camera <= HERO7)
970 | {
971 | switch (option)
972 | {
973 | case WIDE_FOV:
974 | _parameter = (char *)"0";
975 | break;
976 | case MEDIUM_FOV:
977 | _parameter = (char *)"1";
978 | break;
979 | case NARROW_FOV:
980 | _parameter = (char *)"2";
981 | break;
982 | case LINEAR_FOV:
983 | _parameter = (char *)"4";
984 | break;
985 | default:
986 | if (_debug)
987 | {
988 | _debug_port->println("Wrong parameter for setVideoFov");
989 | }
990 | return -1;
991 | }
992 | makeRequest(_request, "/gp/gpControl/setting/4/", _parameter);
993 | }
994 | else if (_camera >= HERO8)
995 | {
996 | switch (option)
997 | {
998 | case DUAL360_FOV:
999 | _parameter = (char *)"5";
1000 | break;
1001 | case WIDE_FOV:
1002 | _parameter = (char *)"0";
1003 | break;
1004 | case MEDIUM_FOV:
1005 | _parameter = (char *)"1";
1006 | break;
1007 | case NARROW_FOV:
1008 | _parameter = (char *)"6";
1009 | break;
1010 | case LINEAR_FOV:
1011 | _parameter = (char *)"4";
1012 | break;
1013 | default:
1014 | if (_debug)
1015 | {
1016 | _debug_port->println("Wrong parameter for setVideoFov");
1017 | }
1018 | return -1;
1019 | }
1020 | makeRequest(_request, "/gp/gpControl/setting/121/", _parameter);
1021 | }
1022 |
1023 | return handleHTTPRequest(_request);
1024 | }
1025 |
1026 | uint8_t GoProControl::setFrameRate(const uint8_t option)
1027 | {
1028 | if (_connected == false) // not connected
1029 | {
1030 | if (_debug)
1031 | {
1032 | _debug_port->println("Connect the camera first");
1033 | }
1034 | return false;
1035 | }
1036 |
1037 | if (_camera == HERO3)
1038 | {
1039 | switch (option)
1040 | {
1041 | case FR_240:
1042 | _parameter = (char *)"0a";
1043 | break;
1044 | case FR_120:
1045 | _parameter = (char *)"09";
1046 | break;
1047 | case FR_100:
1048 | _parameter = (char *)"08";
1049 | break;
1050 | case FR_60:
1051 | _parameter = (char *)"07";
1052 | break;
1053 | case FR_50:
1054 | _parameter = (char *)"06";
1055 | break;
1056 | case FR_48:
1057 | _parameter = (char *)"05";
1058 | break;
1059 | case FR_30:
1060 | _parameter = (char *)"04";
1061 | break;
1062 | case FR_25:
1063 | _parameter = (char *)"03";
1064 | break;
1065 | case FR_24:
1066 | _parameter = (char *)"02";
1067 | break;
1068 | case FR_12p5:
1069 | _parameter = (char *)"0b";
1070 | break;
1071 | case FR_15:
1072 | _parameter = (char *)"01";
1073 | break;
1074 | case FR_12:
1075 | _parameter = (char *)"00";
1076 | break;
1077 | default:
1078 | if (_debug)
1079 | {
1080 | _debug_port->println("Wrong parameter for setFrameRate");
1081 | }
1082 | return -1;
1083 | }
1084 | makeRequest(_request, "camera/FS?t=", _pwd, "&p=%", _parameter);
1085 | }
1086 | else if (_camera >= HERO4)
1087 | {
1088 | switch (option)
1089 | {
1090 | case FR_240:
1091 | _parameter = (char *)"0";
1092 | break;
1093 | case FR_120:
1094 | _parameter = (char *)"1";
1095 | break;
1096 | case FR_100:
1097 | _parameter = (char *)"2";
1098 | break;
1099 | case FR_90:
1100 | _parameter = (char *)"3";
1101 | break;
1102 | case FR_80:
1103 | _parameter = (char *)"4";
1104 | break;
1105 | case FR_60:
1106 | _parameter = (char *)"5";
1107 | break;
1108 | case FR_50:
1109 | _parameter = (char *)"6";
1110 | break;
1111 | case FR_48:
1112 | _parameter = (char *)"7";
1113 | break;
1114 | case FR_30:
1115 | _parameter = (char *)"8";
1116 | break;
1117 | case FR_25:
1118 | _parameter = (char *)"9";
1119 | break;
1120 | default:
1121 | if (_debug)
1122 | {
1123 | _debug_port->println("Wrong parameter for setFrameRate");
1124 | }
1125 | return -1;
1126 | }
1127 | makeRequest(_request, "/gp/gpControl/setting/3/", _parameter);
1128 | }
1129 |
1130 | return handleHTTPRequest(_request);
1131 | }
1132 |
1133 | uint8_t GoProControl::setVideoEncoding(const uint8_t option)
1134 | {
1135 | if (_connected == false) // not connected
1136 | {
1137 | if (_debug)
1138 | {
1139 | _debug_port->println("Connect the camera first");
1140 | }
1141 | return false;
1142 | }
1143 |
1144 | if (_camera == HERO3)
1145 | {
1146 | switch (option)
1147 | {
1148 | case NTSC:
1149 | _parameter = (char *)"00";
1150 | break;
1151 | case PAL:
1152 | _parameter = (char *)"01";
1153 | break;
1154 | default:
1155 | if (_debug)
1156 | {
1157 | _debug_port->println("Wrong parameter for setVideoEncoding");
1158 | }
1159 | return -1;
1160 | }
1161 | makeRequest(_request, "camera/VM?t=", _pwd, "&p=%", _parameter);
1162 | }
1163 | else if (_camera >= HERO4)
1164 | {
1165 | switch (option)
1166 | {
1167 | case NTSC:
1168 | _parameter = (char *)"0";
1169 | break;
1170 | case PAL:
1171 | _parameter = (char *)"1";
1172 | break;
1173 | default:
1174 | if (_debug)
1175 | {
1176 | _debug_port->println("Wrong parameter for setVideoEncoding");
1177 | }
1178 | return -1;
1179 | }
1180 | makeRequest(_request, "/gp/gpControl/setting/57/", _parameter);
1181 | }
1182 |
1183 | return handleHTTPRequest(_request);
1184 | }
1185 |
1186 | ////////////////////////////////////////////////////////////
1187 | //////// Photo /////////
1188 | ////////////////////////////////////////////////////////////
1189 |
1190 | uint8_t GoProControl::setPhotoResolution(const uint8_t option)
1191 | {
1192 | if (_connected == false) // not connected
1193 | {
1194 | if (_debug)
1195 | {
1196 | _debug_port->println("Connect the camera first");
1197 | }
1198 | return false;
1199 | }
1200 |
1201 | if (_camera == HERO3)
1202 | {
1203 | switch (option)
1204 | {
1205 | case PR_11MP_WIDE:
1206 | _parameter = (char *)"00";
1207 | break;
1208 | case PR_8MP_WIDE:
1209 | _parameter = (char *)"01";
1210 | break;
1211 | case PR_5MP_WIDE:
1212 | _parameter = (char *)"02";
1213 | break;
1214 | default:
1215 | if (_debug)
1216 | {
1217 | _debug_port->println("Wrong parameter for setPhotoResolution");
1218 | }
1219 | return -1;
1220 | }
1221 | makeRequest(_request, "camera/PR?t=", _pwd, "&p=%", _parameter);
1222 | }
1223 | else if (_camera >= HERO4)
1224 | {
1225 | switch (option)
1226 | {
1227 | case PR_12MP_WIDE:
1228 | _parameter = (char *)"0";
1229 | break;
1230 | case PR_12MP_LINEAR:
1231 | _parameter = (char *)"10";
1232 | break;
1233 | case PR_12MP_MEDIUM:
1234 | _parameter = (char *)"8";
1235 | break;
1236 | case PR_12MP_NARROW:
1237 | _parameter = (char *)"9";
1238 | break;
1239 | case PR_7MP_WIDE:
1240 | _parameter = (char *)"1";
1241 | break;
1242 | case PR_7MP_MEDIUM:
1243 | _parameter = (char *)"2";
1244 | break;
1245 | case PR_5MP_WIDE:
1246 | _parameter = (char *)"3";
1247 | break;
1248 | default:
1249 | if (_debug)
1250 | {
1251 | _debug_port->println("Wrong parameter for setPhotoResolution");
1252 | }
1253 | return -1;
1254 | }
1255 | makeRequest(_request, "/gp/gpControl/setting/17/", _parameter);
1256 | }
1257 |
1258 | return handleHTTPRequest(_request);
1259 | }
1260 |
1261 | uint8_t GoProControl::setTimeLapseInterval(float option)
1262 | {
1263 | if (_connected == false) // not connected
1264 | {
1265 | if (_debug)
1266 | {
1267 | _debug_port->println("Connect the camera first");
1268 | }
1269 | return false;
1270 | }
1271 |
1272 | // convert float to integer
1273 | if (option == 0.5)
1274 | {
1275 | option = 0;
1276 | }
1277 | const uint8_t i_option = (uint8_t)option;
1278 |
1279 | if (i_option != 0 && i_option != 1 && i_option != 5 && i_option != 10 && i_option != 30 &&
1280 | i_option != 60)
1281 | {
1282 | if (_debug)
1283 | {
1284 | _debug_port->println("Wrong parameter for setTimeLapseInterval");
1285 | }
1286 | return -1;
1287 | }
1288 |
1289 | if (_camera == HERO3)
1290 | {
1291 | switch (i_option)
1292 | {
1293 | case 60:
1294 | _parameter = (char *)"3c";
1295 | break;
1296 | case 30:
1297 | _parameter = (char *)"1e";
1298 | break;
1299 | case 10:
1300 | _parameter = (char *)"0a";
1301 | break;
1302 | case 5:
1303 | _parameter = (char *)"05";
1304 | break;
1305 | case 1:
1306 | _parameter = (char *)"01";
1307 | break;
1308 | case 0: // 0.5
1309 | _parameter = (char *)"00";
1310 | break;
1311 | default:
1312 | if (_debug)
1313 | {
1314 | _debug_port->println("Wrong parameter for setTimeLapseInterval");
1315 | }
1316 | return -1;
1317 | }
1318 | makeRequest(_request, "camera/TI?t=", _pwd, "&p=%", _parameter);
1319 | }
1320 | else if (_camera >= HERO4)
1321 | {
1322 | switch (i_option)
1323 | {
1324 | case 60:
1325 | _parameter = (char *)"6";
1326 | break;
1327 | case 30:
1328 | _parameter = (char *)"5";
1329 | break;
1330 | case 10:
1331 | _parameter = (char *)"4";
1332 | break;
1333 | case 5:
1334 | _parameter = (char *)"3";
1335 | break;
1336 | case 1:
1337 | _parameter = (char *)"1";
1338 | break;
1339 | case 0: // 0.5
1340 | _parameter = (char *)"0";
1341 | break;
1342 | default:
1343 | if (_debug)
1344 | {
1345 | _debug_port->println("Wrong parameter for setTimeLapseInterval");
1346 | }
1347 | return -1;
1348 | }
1349 | makeRequest(_request, "/gp/gpControl/setting/5/", _parameter);
1350 | }
1351 |
1352 | return handleHTTPRequest(_request);
1353 | }
1354 |
1355 | uint8_t GoProControl::setContinuousShot(const uint8_t option)
1356 | {
1357 | if (_connected == false) // not connected
1358 | {
1359 | if (_debug)
1360 | {
1361 | _debug_port->println("Connect the camera first");
1362 | }
1363 | return false;
1364 | }
1365 |
1366 | // convert float to integer
1367 | const uint8_t i_option = (uint8_t)option;
1368 |
1369 | if (i_option != 0 || i_option != 3 || i_option != 5 || i_option != 10)
1370 | {
1371 | if (_debug)
1372 | {
1373 | _debug_port->println("Wrong parameter for setContinuousShot");
1374 | }
1375 | return -1;
1376 | }
1377 |
1378 | if (_camera == HERO3)
1379 | {
1380 | switch (option)
1381 | {
1382 | case 10:
1383 | _parameter = (char *)"0a";
1384 | break;
1385 | case 5:
1386 | _parameter = (char *)"05";
1387 | break;
1388 | case 3:
1389 | _parameter = (char *)"03";
1390 | break;
1391 | case 0:
1392 | _parameter = (char *)"00";
1393 | break;
1394 | default:
1395 | if (_debug)
1396 | {
1397 | _debug_port->println("Wrong parameter for setContinuousShot");
1398 | }
1399 | return -1;
1400 | }
1401 | makeRequest(_request, "camera/CS?t=", _pwd, "&p=%", _parameter);
1402 | }
1403 | else if (_camera >= HERO4)
1404 | {
1405 | if (_debug)
1406 | {
1407 | _debug_port->println("Not supported by HERO4 and newer");
1408 | }
1409 | return false;
1410 | }
1411 | return handleHTTPRequest(_request);
1412 | }
1413 |
1414 | ////////////////////////////////////////////////////////////
1415 | //////// Others ////////
1416 | ////////////////////////////////////////////////////////////
1417 |
1418 | uint8_t GoProControl::localizationOn()
1419 | {
1420 | if (_connected == false) // not connected
1421 | {
1422 | if (_debug)
1423 | {
1424 | _debug_port->println("Connect the camera first");
1425 | }
1426 | return false;
1427 | }
1428 |
1429 | if (_camera == HERO3)
1430 | {
1431 | makeRequest(_request, "camera/LL?t=", _pwd, "&p=%01");
1432 | }
1433 | else if (_camera >= HERO4)
1434 | {
1435 | makeRequest(_request, "/gp/gpControl/command/system/locate?p=1");
1436 | }
1437 |
1438 | return handleHTTPRequest(_request);
1439 | }
1440 |
1441 | uint8_t GoProControl::localizationOff()
1442 | {
1443 | if (_connected == false) // not connected
1444 | {
1445 | if (_debug)
1446 | {
1447 | _debug_port->println("Connect the camera first");
1448 | }
1449 | return false;
1450 | }
1451 |
1452 | if (_camera == HERO3)
1453 | {
1454 | makeRequest(_request, "camera/LL?t=", _pwd, "&p=%00");
1455 | }
1456 | else if (_camera >= HERO4)
1457 | {
1458 | makeRequest(_request, "/gp/gpControl/command/system/locate?p=0");
1459 | }
1460 |
1461 | return handleHTTPRequest(_request);
1462 | }
1463 |
1464 | uint8_t GoProControl::deleteLast()
1465 | {
1466 | if (_connected == false) // not connected
1467 | {
1468 | if (_debug)
1469 | {
1470 | _debug_port->println("Connect the camera first");
1471 | }
1472 | return false;
1473 | }
1474 |
1475 | if (_camera == HERO3)
1476 | {
1477 | makeRequest(_request, "camera/DL?t=", _pwd);
1478 | }
1479 | else if (_camera >= HERO4)
1480 | {
1481 | makeRequest(_request, "/gp/gpControl/command/storage/delete/last");
1482 | }
1483 |
1484 | return handleHTTPRequest(_request);
1485 | }
1486 |
1487 | uint8_t GoProControl::deleteAll()
1488 | {
1489 | if (_connected == false) // not connected
1490 | {
1491 | if (_debug)
1492 | {
1493 | _debug_port->println("Connect the camera first");
1494 | }
1495 | return false;
1496 | }
1497 |
1498 | if (_camera == HERO3)
1499 | {
1500 | makeRequest(_request, "camera/DA?t=", _pwd);
1501 | }
1502 | else if (_camera >= HERO4)
1503 | {
1504 | makeRequest(_request, "/gp/gpControl/command/storage/delete/all");
1505 | }
1506 |
1507 | return handleHTTPRequest(_request);
1508 | }
1509 |
1510 | ////////////////////////////////////////////////////////////
1511 | //////// Debug /////////
1512 | ////////////////////////////////////////////////////////////
1513 |
1514 | void GoProControl::enableDebug(UniversalSerial *debug_port, const uint32_t debug_baudrate)
1515 | {
1516 | _debug = true;
1517 | _debug_port = debug_port;
1518 | _debug_port->begin(debug_baudrate);
1519 | }
1520 |
1521 | void GoProControl::disableDebug()
1522 | {
1523 | _debug_port->end();
1524 | _debug = false;
1525 | }
1526 |
1527 | void GoProControl::printStatus()
1528 | {
1529 | if (_debug)
1530 | {
1531 | _debug_port->print("\nSSID:\t\t");
1532 | _debug_port->println(_ssid);
1533 | _debug_port->print("Password:\t");
1534 | _debug_port->println(_pwd);
1535 | _debug_port->print("Camera:\t\t");
1536 | if (_camera == 8)
1537 | {
1538 | _debug_port->println("FUSION");
1539 | }
1540 | else if (_camera == 10)
1541 | {
1542 | _debug_port->println("MAX");
1543 | }
1544 | else
1545 | {
1546 | _debug_port->print("HERO");
1547 | if (_camera <= 7)
1548 | {
1549 | _debug_port->println(_camera);
1550 | }
1551 | else
1552 | {
1553 | _debug_port->println(_camera - 1);
1554 | }
1555 | }
1556 | _debug_port->print("Board Name:\t");
1557 | _debug_port->println(_board_name);
1558 | _debug_port->print("IP Address:\t");
1559 | _debug_port->println(WiFi.localIP());
1560 | _debug_port->print("RSSI:\t\t");
1561 | _debug_port->print(WiFi.RSSI());
1562 | _debug_port->println(" dBm");
1563 | _debug_port->print("Board MAC:\t");
1564 | printArray(_board_mac, MAC_ADDRESS_LENGTH, ":", HEX, false, false, _debug_port);
1565 | _debug_port->print("GoPro MAC:\t");
1566 | printArray(_gopro_mac, MAC_ADDRESS_LENGTH, ":", HEX, false, false, _debug_port);
1567 | _debug_port->println();
1568 | }
1569 | }
1570 |
1571 | ////////////////////////////////////////////////////////////
1572 | //////// Private /////////
1573 | ////////////////////////////////////////////////////////////
1574 |
1575 | void GoProControl::sendWoL()
1576 | {
1577 | uint8_t preamble[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
1578 | IPAddress addr(255, 255, 255, 255);
1579 |
1580 | _udp_client.begin(_udp_port);
1581 | _udp_client.beginPacket(addr, _udp_port);
1582 |
1583 | _udp_client.write(preamble, LEN(preamble));
1584 |
1585 | for (uint8_t i = 0; i < 16; i++)
1586 | {
1587 | _udp_client.write(_gopro_mac, MAC_ADDRESS_LENGTH);
1588 | }
1589 | _udp_client.endPacket();
1590 | _udp_client.stop();
1591 | }
1592 |
1593 | uint8_t GoProControl::sendRequest(const char *request, bool silent)
1594 | {
1595 | if (!connectClient())
1596 | {
1597 | return false;
1598 | }
1599 |
1600 | if (_debug && silent == false)
1601 | {
1602 | _debug_port->print("Request: ");
1603 | _debug_port->println(request);
1604 | }
1605 | _wifi_client.println(request);
1606 | _wifi_client.stop();
1607 | return true;
1608 | }
1609 |
1610 | bool GoProControl::handleHTTPRequest(const char *request)
1611 | {
1612 | if (sendHTTPRequest(request))
1613 | {
1614 | listenResponse();
1615 | if (extractResponseCode() == 200)
1616 | {
1617 | return true;
1618 | }
1619 | }
1620 | return false;
1621 | }
1622 |
1623 | bool GoProControl::sendHTTPRequest(const char *request, const uint16_t port)
1624 | {
1625 | if (!connectClient(port))
1626 | {
1627 | return false;
1628 | }
1629 |
1630 | if (_debug)
1631 | {
1632 | _debug_port->print("HTTP request: ");
1633 | _debug_port->println(request);
1634 | }
1635 | _wifi_client.print("GET ");
1636 | _wifi_client.print(request);
1637 | _wifi_client.println(" HTTP/1.1");
1638 | if (_camera == HERO3)
1639 | {
1640 | _wifi_client.print("Host: ");
1641 | _wifi_client.print(_host);
1642 | _wifi_client.print(":");
1643 | _wifi_client.println(port);
1644 | }
1645 | else if (_camera >= HERO4)
1646 | {
1647 | _wifi_client.print("Host: ");
1648 | _wifi_client.println(_host);
1649 | }
1650 | _wifi_client.println("Connection: close");
1651 | _wifi_client.println();
1652 | return true;
1653 | }
1654 |
1655 | #if defined(ARDUINO_ARCH_ESP32)
1656 | uint8_t GoProControl::sendBLERequest(const uint8_t request[])
1657 | {
1658 | if (_debug)
1659 | {
1660 | _debug_port->println("BLE request:");
1661 | for (uint8_t i = 0; i <= 3; i++)
1662 | {
1663 | _debug_port->println(request[i]);
1664 | }
1665 | }
1666 | return true;
1667 | }
1668 |
1669 | #endif
1670 |
1671 | uint8_t GoProControl::connectClient(const uint16_t port)
1672 | {
1673 | if (!_wifi_client.connect(_host, port))
1674 | {
1675 | if (_debug)
1676 | {
1677 | _debug_port->println("Connection lost");
1678 | }
1679 | _connected = false;
1680 | return false;
1681 | }
1682 | else
1683 | {
1684 | if (_debug)
1685 | {
1686 | _debug_port->println("Client connected");
1687 | }
1688 | _last_request = millis();
1689 | return true;
1690 | }
1691 | }
1692 |
1693 | bool GoProControl::listenResponse(const bool mediatimer)
1694 | {
1695 | uint16_t index = 0;
1696 |
1697 | if (_debug)
1698 | {
1699 | _debug_port->print("Waiting response");
1700 | }
1701 | uint32_t start_time = millis();
1702 | while ((_wifi_client.available() == 0) && (start_time + MAX_WAIT_TIME > millis()))
1703 | {
1704 | if (_debug)
1705 | {
1706 | _debug_port->print(".");
1707 | delay(5);
1708 | }
1709 | }
1710 |
1711 | if (mediatimer)
1712 | {
1713 | delay(10); //Add delay. Without, response can be not complete for getmedia.
1714 | }
1715 |
1716 | if (_wifi_client.available() < MAX_RESPONSE_LEN) // Add verification to not overflow the buffer
1717 | {
1718 | while (_wifi_client.available() > 0)
1719 | {
1720 | _response_buffer[index++] = _wifi_client.read();
1721 | }
1722 | _response_buffer[index] = '\0';
1723 | _wifi_client.stop();
1724 |
1725 | if (_debug)
1726 | {
1727 | _debug_port->println("\nStart response body");
1728 | _debug_port->println(_response_buffer);
1729 | _debug_port->println("\nEnd response body");
1730 | }
1731 | }
1732 |
1733 | else
1734 | {
1735 | _response_buffer[index] = '\0';
1736 | if (_debug)
1737 | {
1738 | _debug_port->println("buffer not big enough to store data");
1739 | }
1740 | }
1741 |
1742 | if (strcmp(_response_buffer, "") == 0)
1743 | {
1744 | return false;
1745 | }
1746 | else
1747 | {
1748 | return true;
1749 | }
1750 | }
1751 |
1752 | uint16_t GoProControl::extractResponselength() // for getstatus(), look the length of the response
1753 | {
1754 | if (strcmp(_response_buffer, "") == 0)
1755 | {
1756 | return false;
1757 | }
1758 |
1759 | int16_t start = stringSearch(_response_buffer, "Content-Length: ") + 16;
1760 | int16_t end = stringSearch(_response_buffer, "\r\n",start);
1761 | uint16_t code = atoi(stringCut(_response_buffer, start, end));
1762 |
1763 | if (_debug)
1764 | {
1765 | _debug_port->print("Response length: ");
1766 | _debug_port->print(code);
1767 | if (code == 0)
1768 | {
1769 | _debug_port->println("no data received");
1770 | }
1771 | else if (code > 0)
1772 | {
1773 | _debug_port->println(" bytes received");
1774 | }
1775 | }
1776 |
1777 | return code;
1778 | }
1779 |
1780 | uint16_t GoProControl::extractResponseCode()
1781 | {
1782 | if (strcmp(_response_buffer, "") == 0)
1783 | {
1784 | return false;
1785 | }
1786 |
1787 | int8_t start = stringSearch(_response_buffer, " ") + 1;
1788 | int8_t end = stringSearch(_response_buffer, " ", start);
1789 | uint16_t code = atoi(stringCut(_response_buffer, start, end));
1790 |
1791 | if (_debug)
1792 | {
1793 | _debug_port->print("Response code: ");
1794 | _debug_port->println(code);
1795 | if (code == 200)
1796 | {
1797 | _debug_port->println("Command: Accepted");
1798 | }
1799 | else if (code == 400)
1800 | {
1801 | _debug_port->println("Command: Bad request");
1802 | }
1803 | else if (code == 403)
1804 | {
1805 | _debug_port->println("Command: Wrong password");
1806 | }
1807 | else if (code == 410)
1808 | {
1809 | _debug_port->println("Command: Failed");
1810 | }
1811 | else
1812 | {
1813 | _debug_port->println("Command: Other error");
1814 | }
1815 | }
1816 |
1817 | return code;
1818 | }
1819 |
1820 | void GoProControl::getBSSID()
1821 | {
1822 | #if defined(ARDUINO_ARCH_ESP32) || defined(ARDUINO_ARCH_ESP8266)
1823 | // ESP32 and ESP8266 aren't compliant with the arduino API
1824 | _gopro_mac = WiFi.BSSID();
1825 | #else
1826 | WiFi.BSSID(_gopro_mac);
1827 | #endif
1828 |
1829 | #if not defined(INVERT_MAC) // Invert the mac in some boards
1830 | revert(_gopro_mac);
1831 | #endif
1832 | }
1833 |
1834 | void GoProControl::getWiFiData()
1835 | {
1836 | if (_gopro_mac[0] == 0)
1837 | {
1838 | getBSSID();
1839 | }
1840 | if (_board_mac[0] == 0)
1841 | {
1842 | WiFi.macAddress(_board_mac);
1843 | #if not defined(INVERT_MAC) // Invert the mac in arduino boards
1844 | revert(_board_mac);
1845 | #endif
1846 | }
1847 | if (strcmp(_board_name, "") == 0)
1848 | {
1849 | #if defined(ARDUINO_ARCH_ESP32)
1850 | _board_name = (char *)WiFi.getHostname();
1851 | #else
1852 | // not supported by arduino api
1853 | #endif
1854 | }
1855 | }
1856 |
1857 | void GoProControl::revert(uint8_t mac[])
1858 | {
1859 | uint8_t temp;
1860 | for (uint8_t i = 0; i < MAC_ADDRESS_LENGTH / 2; i++)
1861 | {
1862 | temp = mac[i];
1863 | mac[i] = mac[MAC_ADDRESS_LENGTH - i - 1];
1864 | mac[MAC_ADDRESS_LENGTH - i - 1] = temp;
1865 | }
1866 | }
1867 |
1868 | void GoProControl::makeRequest(char *buff, const char *a, const char *b, const char *c,
1869 | const char *d)
1870 | {
1871 | strcpy(buff, a);
1872 | if (b != nullptr)
1873 | {
1874 | strcat(buff, b);
1875 | }
1876 | if (c != nullptr)
1877 | {
1878 | strcat(buff, c);
1879 | }
1880 | if (d != nullptr)
1881 | {
1882 | strcat(buff, d);
1883 | }
1884 | }
1885 |
--------------------------------------------------------------------------------
/src/GoProControl.h:
--------------------------------------------------------------------------------
1 | /*
2 | GoProControl.h
3 |
4 | Permission is hereby granted, free of charge, to any person obtaining a copy of
5 | this software and associated documentation files (the "Software"), to deal in
6 | the Software without restriction, including without limitation the rights to
7 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
8 | the Software, and to permit persons to whom the Software is furnished to do so,
9 | subject to the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be included in all
12 | copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
16 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
17 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
18 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20 | */
21 |
22 | #ifndef GOPRO_CONTROL_H
23 | #define GOPRO_CONTROL_H
24 |
25 | #include
26 | #include
27 |
28 | // include the correct wifi library
29 | #if defined(ARDUINO_ARCH_ESP32) // ESP32
30 | #include
31 | #define INVERT_MAC
32 | #elif defined(ARDUINO_ARCH_MBED_RP2040) || defined(ARDUINO_ARCH_RP2040) // Raspberry Pi
33 | #include
34 | #define INVERT_MAC
35 | #elif defined(ARDUINO_ARCH_ESP8266) // ESP8266
36 | #include
37 | #define INVERT_MAC
38 | #warning \
39 | "turnOn() function won't work if you don't provide the mac of your camera in the constructor"
40 | #elif defined(ARDUINO_SAMD_MKR1000) // MKR1000
41 | #include
42 | #elif defined(ARDUINO_SAMD_MKRWIFI1010) || \
43 | defined(ARDUINO_AVR_UNO_WIFI_REV2) // MKR WiFi 1010 and UNO WiFi Rev.2
44 | #include
45 | #elif defined(ARDUINO_SAMD_MKRVIDOR4000) // MKR VIDOR 4000
46 | #include
47 | #include
48 | #else // any board (like arduino UNO) without wifi + ESP01 with AT commands
49 | #include
50 | #define AT_COMMAND
51 | #warning \
52 | "Are you using an ESP01 + AT commands? if not open an issue on github: github.com/aster94/GoProControl/issues"
53 | #endif
54 |
55 | // include the UDP library to turn on and off HERO4 and newer camera
56 | #if defined(AT_COMMAND)
57 | #include
58 | #define WiFiClient WiFiEspClient
59 | #define WiFiUDP WiFiEspUDP
60 | #else
61 | #include
62 | #endif
63 |
64 | // include the correct Serial class
65 | #if defined(ARDUINO_ARCH_SAMD)
66 | #define UniversalSerial Serial_
67 | #elif defined(ARDUINO_ARCH_STM32)
68 | #define UniversalSerial USBSerial
69 | #else
70 | #define UniversalSerial HardwareSerial
71 | #endif
72 |
73 | #define MAC_ADDRESS_LENGTH 6
74 | #define MAX_RESPONSE_LEN 1500
75 |
76 | class GoProControl
77 | {
78 | public:
79 | // Constructors
80 | GoProControl(const char *ssid,
81 | const char *pwd,
82 | const uint8_t camera,
83 | const uint8_t gopro_mac[] = NULL,
84 | const char *board_name = "");
85 |
86 | // Comunication
87 | uint8_t begin();
88 | void end();
89 | uint8_t keepAlive();
90 | uint8_t confirmPairing();
91 |
92 | // BLE functions are availables only on ESP32
93 | #if defined(ARDUINO_ARCH_ESP32)
94 | // none of these function will work, I am adding these for a proof of concept,
95 | // see the readME
96 | // https://github.com/KonradIT/goprowifihack/blob/master/HERO5/HERO5-Commands.md#bluetooth-pairing
97 | uint8_t enableBLE();
98 | uint8_t disableBLE();
99 | uint8_t wifiOff();
100 | uint8_t wifiOn();
101 | #endif
102 |
103 | // Control
104 | uint8_t turnOn();
105 | uint8_t turnOff(const bool force = false);
106 |
107 | // Status
108 | char *getStatus();
109 | char *getMediaList();
110 | bool isOn();
111 | bool isConnected(const bool silent = true);
112 | bool isRecording();
113 |
114 |
115 | //ADD DAMIEN
116 | bool getConnection();
117 |
118 |
119 | // Shoot
120 | uint8_t shoot();
121 | uint8_t stopShoot();
122 |
123 | // Settings
124 | uint8_t setMode(const uint8_t option);
125 | uint8_t setOrientation(const uint8_t option);
126 |
127 | // Video
128 | uint8_t setVideoResolution(const uint8_t option);
129 | uint8_t setVideoFov(const uint8_t option);
130 | uint8_t setFrameRate(const uint8_t option);
131 | uint8_t setVideoEncoding(const uint8_t option);
132 |
133 | // Photo
134 | uint8_t setPhotoResolution(const uint8_t option);
135 | uint8_t setTimeLapseInterval(float option);
136 | uint8_t setContinuousShot(const uint8_t option);
137 |
138 | // Others
139 | uint8_t localizationOn();
140 | uint8_t localizationOff();
141 | uint8_t deleteLast();
142 | uint8_t deleteAll();
143 |
144 | // Debug
145 | void enableDebug(UniversalSerial *debug_port,
146 | const uint32_t debug_baudrate = 115200);
147 | void disableDebug();
148 | void printStatus();
149 |
150 | private:
151 | WiFiClient _wifi_client;
152 | WiFiUDP _udp_client;
153 | const char *_host = "10.5.5.9";
154 | const uint8_t _udp_port = 9;
155 |
156 | char *_ssid;
157 | char *_pwd;
158 | uint8_t _camera;
159 |
160 | char *_request = new char[100];
161 | char _response_buffer[MAX_RESPONSE_LEN];
162 | char *_parameter = new char[2];
163 | char *_sub_parameter = new char[2];
164 |
165 | uint8_t _mode;
166 |
167 | uint8_t *_gopro_mac = new uint8_t[MAC_ADDRESS_LENGTH];
168 | uint8_t *_board_mac = new uint8_t[MAC_ADDRESS_LENGTH];
169 | char *_board_name = new char[20];
170 |
171 | bool WIFI_MODE = true;
172 | bool BLE_ENABLED = false;
173 |
174 | bool _connected = false;
175 | bool _recording = false;
176 | uint32_t _last_request;
177 |
178 | UniversalSerial *_debug_port;
179 | bool _debug;
180 |
181 | void sendWoL();
182 | uint8_t sendRequest(const char *request, bool silent = true);
183 | bool handleHTTPRequest(const char *request);
184 | bool sendHTTPRequest(const char *request, const uint16_t port = 80);
185 | #if defined(ARDUINO_ARCH_ESP32)
186 | uint8_t sendBLERequest(const uint8_t request[]);
187 | #endif
188 | uint8_t connectClient(const uint16_t port = 80);
189 | bool listenResponse(const bool mediatimer = false);
190 | uint16_t extractResponselength();
191 | uint16_t extractResponseCode();
192 | void getBSSID();
193 | void getWiFiData();
194 | void revert(uint8_t arr[]);
195 | void makeRequest(char *buff,
196 | const char *a,
197 | const char *b = nullptr,
198 | const char *c = nullptr,
199 | const char *d = nullptr);
200 | };
201 |
202 | #endif // GOPRO_CONTROL_H
203 |
--------------------------------------------------------------------------------
/src/Settings.h:
--------------------------------------------------------------------------------
1 | /*
2 | Settings.h
3 |
4 | Permission is hereby granted, free of charge, to any person obtaining a copy of
5 | this software and associated documentation files (the "Software"), to deal in
6 | the Software without restriction, including without limitation the rights to
7 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
8 | the Software, and to permit persons to whom the Software is furnished to do so,
9 | subject to the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be included in all
12 | copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
16 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
17 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
18 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20 | */
21 |
22 | #define KEEP_ALIVE 2500
23 | #define MAX_WAIT_TIME 2000
24 |
25 | enum camera
26 | {
27 | HERO = 1,
28 | HERO2,
29 | HERO3,
30 | HERO4,
31 | HERO5,
32 | HERO6,
33 | HERO7,
34 | FUSION,
35 | HERO8,
36 | MAX
37 | };
38 |
39 | // The above settings must be between a "*_first" and "*_last" member
40 | enum mode
41 | {
42 | mode_first = 0,
43 | VIDEO_MODE,
44 | VIDEO_SUB_MODE,
45 | VIDEO_PHOTO_MODE,
46 | VIDEO_TIMELAPSE_MODE,
47 | VIDEO_LOOPING_MODE,
48 | VIDEO_TIMEWARP_MODE,
49 |
50 | PHOTO_MODE,
51 | PHOTO_SINGLE_MODE,
52 | PHOTO_NIGHT_MODE,
53 |
54 | MULTISHOT_MODE,
55 | MULTISHOT_BURST_MODE,
56 | MULTISHOT_TIMELAPSE_MODE,
57 | MULTISHOT_NIGHTLAPSE_MODE,
58 |
59 | BURST_MODE,
60 | TIMELAPSE_MODE,
61 | TIMER_MODE,
62 | PLAY_HDMI_MODE,
63 | mode_last
64 | };
65 |
66 | enum orientation
67 | {
68 | orientation_first = mode_last + 1,
69 | ORIENTATION_UP,
70 | ORIENTATION_DOWN,
71 | ORIENTATION_AUTO,
72 | orientation_last
73 | };
74 |
75 | enum video_resolution
76 | {
77 | video_resolution_first = orientation_last + 1,
78 | VR_5p6K,
79 | VR_4K,
80 | VR_2K,
81 | VR_2K_SuperView,
82 | VR_1440p,
83 | VR_1080p_SuperView,
84 | VR_1080p,
85 | VR_960p,
86 | VR_720p_SuperView,
87 | VR_720p,
88 | VR_WVGA,
89 | video_resolution_last
90 | };
91 |
92 | enum video_fov
93 | {
94 | video_fov_first = video_resolution_last + 1,
95 | DUAL360_FOV,
96 | WIDE_FOV,
97 | MEDIUM_FOV,
98 | NARROW_FOV,
99 | LINEAR_FOV,
100 | video_fov_last
101 | };
102 |
103 | enum frame_rate
104 | {
105 | frame_rate_first = video_fov_last + 1,
106 | FR_240,
107 | FR_120,
108 | FR_100,
109 | FR_90,
110 | FR_80,
111 | FR_60,
112 | FR_50,
113 | FR_48,
114 | FR_30,
115 | FR_25,
116 | FR_24,
117 | FR_15,
118 | FR_12p5,
119 | FR_12,
120 | frame_rate_last
121 | };
122 |
123 | enum video_encoding
124 | {
125 | video_encoding_first = frame_rate_last + 1,
126 | NTSC,
127 | PAL,
128 | video_encoding_last
129 | };
130 |
131 | enum photo_resolution
132 | {
133 | photo_resolution_first = video_encoding_last + 1,
134 | PR_12MP_WIDE,
135 | PR_12MP_MEDIUM,
136 | PR_12MP_NARROW,
137 | PR_12MP_LINEAR,
138 | PR_11MP_WIDE,
139 | PR_8MP_WIDE,
140 | PR_8MP_MEDIUM,
141 | PR_7MP_WIDE,
142 | PR_7MP_MEDIUM,
143 | PR_5MP_WIDE,
144 | PR_5MP_MEDIUM,
145 | photo_resolution_last
146 | };
147 |
148 | #if defined(ARDUINO_ARCH_ESP32)
149 | const uint8_t BLE_WiFiOn[] = {17, 01, 01};
150 | const uint8_t BLE_WiFiOff[] = {17, 01, 00};
151 | const uint8_t BLE_RecordStart[] = {01, 01, 01};
152 | const uint8_t BLE_RecordStop[] = {01, 01, 00};
153 | const uint8_t BLE_ModeVideo[] = {02, 01, 00};
154 | const uint8_t BLE_ModePhoto[] = {02, 01, 01};
155 | const uint8_t BLE_ModeMultiShot[] = {02, 01, 02};
156 | #endif
157 |
--------------------------------------------------------------------------------