open-merou

Open Mérou, a free iOS app for the Oceanic+ underwater iPhone housing
git clone https://git.schurger.org/open-merou.git
Log | Files | Refs | README | LICENSE

commit 01ca2484e6175af1172fd8c68e8cb85760ef6e07
parent a2ec638e98d72620dfb3c64e5af36858e135fdc1
Author: Jean Schurger <jean@schurger.org>
Date:   Sat, 14 Nov 2026 09:39:41 -0500

English code, comments and docs; English source language with French localization; GPL-2.0 license

All comments, log messages, tool output, the README and the protocol
notes (docs/PROTOCOLE.md renamed to docs/PROTOCOL.md) are now in English.
The app uses English as its source language and keeps French as a
translation with the exact wording of version 0.19
(OpenMerou/Localizable.xcstrings, OpenMerou/InfoPlist.xcstrings).
Every Swift file carries an SPDX identifier and LICENSE holds the GPL
version 2 text.

Unchanged on purpose: UserDefaults key and persisted raw values, the
on-disk folder names (Documents/pellicule, Documents/journaux,
Caches/apercus), the CSV columns and row types of the development log,
the bundle identifier, the launch arguments, the Makefile targets, the
fastlane lane names and the BLE protocol.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

Diffstat:
M.gitignore | 1+
ALICENSE | 338+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
MMakefile | 8++++----
MOpenMerou/App/AppModel.swift | 92++++++++++++++++++++++++++++++++++++++++---------------------------------------
MOpenMerou/App/DevLog.swift | 11+++++++----
MOpenMerou/App/OpenMerouApp.swift | 1+
MOpenMerou/Camera/CameraEngine.swift | 71++++++++++++++++++++++++++++++++++++-----------------------------------
MOpenMerou/Camera/CameraSettings.swift | 105+++++++++++++++++++++++++++++++++++++++++--------------------------------------
MOpenMerou/Camera/Roll.swift | 29++++++++++++++++-------------
MOpenMerou/Housing/HousingClient.swift | 123++++++++++++++++++++++++++++++++++++++++---------------------------------------
MOpenMerou/Housing/HousingProtocol.swift | 85+++++++++++++++++++++++++++++++++++++++++++++++--------------------------------
MOpenMerou/Housing/VacuumSequence.swift | 45+++++++++++++++++++++++----------------------
MOpenMerou/Info.plist | 13+++++++++----
AOpenMerou/InfoPlist.xcstrings | 74++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
AOpenMerou/Localizable.xcstrings | 2276+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
MOpenMerou/UI/CameraScreen.swift | 137+++++++++++++++++++++++++++++++++++++++++--------------------------------------
MOpenMerou/UI/HousingView.swift | 52+++++++++++++++++++++++++++-------------------------
MOpenMerou/UI/VacuumView.swift | 81++++++++++++++++++++++++++++++++++++++++---------------------------------------
MOpenMerouTests/CameraMenuTests.swift | 13+++++++------
MOpenMerouTests/HousingProtocolTests.swift | 5+++--
MOpenMerouTests/VacuumSequenceTests.swift | 21+++++++++++----------
MREADME.md | 44++++++++++++++++++++++++++++++--------------
Adocs/PROTOCOL.md | 88+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Ddocs/PROTOCOLE.md | 88-------------------------------------------------------------------------------
Mfastlane/Fastfile | 70+++++++++++++++++++++++++++++++++++++---------------------------------
Mproject.yml | 6++++--
Mtools/make-icon.swift | 24+++++++++++++-----------
Mtools/pklg.py | 25+++++++++++++------------
Mtools/upload.sh | 6+++---
Mtools/wait-beta.sh | 9+++++----
30 files changed, 3354 insertions(+), 587 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -1,4 +1,5 @@ captures/ +.claude/ *.xcodeproj build/ build_output/ diff --git a/LICENSE b/LICENSE @@ -0,0 +1,338 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + <https://fsf.org/> + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, see <https://www.gnu.org/licenses/>. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + <signature of Moe Ghoul>, 1 April 1989 + Moe Ghoul, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. diff --git a/Makefile b/Makefile @@ -1,4 +1,4 @@ -# Le code vit ici (hotrats) ; Xcode tourne sur chunga. +# The sources live on this host; Xcode runs on a Mac reachable over SSH (CHUNGA), in the REMOTE directory. CHUNGA ?= chunga REMOTE ?= src/perso/open-merou DEST ?= platform=iOS Simulator,name=OpenMerou test iPhone @@ -6,7 +6,7 @@ DEST ?= platform=iOS Simulator,name=OpenMerou test iPhone .PHONY: sync project build test release sync: - rsync -a --delete --exclude .git --exclude captures --exclude '*.xcodeproj' --exclude build ./ $(CHUNGA):$(REMOTE)/ + rsync -a --delete --exclude .git --exclude .claude --exclude captures --exclude '*.xcodeproj' --exclude build ./ $(CHUNGA):$(REMOTE)/ project: sync ssh $(CHUNGA) 'cd $(REMOTE) && xcodegen -q' @@ -17,8 +17,8 @@ build: project test: project ssh $(CHUNGA) 'cd $(REMOTE) && xcodebuild -quiet -scheme OpenMerou -destination "$(DEST)" test' -# Archive, envoi sur TestFlight (garde-fou : altool bloque parfois), puis, une fois la build traitée : -# notes d'essai, groupe interne, groupe « Externes » et revue bêta. Rien à faire à la main. +# Archive, upload to TestFlight (with a safeguard: altool sometimes hangs), then, once the build is processed: +# test notes, internal group, "Externes" group and beta review. Nothing to do by hand. release: project ssh $(CHUNGA) 'cd $(REMOTE) && security unlock-keychain -p "$$(cat ~/.keyring_secret)" ~/Library/Keychains/login.keychain-db && fastlane ios archive 2>&1 | grep -E "ARCHIVE|EXPORT|rror:" | grep -v CoreSimulator' ssh $(CHUNGA) 'cd $(REMOTE) && ./tools/upload.sh' diff --git a/OpenMerou/App/AppModel.swift b/OpenMerou/App/AppModel.swift @@ -1,5 +1,6 @@ -// Relie le boîtier à la caméra : les boutons que la séquence de mise sous vide laisse libres -// pilotent la prise de vue, le menu et la veille de l'écran. +// SPDX-License-Identifier: GPL-2.0-only +// Ties the housing to the camera: the buttons that the vacuum sequence leaves free +// drive shooting, the menu and screen sleep. import AudioToolbox import Network import Observation @@ -15,36 +16,36 @@ final class AppModel { private(set) var settings = CameraSettings.load() private(set) var menu = CameraMenu() private(set) var sleeping = false - /// Message passager (erreurs, calibrage) ; s'efface tout seul. + /// Transient message (errors, calibration); goes away by itself. private(set) var toast: String? - /// Augmente à chaque déclenchement : l'écran clignote comme un obturateur. + /// Incremented at each shot: the screen blinks like a shutter. private(set) var shutterFlash = 0 @ObservationIgnored private var toastTask: Task<Void, Never>? - /// Panneau d'informations ouvert par le menu ; n'importe quel bouton le referme. + /// Information panel opened from the menu; any button closes it. private(set) var showingInfo = false - /// Aperçus des prises de la session (les originaux partent aussitôt dans Photos). + /// Previews of the shots of the session (the originals go to Photos right away). private(set) var roll: [URL] = [] - /// Galerie ouverte par le bouton gauche. + /// Gallery opened by the left button. struct Gallery: Equatable { var index: Int } private(set) var gallery: Gallery? private(set) var galleryImage: UIImage? @ObservationIgnored private var galleryTask: Task<Void, Never>? @ObservationIgnored private var exporting = false - /// Une prise est arrivée pendant un transfert : en relancer un à la fin. + /// A shot arrived during a transfer: start another one when it ends. @ObservationIgnored private var exportAgain = false - /// Alarme de fuite : le son s'arrête au premier bouton, l'écran rouge reste. + /// Leak alarm: the sound stops at the first button press, the red screen stays. private(set) var alarmSilenced = false - /// L'iPhone a du réseau (le mode avion est conseillé avant de fermer le boîtier). + /// The iPhone has network access (airplane mode is recommended before closing the housing). private(set) var online = false private(set) var freeBytes: Int64? private(set) var hot = false - /// Profondeur estimée (m) et début de plongée : expérimental, tant que 1625 n'est pas validé dans l'eau. + /// Estimated depth (m) and dive start: experimental, until 1625 has been validated in the water. private(set) var depth: Double? private(set) var diveStart: Date? @ObservationIgnored private var surfacePa: Double? @ObservationIgnored private let pathMonitor = NWPathMonitor() @ObservationIgnored private var ticks = 0 - /// Batterie de l'iPhone, en % (nil si inconnue). + /// iPhone battery, in % (nil when unknown). private(set) var phoneBattery: Int? @ObservationIgnored private var lastActivity = Date() @ObservationIgnored private var awakeBrightness: CGFloat = 0.5 @@ -52,40 +53,41 @@ final class AppModel { func start() { UIDevice.current.isBatteryMonitoringEnabled = true - UIApplication.shared.isIdleTimerDisabled = true // l'écran ne se verrouille jamais tout seul + UIApplication.shared.isIdleTimerDisabled = true // the screen never locks by itself applyOrientation() DevLog.shared.set(enabled: settings.developer) engine.onState = { [weak self] state in guard let self else { return } if state.messageCount != camera.messageCount, let message = state.message { - DevLog.shared.event("caméra : \(message)") + DevLog.shared.event(String(localized: "camera: \(message)")) show(message) } if state.shots != camera.shots { - DevLog.shared.event("prise écrite sur disque") + DevLog.shared.event(String(localized: "shot written to disk")) exportRoll() } if state.zoomIndex != camera.zoomIndex, state.capabilities.zoomLabels.indices.contains(state.zoomIndex) { - DevLog.shared.event("objectif \(state.capabilities.zoomLabels[state.zoomIndex])") + DevLog.shared.event(String(localized: "lens \(state.capabilities.zoomLabels[state.zoomIndex])")) } if (state.recordingSince == nil) != (camera.recordingSince == nil) { - DevLog.shared.event(state.recordingSince == nil ? "vidéo : arrêt" : "vidéo : début") + DevLog.shared.event(state.recordingSince == nil ? String(localized: "video: stop") : String(localized: "video: start")) } if let calibration = state.calibration, calibration != camera.calibration { settings.colorMode = .calibrated settings.calibration = calibration settings.save() - DevLog.shared.event("calibrage \(calibration.label)") + DevLog.shared.event(String(localized: "calibration \(calibration.label)")) } if state.gainsSaturated != camera.gainsSaturated { - DevLog.shared.event((state.gainsSaturated ? "couleurs : rouge au maximum" : "couleurs : dans les limites") - + " gris moyen \(state.grayWorld?.label ?? "?") plafond \(state.maxGain.map { String(format: "%.2f", $0) } ?? "?")") + let grayWorld = state.grayWorld?.label ?? "?", ceiling = state.maxGain.map { String(format: "%.2f", $0) } ?? "?" + DevLog.shared.event((state.gainsSaturated ? String(localized: "colors: red at maximum") : String(localized: "colors: within limits")) + + " " + String(localized: "gray world \(grayWorld) ceiling \(ceiling)")) } camera = state } - Roll.clearPreviews() // la galerie ne montre que la session en cours + Roll.clearPreviews() // the gallery only shows the current session engine.start(settings) - exportRoll() // prises restées sur disque après un plantage + exportRoll() // shots left on disk after a crash housing.cameraButton = { [weak self] event in self?.button(event) } housing.anyButton = { [weak self] in self?.alarmSilenced = true } pathMonitor.pathUpdateHandler = { path in @@ -94,9 +96,9 @@ final class AppModel { } pathMonitor.start(queue: .global(qos: .utility)) applyBrightness() - // Lancement avec « -simulation » : boîtier simulé d'emblée (captures d'écran, démonstrations). + // Launched with "-simulation": simulated housing from the start (screenshots, demos). if ProcessInfo.processInfo.arguments.contains("-simulation") { housing.startSimulation() } - // « -demoMenu » : ouvre les réglages sur leur dernière ligne (captures d'écran). + // "-demoMenu": opens the settings on their last row (screenshots). if ProcessInfo.processInfo.arguments.contains("-demoMenu") { housing.bypassVacuum() menu.open() @@ -110,7 +112,7 @@ final class AppModel { } } - /// Minutes de vidéo que l'espace libre permet, à la qualité choisie (débits HEVC approximatifs). + /// Minutes of video that the free space allows, at the chosen quality (approximate HEVC bitrates). var videoMinutesLeft: Int? { guard let freeBytes else { return nil } let q = settings.videoQuality @@ -122,7 +124,7 @@ final class AppModel { case (1080, _): 60e6 default: 40e6 } - return Int(Double(max(0, freeBytes - 1_000_000_000)) / perMinute) // 1 Go gardé en réserve + return Int(Double(max(0, freeBytes - 1_000_000_000)) / perMinute) // 1 GB kept in reserve } private var isLeaking: Bool { @@ -136,7 +138,7 @@ final class AppModel { private func everySecond() { ticks += 1 - // Alarme de fuite : écran au maximum, son répété jusqu'au premier bouton. + // Leak alarm: screen at full brightness, sound repeated until the first button press. if isLeaking { if sleeping { wake() } UIScreen.main.brightness = 1 @@ -144,7 +146,7 @@ final class AppModel { } else { alarmSilenced = false } - // Journal d'office pendant une plongée scellée, même hors mode développement. + // The log is always on during a sealed dive, even outside development mode. let sealed: Bool = switch housing.vacuum.step { case .testing, .sealed, .failed: true default: false @@ -155,13 +157,13 @@ final class AppModel { let home = URL(fileURLWithPath: NSHomeDirectory()) freeBytes = (try? home.resourceValues(forKeys: [.volumeAvailableCapacityForImportantUsageKey]))?.volumeAvailableCapacityForImportantUsage } - // Chauffe : prévenir, et alléger la vidéo avant qu'iOS ne coupe la caméra. + // Heat: warn, and lighten the video before iOS shuts the camera down. let thermal = ProcessInfo.processInfo.thermalState let nowHot = thermal == .serious || thermal == .critical if nowHot != hot { hot = nowHot - DevLog.shared.event("thermique iPhone \(thermal.rawValue)") - if nowHot { show("iPhone chaud") } + DevLog.shared.event(String(localized: "iPhone thermal state \(String(thermal.rawValue))")) + if nowHot { show(String(localized: "iPhone is hot")) } } let light = VideoQuality(height: 1080, fps: 30) if nowHot, camera.recordingSince == nil, settings.mode == .video, @@ -170,15 +172,15 @@ final class AppModel { settings.videoQuality = light settings.save() engine.apply(settings) - show("iPhone chaud : vidéo réduite à \(light.label)") + show(String(localized: "iPhone is hot: video reduced to \(light.label)")) } - // Profondeur estimée : la surface est la plus basse pression extérieure vue (eau douce). + // Estimated depth: the surface is the lowest external pressure seen (fresh water). if let ext = housing.readings.externalPressurePa { surfacePa = min(surfacePa ?? ext, ext) let meters = max(0, (ext - (surfacePa ?? ext)) / 9_806.65) depth = meters - if meters > 0.5, diveStart == nil { diveStart = .now; DevLog.shared.event("début de plongée (estimé)") } - if meters < 0.2, diveStart != nil { diveStart = nil; DevLog.shared.event("fin de plongée (estimée)") } + if meters > 0.5, diveStart == nil { diveStart = .now; DevLog.shared.event(String(localized: "dive start (estimated)")) } + if meters < 0.2, diveStart != nil { diveStart = nil; DevLog.shared.event(String(localized: "dive end (estimated)")) } } else { depth = nil } @@ -220,7 +222,7 @@ final class AppModel { } func button(_ event: ButtonEvent) { - if sleeping { wake(); return } // le premier appui ne fait que réveiller l'écran + if sleeping { wake(); return } // the first press only wakes the screen lastActivity = Date() if showingInfo { showingInfo = false; return } if gallery != nil { galleryButton(event); return } @@ -238,23 +240,23 @@ final class AppModel { if settings.orientation != before.orientation { applyOrientation() } if settings.brightness != before.brightness { applyBrightness() } DevLog.shared.set(enabled: settings.developer) - DevLog.shared.event("réglages : \(settings)") + DevLog.shared.event(String(localized: "settings: \(String(describing: settings))")) settings.save() engine.apply(settings) } return } if event.isLong { - // Appui long en bas : calibrer les couleurs sur ce que l'on vise. + // Long press down: calibrate the colors on what the camera is aimed at. if event.button == .down { engine.calibrate() } - // Appui long sur le déclencheur : figer ou libérer mise au point et exposition. + // Long press on the shutter: lock or release focus and exposure. if event.button == .shutter { engine.toggleFocusLock() } return } switch event.button { case .shutter: if settings.mode == .photo { - DevLog.shared.event("photo demandée") + DevLog.shared.event(String(localized: "photo requested")) shutterFlash += 1 } settings.mode == .photo ? engine.capturePhoto() : engine.toggleRecording() @@ -265,11 +267,11 @@ final class AppModel { } } - // MARK: Galerie (haut, bas : parcourir · gauche : fermer) + // MARK: Gallery (up, down: browse · left: close) private func openGallery() { roll = Roll.previews() - guard !roll.isEmpty else { show("Aucune prise pour l'instant"); return } + guard !roll.isEmpty else { show(String(localized: "No shots yet")); return } gallery = Gallery(index: roll.count - 1) loadGalleryImage() } @@ -290,7 +292,7 @@ final class AppModel { loadGalleryImage() } - /// Transfert immédiat vers Photos de tout ce qui est sur disque (aperçu fabriqué d'abord). + /// Immediate transfer to Photos of everything on disk (the preview is made first). func exportRoll() { guard !exporting else { exportAgain = true; return } let pending = Roll.items() @@ -303,8 +305,8 @@ final class AppModel { Roll.export { moved, problem in Task { @MainActor in self.exporting = false - DevLog.shared.event("Photos : \(moved) prise(s) enregistrée(s)\(problem.map { ", \($0)" } ?? "")") - if let problem { self.show("Photos : \(problem)") } + DevLog.shared.event(String(localized: "Photos: \(String(moved)) shot(s) saved") + (problem.map { ", \($0)" } ?? "")) + if let problem { self.show(String(localized: "Photos: \(problem)")) } if self.exportAgain { self.exportAgain = false; self.exportRoll() } } } diff --git a/OpenMerou/App/DevLog.swift b/OpenMerou/App/DevLog.swift @@ -1,5 +1,8 @@ -// Mode développement : journal CSV des mesures et des événements, pour les essais dans l'eau. -// Un fichier par session dans Documents/journaux (visible dans l'app Fichiers et partageable). +// SPDX-License-Identifier: GPL-2.0-only +// Development mode: CSV log of readings and events, for in-water trials. +// One file per session in Documents/journaux (visible in the Files app and shareable). +// The folder name, the column names and the row types ("evenement", "mesure") are French for +// compatibility with the logs already recorded: do not rename them. import Foundation @MainActor @@ -33,9 +36,9 @@ final class DevLog { url = file start = .now write("heure,secondes,type,pression_int_pa,pression_ext_brut_pa,temperature_c,batterie,pompe,v1628,etape,remontee_corrigee_pa,thermique_iphone,texte") - event("journal ouvert") + event(String(localized: "log opened")) } else { - event("journal fermé") + event(String(localized: "log closed")) try? handle?.close() handle = nil } diff --git a/OpenMerou/App/OpenMerouApp.swift b/OpenMerou/App/OpenMerouApp.swift @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0-only import SwiftUI @main diff --git a/OpenMerou/Camera/CameraEngine.swift b/OpenMerou/Camera/CameraEngine.swift @@ -1,6 +1,7 @@ -// Prise de vue : interroge l'iPhone présent et utilise ce qu'il sait faire (objectifs, pleine -// résolution, ProRAW, formats vidéo, stabilisation). Tout le travail AVFoundation se fait sur une -// file série ; l'état remonte par `onState` sur la file principale. +// SPDX-License-Identifier: GPL-2.0-only +// Shooting: queries this iPhone and uses what it can do (lenses, full resolution, ProRAW, video +// formats, stabilization). All the AVFoundation work happens on a serial queue; the state comes +// back through `onState` on the main queue. @preconcurrency import AVFoundation import Photos import UIKit @@ -13,19 +14,19 @@ struct CameraState: Equatable, Sendable { var recordingSince: Date? var shots = 0 var message: String? - /// Change à chaque message, même répété, pour que l'écran le réaffiche. + /// Changes at each message, even a repeated one, so that the screen shows it again. var messageCount = 0 - /// Gains de couleur appliqués au capteur (nil : balance des blancs de l'iPhone). + /// Color gains applied to the sensor (nil: the iPhone's white balance). var gains: ColorGains? var gainsSaturated = false - /// Diagnostic : gains « gris moyen » bruts mesurés par l'iPhone, et plafond du capteur. + /// Diagnostics: raw "gray world" gains measured by the iPhone, and the sensor's ceiling. var grayWorld: ColorGains? var maxGain: Double? - /// Dernier calibrage fait à la demande, à enregistrer dans les réglages. + /// Last calibration done on request, to be saved in the settings. var calibration: ColorGains? - /// Autorisations refusées, à corriger avant de fermer le boîtier. + /// Denied permissions, to be fixed before closing the housing. var denied: [String] = [] - /// Mise au point et exposition verrouillées (appui long sur le déclencheur). + /// Focus and exposure locked (long press on the shutter). var focusLocked = false } @@ -62,17 +63,17 @@ final class CameraEngine: NSObject, @unchecked Sendable { publish() } - // MARK: Démarrage + // MARK: Startup func start(_ settings: CameraSettings) { - // Toutes les autorisations d'un coup au lancement : une fois le boîtier fermé, l'écran est hors d'atteinte. + // All the permissions at once at launch: once the housing is closed, the screen is out of reach. AVCaptureDevice.requestAccess(for: .video) { [self] granted in AVCaptureDevice.requestAccess(for: .audio) { [self] audio in PHPhotoLibrary.requestAuthorization(for: .addOnly) { [self] photos in queue.async { [self] in self.settings = settings - if !audio { state.denied.append("micro (vidéos sans son)") } - if photos != .authorized && photos != .limited { state.denied.append("photothèque (rien ne sera enregistré)") } + if !audio { state.denied.append(String(localized: "microphone (videos without sound)")) } + if photos != .authorized && photos != .limited { state.denied.append(String(localized: "photo library (nothing will be saved)")) } guard granted else { state.authorized = false; publish(); return } configure() session.startRunning() @@ -85,11 +86,11 @@ final class CameraEngine: NSObject, @unchecked Sendable { } private func configure() { - // Le périphérique virtuel le plus complet : il change d'objectif tout seul selon le zoom. + // The most complete virtual device: it switches lenses by itself according to the zoom. let types: [AVCaptureDevice.DeviceType] = [.builtInTripleCamera, .builtInDualWideCamera, .builtInDualCamera, .builtInWideAngleCamera] guard let device = AVCaptureDevice.DiscoverySession(deviceTypes: types, mediaType: .video, position: .back).devices.first, let input = try? AVCaptureDeviceInput(device: device) else { - say("Aucun appareil photo") + say(String(localized: "No camera")) return } self.device = device @@ -99,7 +100,7 @@ final class CameraEngine: NSObject, @unchecked Sendable { if session.canAddOutput(movieOutput) { session.addOutput(movieOutput) } session.commitConfiguration() - // Crans de zoom : chaque objectif, plus le recadrage ×2 du grand-angle et du téléobjectif. + // Zoom stops: each lens, plus the ×2 crop of the wide and telephoto lenses. let switchOvers = device.virtualDeviceSwitchOverVideoZoomFactors.map { CGFloat(truncating: $0) } let hasUltraWide = device.deviceType == .builtInTripleCamera || device.deviceType == .builtInDualWideCamera let wide = hasUltraWide ? (switchOvers.first ?? 1) : 1 @@ -133,7 +134,7 @@ final class CameraEngine: NSObject, @unchecked Sendable { } } - // MARK: Réglages + // MARK: Settings func apply(_ settings: CameraSettings) { queue.async { [self] in @@ -169,7 +170,7 @@ final class CameraEngine: NSObject, @unchecked Sendable { } session.commitConfiguration() - // Pleine résolution du capteur (48 Mpx quand l'iPhone l'offre) et ProRAW. + // Full sensor resolution (48 MP when the iPhone offers it) and ProRAW. if let largest = device.activeFormat.supportedMaxPhotoDimensions.max(by: { $0.width * $0.height < $1.width * $1.height }) { photoOutput.maxPhotoDimensions = largest } @@ -188,7 +189,7 @@ final class CameraEngine: NSObject, @unchecked Sendable { if let connection, connection.isVideoRotationAngleSupported(angle) { connection.videoRotationAngle = angle } } - /// Réglages qui ne demandent pas de reconfigurer la session. + /// Settings that do not require reconfiguring the session. private func applyLight() { guard let device else { return } let layer = previewLayer, angle = settings.orientation.videoAngle @@ -212,9 +213,9 @@ final class CameraEngine: NSObject, @unchecked Sendable { } } - // MARK: Couleurs + // MARK: Colors - /// Gains « gris moyen » mesurés par l'iPhone sur la scène, ajustés à ce que le capteur accepte. + /// "Gray world" gains measured by the iPhone on the scene, fitted to what the sensor accepts. private func measuredGains() -> (gains: ColorGains, saturated: Bool)? { guard let device, device.isLockingWhiteBalanceWithCustomDeviceGainsSupported else { return nil } let g = device.grayWorldDeviceWhiteBalanceGains @@ -224,14 +225,14 @@ final class CameraEngine: NSObject, @unchecked Sendable { state.grayWorld = raw state.maxGain = max var fit = raw.fitted(max: max) - // Hystérésis : le témoin s'allume au-delà du plafond et ne s'éteint que 10 % en dessous. + // Hysteresis: the indicator turns on above the ceiling and only turns off 10% below it. if state.gainsSaturated && raw.relativeRed > max * 0.9 { fit.saturated = true } return fit } private func lock(_ gains: ColorGains, saturated: Bool) { guard let device, device.isLockingWhiteBalanceWithCustomDeviceGainsSupported else { return } - let fitted = gains.fitted(max: Double(device.maxWhiteBalanceGain)).gains // jamais hors bornes + let fitted = gains.fitted(max: Double(device.maxWhiteBalanceGain)).gains // never out of bounds guard (try? device.lockForConfiguration()) != nil else { return } device.setWhiteBalanceModeLocked(with: .init(redGain: Float(fitted.red), greenGain: Float(fitted.green), blueGain: Float(fitted.blue))) device.unlockForConfiguration() @@ -244,7 +245,7 @@ final class CameraEngine: NSObject, @unchecked Sendable { colorTimer?.cancel() colorTimer = nil guard settings.colorMode != .system, device.isLockingWhiteBalanceWithCustomDeviceGainsSupported else { - if settings.colorMode != .system { state.message = "Couleurs : réglage manuel indisponible sur cet appareil" } + if settings.colorMode != .system { state.message = String(localized: "Colors: manual setting unavailable on this device") } if device.isWhiteBalanceModeSupported(.continuousAutoWhiteBalance), (try? device.lockForConfiguration()) != nil { device.whiteBalanceMode = .continuousAutoWhiteBalance device.unlockForConfiguration() @@ -257,7 +258,7 @@ final class CameraEngine: NSObject, @unchecked Sendable { case .calibrated: if let saved = settings.calibration { lock(saved, saturated: false) } else { calibrateNow() } default: - // Suivi automatique : deux mesures par seconde, lissées pour éviter le pompage des couleurs. + // Automatic tracking: two measurements per second, smoothed to keep the colors from hunting. let timer = DispatchSource.makeTimerSource(queue: queue) timer.schedule(deadline: .now() + 0.5, repeating: 0.5) timer.setEventHandler { [weak self] in @@ -273,13 +274,13 @@ final class CameraEngine: NSObject, @unchecked Sendable { } private func calibrateNow() { - guard let measured = measuredGains() else { say("Calibrage impossible"); return } + guard let measured = measuredGains() else { say(String(localized: "Calibration failed")); return } lock(measured.gains, saturated: measured.saturated) state.calibration = measured.gains - say(measured.saturated ? "Couleurs calibrées (rouge au maximum)" : "Couleurs calibrées") + say(measured.saturated ? String(localized: "Colors calibrated (red at maximum)") : String(localized: "Colors calibrated")) } - /// Calibrage à la demande : viser une surface claire (sable, ardoise) et appuyer. + /// Calibration on request: aim at a light surface (sand, slate) and press. func calibrate() { queue.async { [self] in colorTimer?.cancel() @@ -297,7 +298,7 @@ final class CameraEngine: NSObject, @unchecked Sendable { audioInput = input } - // MARK: Commandes + // MARK: Commands func cycleLens(_ step: Int) { queue.async { [self] in @@ -308,7 +309,7 @@ final class CameraEngine: NSObject, @unchecked Sendable { } } - /// Sous l'eau, l'autofocus pompe sur les particules : on peut figer mise au point et exposition. + /// Underwater, autofocus hunts on particles: focus and exposure can be locked. func toggleFocusLock() { queue.async { [self] in guard let device, (try? device.lockForConfiguration()) != nil else { return } @@ -322,7 +323,7 @@ final class CameraEngine: NSObject, @unchecked Sendable { } device.unlockForConfiguration() state.focusLocked = lock - say(lock ? "Mise au point et exposition verrouillées" : "Mise au point et exposition automatiques") + say(lock ? String(localized: "Focus and exposure locked") : String(localized: "Focus and exposure automatic")) } } @@ -335,14 +336,14 @@ final class CameraEngine: NSObject, @unchecked Sendable { let photoSettings = raw.map { AVCapturePhotoSettings(rawPixelFormatType: $0, processedFormat: heif) } ?? AVCapturePhotoSettings(format: heif) photoSettings.maxPhotoDimensions = photoOutput.maxPhotoDimensions - photoSettings.photoQualityPrioritization = .balanced // les rafales passent avant le traitement le plus lourd + photoSettings.photoQualityPrioritization = .balanced // bursts come before the heaviest processing rotate(photoOutput.connection(with: .video)) let delegate = PhotoDelegate { [weak self] id, result in self?.queue.async { self?.photoDelegates[id] = nil switch result { case .success: self?.state.shots += 1; self?.publish() - case .failure(let error): self?.say("Photo : \(error.localizedDescription)") + case .failure(let error): self?.say(String(localized: "Photo: \(error.localizedDescription)")) } } } @@ -378,7 +379,7 @@ final class CameraEngine: NSObject, @unchecked Sendable { extension CameraEngine: AVCaptureFileOutputRecordingDelegate { func fileOutput(_ output: AVCaptureFileOutput, didFinishRecordingTo url: URL, from connections: [AVCaptureConnection], error: Error?) { - // Un enregistrement interrompu (disque plein, appel) laisse souvent un fichier valide : on le garde. + // An interrupted recording (disk full, phone call) often leaves a valid file: keep it. let usable = (error as NSError?)?.userInfo[AVErrorRecordingSuccessfullyFinishedKey] as? Bool ?? (error == nil) queue.async { [self] in state.recordingSince = nil @@ -390,7 +391,7 @@ extension CameraEngine: AVCaptureFileOutputRecordingDelegate { publish() } else { try? FileManager.default.removeItem(at: url) - say("Vidéo : \(error?.localizedDescription ?? "échec")") + say(String(localized: "Video: \(error?.localizedDescription ?? String(localized: "failed"))")) } } } diff --git a/OpenMerou/Camera/CameraSettings.swift b/OpenMerou/Camera/CameraSettings.swift @@ -1,13 +1,15 @@ -// Réglages et menu de la caméra : logique pure, pilotée par les boutons du boîtier. +// SPDX-License-Identifier: GPL-2.0-only +// Camera settings and menu: pure logic, driven by the housing buttons. +// The settings are persisted as JSON (UserDefaults key and enum raw values): do not rename them. import Foundation enum CaptureMode: String, Codable, Sendable { case photo, video } enum PhotoFormat: String, Codable, Sendable, CaseIterable { case heif, rawHeif } -/// Orientation fixe : sous l'eau, l'iPhone pointe souvent vers le bas et ne peut pas se fier à la gravité. +/// Fixed orientation: underwater, the iPhone often points down and cannot rely on gravity. enum ScreenOrientation: String, Codable, Sendable, CaseIterable { case landscape, landscapeFlipped, portrait - /// Angle de rotation de l'image pour l'appareil photo arrière. + /// Rotation angle of the image for the back camera. var videoAngle: Double { switch self { case .landscape: 0 @@ -17,33 +19,36 @@ enum ScreenOrientation: String, Codable, Sendable, CaseIterable { } } -/// Couleurs : balance des blancs de l'iPhone, ou gains imposés au capteur pour compenser l'eau. +/// Colors: the iPhone's white balance, or gains forced on the sensor to compensate for the water. enum ColorMode: String, Codable, Sendable, CaseIterable { case system, underwater, calibrated } -/// Gains rouge, vert, bleu appliqués au capteur. +/// Red, green and blue gains applied to the sensor. struct ColorGains: Codable, Equatable, Sendable { var red: Double, green: Double, blue: Double - /// Ramène le plus petit gain à 1 (l'iPhone refuse moins), puis plafonne au maximum de l'appareil. - /// `saturated` : la correction voulue dépasse ce que le capteur accepte (trop profond, trop loin). + /// Brings the smallest gain to 1 (the iPhone refuses less), then caps at the device maximum. + /// `saturated`: the wanted correction exceeds what the sensor accepts (too deep, too far). func fitted(max: Double) -> (gains: ColorGains, saturated: Bool) { let low = Swift.max(Swift.min(red, green, blue), 0.01) let wanted = [red / low, green / low, blue / low] let clamped = wanted.map { Swift.min(Swift.max($0, 1), max) } - // Seul le rouge compte : c'est lui que l'eau absorbe (sous une lampe chaude, c'est le bleu qui bute). + // Only red matters: it is what water absorbs (under a warm light, blue is the one that hits the cap). return (ColorGains(red: clamped[0], green: clamped[1], blue: clamped[2]), wanted[0] > max * 1.001) } - /// Rouge voulu, rapporté au plus petit gain (pour l'hystérésis du témoin). + /// Wanted red, relative to the smallest gain (for the hysteresis of the indicator). var relativeRed: Double { red / Swift.max(Swift.min(red, green, blue), 0.01) } - /// Glisse vers `target` sans à-coups (suivi automatique). + /// Slides toward `target` smoothly (automatic tracking). func moved(toward target: ColorGains, by weight: Double) -> ColorGains { ColorGains(red: red + (target.red - red) * weight, green: green + (target.green - green) * weight, blue: blue + (target.blue - blue) * weight) } - var label: String { String(format: "R×%.2f V×%.2f B×%.2f", red, green, blue) } + var label: String { + let r = String(format: "%.2f", red), g = String(format: "%.2f", green), b = String(format: "%.2f", blue) + return String(localized: "R×\(r) G×\(g) B×\(b)") + } } enum Stabilization: String, Codable, Sendable, CaseIterable { case off, standard, cinematic, extended } @@ -53,9 +58,9 @@ struct VideoQuality: Codable, Equatable, Hashable, Sendable { let fps: Int var width: Int { height == 720 ? 1280 : height == 1080 ? 1920 : 3840 } - var label: String { (height == 2160 ? "4K" : "\(height)p") + " · \(fps) i/s" } + var label: String { String(localized: "\(height == 2160 ? "4K" : "\(height)p") · \(String(fps)) fps") } - /// Du plus modeste au plus exigeant ; l'app ne propose que ce que l'iPhone sait faire. + /// From the most modest to the most demanding; the app only offers what the iPhone can do. static let all = [ VideoQuality(height: 720, fps: 30), VideoQuality(height: 1080, fps: 30), VideoQuality(height: 1080, fps: 60), VideoQuality(height: 2160, fps: 30), VideoQuality(height: 2160, fps: 60), VideoQuality(height: 2160, fps: 120), @@ -68,15 +73,15 @@ struct CameraSettings: Codable, Equatable, Sendable { var exposureBias = 0.0 var stabilization = Stabilization.standard var videoQuality = VideoQuality(height: 2160, fps: 30) - /// Secondes sans bouton avant la veille de l'écran ; 0 = jamais. + /// Seconds without a button press before the screen sleeps; 0 = never. var sleepAfter = 120 var orientation = ScreenOrientation.landscape var colorMode = ColorMode.underwater - /// Luminosité de l'écran en % ; 0 = celle du système. + /// Screen brightness in %; 0 = the system's. var brightness = 0 - /// Gains du dernier calibrage sur une surface claire. + /// Gains of the last calibration on a light surface. var calibration: ColorGains? - /// Mode développement : journal CSV et affichages supplémentaires. + /// Development mode: CSV log and extra displays. var developer = false static let key = "cameraSettings5" @@ -90,7 +95,7 @@ struct CameraSettings: Codable, Equatable, Sendable { } } -/// Ce que l'iPhone présent sait faire (rempli par la caméra au démarrage). +/// What this iPhone can do (filled in by the camera at startup). struct CameraCapabilities: Equatable, Sendable { var zoomLabels: [String] = [] var proRAW = false @@ -103,20 +108,20 @@ struct CameraCapabilities: Equatable, Sendable { enum CameraSetting: Sendable, CaseIterable { case color, photoFormat, exposure, stabilization, videoQuality, sleep, orientation, developer, brightness - /// Réglages de la liste « Réglages » (la luminosité a sa propre entrée au menu). + /// Settings of the "Settings" list (brightness has its own menu entry). static let listed = allCases.filter { $0 != .brightness } var title: String { switch self { - case .color: "Couleurs" - case .photoFormat: "Format photo" - case .exposure: "Exposition" - case .stabilization: "Stabilisation vidéo" - case .videoQuality: "Qualité vidéo" - case .sleep: "Veille de l'écran" - case .orientation: "Orientation" - case .developer: "Développement" - case .brightness: "Luminosité" + case .color: String(localized: "Colors") + case .photoFormat: String(localized: "Photo format") + case .exposure: String(localized: "Exposure") + case .stabilization: String(localized: "Video stabilization") + case .videoQuality: String(localized: "Video quality") + case .sleep: String(localized: "Screen sleep") + case .orientation: String(localized: "Orientation") + case .developer: String(localized: "Development") + case .brightness: String(localized: "Brightness") } } } @@ -126,24 +131,24 @@ enum SettingValue: Equatable, Sendable { var label: String { switch self { - case .color(.system): "iPhone (sans correction)" - case .color(.underwater): "Sous l'eau, automatique" - case .color(.calibrated): "Sous l'eau, calibrées" + case .color(.system): String(localized: "iPhone (no correction)") + case .color(.underwater): String(localized: "Underwater, automatic") + case .color(.calibrated): String(localized: "Underwater, calibrated") case .photoFormat(.heif): "HEIF" case .photoFormat(.rawHeif): "ProRAW + HEIF" case .exposure(let v): v == 0 ? "0" : String(format: "%+.1f", v) - case .stabilization(.off): "Désactivée" - case .stabilization(.standard): "Standard" - case .stabilization(.cinematic): "Cinématique" - case .stabilization(.extended): "Cinématique étendue" + case .stabilization(.off): String(localized: "Off") + case .stabilization(.standard): String(localized: "Standard") + case .stabilization(.cinematic): String(localized: "Cinematic") + case .stabilization(.extended): String(localized: "Cinematic extended") case .videoQuality(let q): q.label - case .sleep(0): "Jamais" + case .sleep(0): String(localized: "Never") case .sleep(let s): s < 60 ? "\(s) s" : "\(s / 60) min" - case .orientation(.landscape): "Paysage" - case .orientation(.landscapeFlipped): "Paysage inversé" - case .orientation(.portrait): "Portrait" - case .developer(let on): on ? "Activé" : "Désactivé" - case .brightness(0): "Celle de l'iPhone" + case .orientation(.landscape): String(localized: "Landscape") + case .orientation(.landscapeFlipped): String(localized: "Landscape flipped") + case .orientation(.portrait): String(localized: "Portrait") + case .developer(let on): on ? String(localized: "Enabled") : String(localized: "Disabled") + case .brightness(0): String(localized: "iPhone setting") case .brightness(let v): "\(v) %" } } @@ -196,19 +201,19 @@ extension CameraSettings { } } -/// Menu : droite ouvre et valide, haut et bas déplacent, gauche remonte d'un niveau ou ferme. +/// Menu: right opens and confirms, up and down move, left goes up one level or closes. struct CameraMenu: Equatable, Sendable { enum RootItem: Sendable, CaseIterable { case photo, video, sleep, settings, brightness, info var title: String { switch self { - case .photo: "Photo" - case .video: "Vidéo" - case .sleep: "Veille" - case .settings: "Réglages" - case .brightness: "Luminosité" - case .info: "Informations" + case .photo: String(localized: "Photo") + case .video: String(localized: "Video") + case .sleep: String(localized: "Sleep") + case .settings: String(localized: "Settings") + case .brightness: String(localized: "Brightness") + case .info: String(localized: "Information") } } } @@ -224,7 +229,7 @@ struct CameraMenu: Equatable, Sendable { private(set) var level: Level? = nil var isOpen: Bool { level != nil } - /// Niveau d'où l'on est venu pour régler `setting`. + /// Level we came from to change `setting`. private func parent(of setting: CameraSetting) -> Level { if let i = CameraSetting.listed.firstIndex(of: setting) { return .settings(i) } return .root(RootItem.allCases.firstIndex(of: .brightness)!) @@ -233,7 +238,7 @@ struct CameraMenu: Equatable, Sendable { mutating func open() { level = .root(0) } mutating func close() { level = nil } - /// Applique un bouton ; modifie `settings` quand une option est validée. + /// Applies a button; changes `settings` when an option is confirmed. mutating func handle(_ button: HousingButton, settings: inout CameraSettings, caps: CameraCapabilities) -> Action { guard let level else { return .none } let step = button == .down ? 1 : button == .up ? -1 : 0 diff --git a/OpenMerou/Camera/Roll.swift b/OpenMerou/Camera/Roll.swift @@ -1,7 +1,10 @@ -// Chaque prise est écrite sur disque (Documents/pellicule) puis transférée aussitôt dans Photos : -// rien ne dépend de la fin de la plongée, et une prise restée là après un plantage part au lancement -// suivant. Pour la galerie, l'app garde seulement une image réduite de chaque prise de la session -// (elle n'a que le droit d'ajouter à la photothèque, pas de la relire). +// SPDX-License-Identifier: GPL-2.0-only +// Each shot is written to disk (Documents/pellicule) then transferred to Photos right away: +// nothing depends on the end of the dive, and a shot left there after a crash goes at the next +// launch. For the gallery, the app only keeps a reduced image of each shot of the session +// (it is only allowed to add to the photo library, not to read it back). +// The folder names ("pellicule", "apercus") are French for compatibility with existing installs, +// which may still hold shots there: do not rename them. import AVFoundation import ImageIO import Photos @@ -11,7 +14,7 @@ struct RollItem: Identifiable, Equatable, Sendable { let url: URL var id: String { url.lastPathComponent } var isVideo: Bool { url.pathExtension == "mov" } - /// Négatif ProRAW pris avec la photo, s'il existe. + /// ProRAW negative taken with the photo, if any. var rawURL: URL? { let raw = url.deletingPathExtension().appendingPathExtension("dng") return FileManager.default.fileExists(atPath: raw.path) ? raw : nil @@ -25,7 +28,7 @@ enum Roll { return url } - /// Nom horodaté (l'ordre alphabétique est l'ordre des prises), sans extension. + /// Timestamped name (alphabetical order is shooting order), without extension. static func newBase() -> URL { let format = DateFormatter() format.dateFormat = "yyyyMMdd-HHmmss-SSS" @@ -39,7 +42,7 @@ enum Roll { .map(RollItem.init) } - // MARK: Aperçus de la session (galerie) + // MARK: Previews of the session (gallery) static var previewDirectory: URL { let url = FileManager.default.urls(for: .cachesDirectory, in: .userDomainMask)[0].appendingPathComponent("apercus") @@ -47,7 +50,7 @@ enum Roll { return url } - /// Aperçus de la session, du plus ancien au plus récent ; une vidéo porte « -video » dans son nom. + /// Previews of the session, oldest first; a video has "-video" in its name. static func previews() -> [URL] { ((try? FileManager.default.contentsOfDirectory(at: previewDirectory, includingPropertiesForKeys: nil)) ?? []) .filter { $0.pathExtension == "jpg" }.sorted { $0.lastPathComponent < $1.lastPathComponent } @@ -62,7 +65,7 @@ enum Roll { return previewDirectory.appendingPathComponent(base).appendingPathExtension("jpg") } - /// Fabrique l'aperçu d'une prise s'il manque (à faire avant le transfert, qui déplace le fichier). + /// Makes the preview of a shot when it is missing (before the transfer, which moves the file). static func makePreview(_ item: RollItem) async { let target = previewURL(for: item) guard !FileManager.default.fileExists(atPath: target.path), let image = await preview(item), @@ -75,7 +78,7 @@ enum Roll { try? FileManager.default.removeItem(at: item.url) } - /// Image réduite pour l'écran (la photo fait jusqu'à 48 Mpx) ; première image pour une vidéo. + /// Reduced image for the screen (a photo is up to 48 MP); first frame for a video. static func preview(_ item: RollItem, maxPixel: Int = 1600) async -> UIImage? { if item.isVideo { let generator = AVAssetImageGenerator(asset: AVURLAsset(url: item.url)) @@ -93,13 +96,13 @@ enum Roll { return UIImage(cgImage: image) } - /// Transfère toute la pellicule vers Photos, une prise à la fois ; ne supprime que ce qui est transféré. + /// Transfers the whole roll to Photos, one shot at a time; only deletes what has been transferred. static func export(done: @escaping @Sendable (_ moved: Int, _ problem: String?) -> Void) { let pending = items() guard !pending.isEmpty else { done(0, nil); return } PHPhotoLibrary.requestAuthorization(for: .addOnly) { status in guard status == .authorized || status == .limited else { - done(0, "accès à la photothèque refusé (les prises restent dans Fichiers → Open Mérou)") + done(0, String(localized: "photo library access denied (shots stay in Files → Open Mérou)")) return } exportNext(pending[...], moved: 0, done: done) @@ -113,7 +116,7 @@ enum Roll { request.addResource(with: item.isVideo ? .video : .photo, fileURL: item.url, options: nil) if let raw = item.rawURL { request.addResource(with: .alternatePhoto, fileURL: raw, options: nil) } } completionHandler: { ok, error in - guard ok else { done(moved, error?.localizedDescription ?? "échec du transfert"); return } + guard ok else { done(moved, error?.localizedDescription ?? String(localized: "transfer failed")); return } delete(item) exportNext(rest.dropFirst(), moved: moved + 1, done: done) } diff --git a/OpenMerou/Housing/HousingClient.swift b/OpenMerou/Housing/HousingClient.swift @@ -1,5 +1,6 @@ -// Connexion Bluetooth au boîtier. Seule écriture : la pompe (1624), avec arrêt automatique -// au seuil de vide ou après un délai, comme le fait l'app officielle (docs/PROTOCOLE.md). +// SPDX-License-Identifier: GPL-2.0-only +// Bluetooth connection to the housing. The only write: the pump (1624), with an automatic stop +// at the vacuum threshold or after a timeout, as the official app does (docs/PROTOCOL.md). @preconcurrency import CoreBluetooth import Foundation import Observation @@ -16,11 +17,11 @@ final class HousingClient: NSObject { var label: String { switch self { - case .bluetoothUnavailable(let why): "Bluetooth indisponible : \(why)" - case .scanning: "Recherche du boîtier…" - case .connecting(let name): "Connexion à \(name)…" - case .connected(let name): "Connecté à \(name)" - case .disconnected(let why): "Déconnecté (\(why)), reconnexion…" + case .bluetoothUnavailable(let why): String(localized: "Bluetooth unavailable: \(why)") + case .scanning: String(localized: "Looking for the housing…") + case .connecting(let name): String(localized: "Connecting to \(name)…") + case .connected(let name): String(localized: "Connected to \(name)") + case .disconnected(let why): String(localized: "Disconnected (\(why)), reconnecting…") } } } @@ -31,15 +32,15 @@ final class HousingClient: NSObject { let text: String } - private(set) var status: Status = .bluetoothUnavailable("démarrage") + private(set) var status: Status = .bluetoothUnavailable(String(localized: "starting")) private(set) var readings = HousingReadings() - private(set) var deviceInfo: [String: String] = [:] + private(set) var deviceInfo: [DeviceInfoField: String] = [:] private(set) var log: [LogLine] = [] private(set) var lastSensorUpdate: Date? private(set) var vacuum = VacuumSequence() - /// Boutons laissés à la caméra par la séquence de mise sous vide. + /// Buttons left to the camera by the vacuum sequence. @ObservationIgnored var cameraButton: ((ButtonEvent) -> Void)? - /// Appelé à chaque appui, quel que soit le destinataire (couper le son d'une alarme). + /// Called at each press, whoever it is meant for (to silence an alarm). @ObservationIgnored var anyButton: (() -> Void)? func bypassVacuum() { vacuum.bypass() } @@ -49,9 +50,9 @@ final class HousingClient: NSObject { @ObservationIgnored private var pumpCharacteristic: CBCharacteristic? @ObservationIgnored private var pumpTimeout: Task<Void, Never>? - /// Vrai entre notre ordre de marche et notre ordre d'arrêt. + /// True between our start order and our stop order. private(set) var pumpRequested = false - /// Vrai quand un vrai boîtier est connecté. + /// True when a real housing is connected. var isConnected: Bool { if case .connected = status { return !simulated } return false @@ -59,17 +60,17 @@ final class HousingClient: NSObject { var canPump: Bool { pumpCharacteristic != nil || simulation != nil } - /// Seuil d'arrêt observé avec l'app officielle : premier échantillon sous 80 kPa. + /// Stop threshold observed with the official app: first sample below 80 kPa. static let vacuumTargetPa = 80_000.0 - /// Garde-fou : l'app officielle pompe environ 10 s. + /// Safeguard: the official app pumps for about 10 s. static let pumpMaxSeconds = 15.0 - /// Vrai quand l'usager a demandé la déconnexion : on ne se reconnecte pas tout seul. + /// True when the user asked to disconnect: no automatic reconnection. private(set) var released = false - /// Dans la capture, l'app officielle n'envoie aucun ordre d'extinction : elle coupe la connexion - /// (HCI 0x16) et le boîtier s'éteint. On fait pareil. - // MARK: Boîtier simulé (démonstration, revue de l'interface, réviseurs sans boîtier) + /// In the capture, the official app sends no power-off order: it drops the connection + /// (HCI 0x16) and the housing turns off. We do the same. + // MARK: Simulated housing (demo, interface review, reviewers without a housing) private struct Simulation { var pressurePa = 100_960.0 @@ -87,16 +88,16 @@ final class HousingClient: NSObject { central.stopScan() if let peripheral { central.cancelPeripheralConnection(peripheral) } peripheral = nil - released = true // ne pas reprendre un vrai boîtier pendant la démonstration + released = true // do not pick up a real housing during the demo simulation = Simulation() simulated = true vacuum = VacuumSequence() - vacuum.testDuration = 20 // démonstration : test raccourci - vacuum.bypass() // droit à la caméra ; appui long à droite pour montrer la mise sous vide + vacuum.testDuration = 20 // demo: shortened test + vacuum.bypass() // straight to the camera; long press right to show the vacuum sequence readings = HousingReadings() - status = .connected("boîtier simulé") - deviceInfo = ["Modèle": "Boîtier simulé"] - note("Simulation démarrée") + status = .connected(String(localized: "simulated housing")) + deviceInfo = [.model: String(localized: "Simulated housing")] + note(String(localized: "Simulation started")) ingest(HousingUUID.alarm, Data([0x00])) ingest(HousingUUID.pumpState, Data([0x02])) simulationTask = Task { [weak self] in @@ -116,11 +117,11 @@ final class HousingClient: NSObject { pumpRequested = false readings = HousingReadings() deviceInfo = [:] - note("Simulation arrêtée") + note(String(localized: "Simulation stopped")) reconnect() } - /// Appui sur un bouton du boîtier simulé (boutons affichés à l'écran). + /// Press on a button of the simulated housing (buttons shown on screen). func simulatedPress(_ button: HousingButton, long: Bool = false) { guard simulation != nil else { return } ingest(HousingUUID.button, Data([button.rawValue << 4 | (long ? 1 : 0)])) @@ -129,12 +130,12 @@ final class HousingClient: NSObject { private func simulationTick() { guard var sim = simulation else { return } if sim.pumpOn { - sim.pressurePa -= 2_100 * 0.35 // ~2 kPa/s, comme le vrai boîtier + sim.pressurePa -= 2_100 * 0.35 // ~2 kPa/s, like the real housing sim.battery = max(5, sim.battery - 0.15) } else if case .opening = vacuum.step { - sim.pressurePa = min(99_300, sim.pressurePa + 6_000) // bouchon ouvert : retour à l'air + sim.pressurePa = min(99_300, sim.pressurePa + 6_000) // plug open: air comes back in } else if sim.pressurePa < 90_000 { - sim.pressurePa += 30.0 / 60 * 0.35 // ~30 Pa/min, fuite résiduelle normale + sim.pressurePa += 30.0 / 60 * 0.35 // ~30 Pa/min, normal residual leak sim.temperatureC = min(26, sim.temperatureC + 0.002) } sim.pressurePa += Double.random(in: -8...8) @@ -149,17 +150,17 @@ final class HousingClient: NSObject { func release() { if simulation != nil { stopSimulation(); return } guard let peripheral else { return } - if pumpRequested { stopPump(reason: "déconnexion") } + if pumpRequested { stopPump(reason: String(localized: "disconnection")) } released = true central.stopScan() central.cancelPeripheralConnection(peripheral) - note("Déconnexion demandée") + note(String(localized: "Disconnection requested")) } - /// Traite une valeur du boîtier, réel ou simulé. + /// Handles a value from the housing, real or simulated. private func ingest(_ uuid: CBUUID, _ data: Data) { - if let label = HousingUUID.deviceInfoStrings[uuid] { - deviceInfo[label] = String(decoding: data, as: UTF8.self) + if let field = HousingUUID.deviceInfoStrings[uuid] { + deviceInfo[field] = String(decoding: data, as: UTF8.self) return } let before = vacuum.step @@ -174,14 +175,14 @@ final class HousingClient: NSObject { run(vacuum.sensors(pressurePa: readings.internalPressurePa, temperatureC: readings.temperatureC, now: .now)) } if uuid == HousingUUID.internalPressure { DevLog.shared.sensors(readings, vacuum) } - // Pompe en marche sans qu'on l'ait demandé (coupure pendant le pompage) : on l'arrête. + // Pump running although we did not ask for it (connection lost while pumping): stop it. if uuid == HousingUUID.pumpState, readings.pumpState == .running, !pumpRequested, simulation == nil { - stopPump(reason: "trouvée en marche") + stopPump(reason: String(localized: "found running")) } - if vacuum.step != before { note("Séquence : \(vacuum.step)") } + if vacuum.step != before { note(String(localized: "Sequence: \(String(describing: vacuum.step))")) } if uuid == HousingUUID.internalPressure, pumpRequested, let p = readings.internalPressurePa, p < Self.vacuumTargetPa { - stopPump(reason: "vide atteint, \(Int(p)) Pa") + stopPump(reason: String(localized: "vacuum reached, \(String(Int(p))) Pa")) } if [HousingUUID.internalPressure, HousingUUID.externalPressure, HousingUUID.temperature].contains(uuid) { lastSensorUpdate = .now @@ -192,7 +193,7 @@ final class HousingClient: NSObject { for effect in effects { switch effect { case .startPump: startPump() - case .stopPump: if pumpRequested { stopPump(reason: "séquence") } + case .stopPump: if pumpRequested { stopPump(reason: String(localized: "sequence")) } case .disconnect: release() } } @@ -208,7 +209,7 @@ final class HousingClient: NSObject { func startPump() { guard !pumpRequested, simulation != nil || (peripheral != nil && pumpCharacteristic != nil) else { return } if let p = readings.internalPressurePa, p < Self.vacuumTargetPa { - note("Pompe : vide déjà atteint (\(Int(p)) Pa)") + note(String(localized: "Pump: vacuum already reached (\(String(Int(p))) Pa)")) return } pumpRequested = true @@ -218,11 +219,11 @@ final class HousingClient: NSObject { } else if let peripheral, let pumpCharacteristic { peripheral.writeValue(Data([0x01]), for: pumpCharacteristic, type: .withResponse) } - note("Pompe : marche demandée") + note(String(localized: "Pump: start requested")) pumpTimeout = Task { [weak self] in try? await Task.sleep(for: .seconds(Self.pumpMaxSeconds)) guard !Task.isCancelled else { return } - self?.stopPump(reason: "délai de \(Int(Self.pumpMaxSeconds)) s") + self?.stopPump(reason: String(localized: "\(String(Int(Self.pumpMaxSeconds))) s timeout")) } } @@ -233,14 +234,14 @@ final class HousingClient: NSObject { simulation?.pumpOn = false pumpRequested = false ingest(HousingUUID.pumpState, Data([0x02])) - note("Pompe : arrêt demandé (\(reason))") + note(String(localized: "Pump: stop requested (\(reason))")) return } guard let peripheral, let pumpCharacteristic else { pumpRequested = false; return } - // Toujours envoyer l'arrêt, même si on ne pense pas l'avoir démarrée. + // Always send the stop, even when we do not think we started it. peripheral.writeValue(Data([0x00]), for: pumpCharacteristic, type: .withResponse) pumpRequested = false - note("Pompe : arrêt demandé (\(reason))") + note(String(localized: "Pump: stop requested (\(reason))")) } override init() { @@ -255,13 +256,13 @@ final class HousingClient: NSObject { } private func startScan() { - // Déjà connecté au système (par exemple par une autre app) ? + // Already connected to the system (by another app, for instance)? if let known = central.retrieveConnectedPeripherals(withServices: [HousingUUID.housingService]).first { connect(known) return } status = .scanning - // Le boîtier n'annonce pas ses services : on filtre sur le nom. + // The housing does not advertise its services: filter on the name. central.scanForPeripherals(withServices: nil, options: nil) } @@ -277,15 +278,15 @@ final class HousingClient: NSObject { extension HousingClient: CBCentralManagerDelegate { nonisolated func centralManagerDidUpdateState(_ central: CBCentralManager) { MainActor.assumeIsolated { - guard simulation == nil else { return } // la démonstration garde son état + guard simulation == nil else { return } // the demo keeps its state switch central.state { case .poweredOn: - note("Bluetooth prêt") + note(String(localized: "Bluetooth ready")) startScan() - case .poweredOff: status = .bluetoothUnavailable("éteint") - case .unauthorized: status = .bluetoothUnavailable("accès refusé dans Réglages") - case .unsupported: status = .bluetoothUnavailable("non pris en charge") - default: status = .bluetoothUnavailable("en attente") + case .poweredOff: status = .bluetoothUnavailable(String(localized: "powered off")) + case .unauthorized: status = .bluetoothUnavailable(String(localized: "access denied in Settings")) + case .unsupported: status = .bluetoothUnavailable(String(localized: "not supported")) + default: status = .bluetoothUnavailable(String(localized: "waiting")) } } } @@ -296,7 +297,7 @@ extension HousingClient: CBCentralManagerDelegate { guard name == HousingUUID.advertisedName else { return } MainActor.assumeIsolated { guard !released else { return } - note("Boîtier trouvé (\(RSSI) dBm)") + note(String(localized: "Housing found (\("\(RSSI)") dBm)")) connect(peripheral) } } @@ -304,7 +305,7 @@ extension HousingClient: CBCentralManagerDelegate { nonisolated func centralManager(_ central: CBCentralManager, didConnect peripheral: CBPeripheral) { MainActor.assumeIsolated { status = .connected(peripheral.name ?? HousingUUID.advertisedName) - note("Connecté") + note(String(localized: "Connected")) peripheral.discoverServices(HousingUUID.services) } } @@ -312,7 +313,7 @@ extension HousingClient: CBCentralManagerDelegate { nonisolated func centralManager(_ central: CBCentralManager, didFailToConnect peripheral: CBPeripheral, error: Error?) { MainActor.assumeIsolated { - note("Échec de connexion : \(error?.localizedDescription ?? "?")") + note(String(localized: "Connection failed: \(error?.localizedDescription ?? "?")")) startScan() } } @@ -320,14 +321,14 @@ extension HousingClient: CBCentralManagerDelegate { nonisolated func centralManager(_ central: CBCentralManager, didDisconnectPeripheral peripheral: CBPeripheral, error: Error?) { MainActor.assumeIsolated { - let why = error?.localizedDescription ?? "fin de connexion" + let why = error?.localizedDescription ?? String(localized: "connection closed") pumpCharacteristic = nil pumpTimeout?.cancel() pumpRequested = false vacuum.connectionLost() status = .disconnected(why) - note("Déconnecté : \(why)") - // Une demande de connexion en attente n'expire pas : le boîtier sera repris dès son retour. + note(String(localized: "Disconnected: \(why)")) + // A pending connection request does not expire: the housing is picked up as soon as it comes back. if !released { central.connect(peripheral) } } } @@ -361,7 +362,7 @@ extension HousingClient: CBPeripheralDelegate { error: Error?) { guard let error else { return } let text = error.localizedDescription - MainActor.assumeIsolated { note("Écriture refusée : \(text)") } + MainActor.assumeIsolated { note(String(localized: "Write refused: \(text)")) } } nonisolated func peripheral(_ peripheral: CBPeripheral, didUpdateValueFor characteristic: CBCharacteristic, diff --git a/OpenMerou/Housing/HousingProtocol.swift b/OpenMerou/Housing/HousingProtocol.swift @@ -1,57 +1,74 @@ -// Protocole BLE du boîtier de plongée Oceanic+ (nom annoncé « HUISH »), obtenu par rétro-ingénierie -// pour l'interopérabilité : voir docs/PROTOCOLE.md. Valeurs brutes, petit-boutistes, sans chiffrement. +// SPDX-License-Identifier: GPL-2.0-only +// BLE protocol of the Oceanic+ dive housing (advertised name "HUISH"), reverse-engineered +// for interoperability: see docs/PROTOCOL.md. Raw values, little-endian, no encryption. @preconcurrency import CoreBluetooth import Foundation enum HousingUUID { - /// Base commune des services propres : 0000XXXX-1212-EFDE-1523-785FEABCD123. + /// Common base of the custom services: 0000XXXX-1212-EFDE-1523-785FEABCD123. static func custom(_ short: String) -> CBUUID { CBUUID(string: "0000\(short)-1212-EFDE-1523-785FEABCD123") } - // Service « LED and Button » de l'exemple Nordic. + // "LED and Button" service of the Nordic sample. nonisolated(unsafe) static let buttonService = custom("1523") nonisolated(unsafe) static let button = custom("1524") - // Service propre du boîtier. + // The housing's own service. nonisolated(unsafe) static let housingService = custom("1623") - nonisolated(unsafe) static let pump = custom("1624") // écriture : 01 marche, 00 arrêt - nonisolated(unsafe) static let externalPressure = custom("1625") // hypothèse : pression extérieure, dizaines de Pa - nonisolated(unsafe) static let temperature = custom("1626") // centièmes de °C + nonisolated(unsafe) static let pump = custom("1624") // write: 01 start, 00 stop + nonisolated(unsafe) static let externalPressure = custom("1625") // assumption: external pressure, tens of Pa + nonisolated(unsafe) static let temperature = custom("1626") // hundredths of °C nonisolated(unsafe) static let internalPressure = custom("1627") // Pa - nonisolated(unsafe) static let alarm = custom("1628") // inconnu, 00 au repos - nonisolated(unsafe) static let pumpState = custom("1629") // 01 en marche, 02 arrêtée + nonisolated(unsafe) static let alarm = custom("1628") // unknown, 00 at rest + nonisolated(unsafe) static let pumpState = custom("1629") // 01 running, 02 stopped nonisolated(unsafe) static let batteryService = CBUUID(string: "180F") nonisolated(unsafe) static let batteryLevel = CBUUID(string: "2A19") nonisolated(unsafe) static let deviceInfoService = CBUUID(string: "180A") - nonisolated(unsafe) static let deviceInfoStrings: [CBUUID: String] = [ - CBUUID(string: "2A29"): "Fabricant", - CBUUID(string: "2A24"): "Modèle", - CBUUID(string: "2A25"): "N° de série", - CBUUID(string: "2A27"): "Matériel", - CBUUID(string: "2A26"): "Micrologiciel", - CBUUID(string: "2A28"): "Logiciel", + nonisolated(unsafe) static let deviceInfoStrings: [CBUUID: DeviceInfoField] = [ + CBUUID(string: "2A29"): .manufacturer, + CBUUID(string: "2A24"): .model, + CBUUID(string: "2A25"): .serialNumber, + CBUUID(string: "2A27"): .hardware, + CBUUID(string: "2A26"): .firmware, + CBUUID(string: "2A28"): .software, ] - /// Services lus par l'app. Le service de mise à jour (FE59, DFU) n'en fait volontairement pas partie. + /// Services read by the app. The update service (FE59, DFU) is deliberately not one of them. nonisolated(unsafe) static let services = [buttonService, housingService, batteryService, deviceInfoService] - /// Nom annoncé par le boîtier. + /// Name advertised by the housing. static let advertisedName = "HUISH" } +/// Strings of the Device Information service. +enum DeviceInfoField: Sendable, CaseIterable { + case manufacturer, model, serialNumber, hardware, firmware, software + + var label: String { + switch self { + case .manufacturer: String(localized: "Manufacturer") + case .model: String(localized: "Model") + case .serialNumber: String(localized: "Serial no.") + case .hardware: String(localized: "Hardware") + case .firmware: String(localized: "Firmware") + case .software: String(localized: "Software") + } + } +} + enum HousingButton: UInt8, Sendable, CaseIterable { case left = 1, shutter = 2, right = 3, up = 4, down = 5 var label: String { switch self { - case .left: "Gauche" - case .shutter: "Déclencheur" - case .right: "Droite" - case .up: "Haut" - case .down: "Bas" + case .left: String(localized: "Left") + case .shutter: String(localized: "Shutter") + case .right: String(localized: "Right") + case .up: String(localized: "Up") + case .down: String(localized: "Down") } } } @@ -60,7 +77,7 @@ struct ButtonEvent: Equatable, Sendable { let button: HousingButton let isLong: Bool - /// Un octet : quartet haut = bouton, quartet bas = 0 (court) ou 1 (long). + /// One byte: high nibble = button, low nibble = 0 (short) or 1 (long). init?(_ data: Data) { guard data.count == 1, let byte = data.first, let button = HousingButton(rawValue: byte >> 4), byte & 0x0F <= 1 else { return nil } @@ -93,7 +110,7 @@ enum LittleEndian { } } -/// Dernières valeurs connues du boîtier. +/// Last known values of the housing. struct HousingReadings: Equatable, Sendable { var internalPressurePa: Double? var externalPressurePa: Double? @@ -103,17 +120,17 @@ struct HousingReadings: Equatable, Sendable { var alarmRaw: UInt8? var lastButton: ButtonEvent? - /// Applique une valeur reçue ; renvoie un libellé pour le journal, ou nil si la caractéristique est inconnue. + /// Applies a received value; returns a label for the log, or nil when the characteristic is unknown. @discardableResult mutating func apply(_ uuid: CBUUID, _ data: Data) -> String? { switch uuid { case HousingUUID.button: - guard let event = ButtonEvent(data) else { return "bouton ? \(data.hex)" } + guard let event = ButtonEvent(data) else { return String(localized: "button? \(data.hex)") } lastButton = event - return "bouton \(event.button.label)\(event.isLong ? " (long)" : "")" + return String(localized: "button \(event.button.label)") + (event.isLong ? " (long)" : "") case HousingUUID.internalPressure: internalPressurePa = LittleEndian.uint32(data).map(Double.init) - return nil // trop fréquent pour le journal + return nil // too frequent for the log case HousingUUID.externalPressure: externalPressurePa = LittleEndian.uint32(data).map { Double($0) * 10 } return nil @@ -122,15 +139,15 @@ struct HousingReadings: Equatable, Sendable { return nil case HousingUUID.batteryLevel: batteryPercent = data.first.map(Int.init) - return "batterie \(batteryPercent.map(String.init) ?? "?") %" + return String(localized: "battery \(batteryPercent.map(String.init) ?? "?") %") case HousingUUID.pumpState: pumpState = PumpState(data) - return "état de la pompe \(data.hex)" + return String(localized: "pump state \(data.hex)") case HousingUUID.alarm: alarmRaw = data.first - return "1628 (alarme ?) \(data.hex)" + return String(localized: "1628 (alarm?) \(data.hex)") case HousingUUID.pump: - return "pompe (lecture) \(data.hex)" + return String(localized: "pump (read) \(data.hex)") default: return nil } diff --git a/OpenMerou/Housing/VacuumSequence.swift b/OpenMerou/Housing/VacuumSequence.swift @@ -1,7 +1,8 @@ -// Séquence guidée de mise sous vide, de test d'étanchéité, de surveillance et d'ouverture. -// Logique pure (sans Bluetooth ni horloge cachée) pour être testée : elle reçoit les boutons et -// les mesures, et renvoie les ordres à exécuter. Règle de sécurité : la pompe ne démarre qu'après -// la confirmation « bouchon ouvert ». +// SPDX-License-Identifier: GPL-2.0-only +// Guided sequence: vacuum, leak test, monitoring and opening. +// Pure logic (no Bluetooth, no hidden clock) so that it can be tested: it receives the buttons and +// the readings, and returns the orders to carry out. Safety rule: the pump only starts after +// the "plug open" confirmation. import Foundation struct VacuumSequence: Equatable, Sendable { @@ -18,44 +19,44 @@ struct VacuumSequence: Equatable, Sendable { } enum Step: Equatable, Sendable { - case prepare // iPhone en place, boîtier fermé et verrouillé - case openPlug // ouvrir le bouchon (avant la pompe) + case prepare // iPhone in place, housing closed and locked + case openPlug // open the plug (before the pump) case pumping(since: Date) case closePlug - case testing(Baseline) // test d'étanchéité, caméra utilisable - case sealed(Baseline) // test réussi, surveillance continue + case testing(Baseline) // leak test, camera usable + case sealed(Baseline) // test passed, continuous monitoring case failed(Failure) - case opening(fromPa: Double) // ouvrir le bouchon pour remettre à l'air - case opened // à l'air : on peut ouvrir, puis éteindre - case bypassed // essai à sec, sans mise sous vide (choisi à l'écran tactile) + case opening(fromPa: Double) // open the plug to let the air back in + case opened // vented: the housing can be opened, then turned off + case bypassed // dry run, without vacuum (chosen on the touch screen) } enum Effect: Equatable, Sendable { case startPump, stopPump, disconnect } - /// Arrêt de la pompe : premier échantillon sous 80 kPa (observé avec l'app officielle). + /// Pump stop: first sample below 80 kPa (observed with the official app). static let vacuumTargetPa = 80_000.0 - /// Sous ce seuil à l'arrivée, le boîtier est déjà sous vide : on passe directement au test. + /// Below this threshold at the start, the housing is already under vacuum: go straight to the test. static let alreadyUnderVacuumPa = 85_000.0 static let pumpMaxSeconds = 15.0 static let testSeconds = 180.0 - /// Seuils provisoires (une seule mesure de référence : ~30 Pa/min corrigés), à caler par des essais. + /// Provisional thresholds (a single reference measurement: ~30 Pa/min corrected), to be tuned by trials. static let testMaxRisePa = 500.0 static let monitorMaxRisePa = 2_000.0 - /// Remise à l'air détectée : +10 kPa depuis le début de l'ouverture, ou plus de 95 kPa. + /// Venting detected: +10 kPa since the opening started, or more than 95 kPa. static let openedRisePa = 10_000.0 static let openedAbsolutePa = 95_000.0 private(set) var step: Step = .prepare - /// Durée du test d'étanchéité ; raccourcie seulement pour le boîtier simulé. + /// Duration of the leak test; shortened only for the simulated housing. var testDuration = VacuumSequence.testSeconds private(set) var pressurePa: Double? - /// Boîtier injoignable pendant le test ou la plongée : l'état est gardé, la surveillance reprend au retour. + /// Housing unreachable during the test or the dive: the state is kept, monitoring resumes when it comes back. private(set) var linkLost = false private(set) var temperatureC: Double? - /// Pression ramenée à la température du début du test (loi des gaz), moins la pression de départ. + /// Pressure brought back to the temperature at the start of the test (gas law), minus the starting pressure. func correctedRise(since baseline: Baseline) -> Double? { guard let pressurePa else { return nil } var expected = baseline.pressurePa @@ -70,7 +71,7 @@ struct VacuumSequence: Equatable, Sendable { return max(0, testDuration - now.timeIntervalSince(baseline.date)) } - /// Vrai quand les boutons vont à la caméra (sauf l'appui long à droite, gardé pour l'ouverture). + /// True when the buttons go to the camera (except the long press right, kept for opening). var cameraHasButtons: Bool { switch step { case .testing, .sealed, .bypassed: true @@ -78,7 +79,7 @@ struct VacuumSequence: Equatable, Sendable { } } - /// Essai à sec : seulement depuis le début de la séquence, pompe arrêtée. + /// Dry run: only from the start of the sequence, pump stopped. mutating func bypass() { if step == .prepare { step = .bypassed } } @@ -97,7 +98,7 @@ struct VacuumSequence: Equatable, Sendable { step = .openPlug } case (.openPlug, .right, false): - guard pressurePa != nil else { return [] } // pas de pompe sans capteur de pression + guard pressurePa != nil else { return [] } // no pump without a pressure sensor step = .pumping(since: now) return [.startPump] case (.openPlug, .left, false): @@ -116,7 +117,7 @@ struct VacuumSequence: Equatable, Sendable { case (.bypassed, .right, true): step = .prepare case (.opening, .right, false): - step = .opened // confirmation manuelle si la détection ne suffit pas + step = .opened // manual confirmation when detection is not enough case (.opening, .left, false): step = .prepare case (.opened, .right, false): diff --git a/OpenMerou/Info.plist b/OpenMerou/Info.plist @@ -10,6 +10,11 @@ <string>$(EXECUTABLE_NAME)</string> <key>CFBundleIdentifier</key> <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> + <key>CFBundleLocalizations</key> + <array> + <string>en</string> + <string>fr</string> + </array> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> <key>CFBundleName</key> @@ -29,13 +34,13 @@ <key>LSRequiresIPhoneOS</key> <true/> <key>NSBluetoothAlwaysUsageDescription</key> - <string>Open Mérou se connecte en Bluetooth au boîtier de plongée pour lire ses boutons, sa pression et commander sa pompe à vide.</string> + <string>Open Mérou connects to the dive housing over Bluetooth to read its buttons and pressure and to control its vacuum pump.</string> <key>NSCameraUsageDescription</key> - <string>Open Mérou utilise l'appareil photo pour prendre des photos et des vidéos sous l'eau.</string> + <string>Open Mérou uses the camera to take photos and videos underwater.</string> <key>NSMicrophoneUsageDescription</key> - <string>Open Mérou utilise le micro pour le son des vidéos.</string> + <string>Open Mérou uses the microphone for the sound of videos.</string> <key>NSPhotoLibraryAddUsageDescription</key> - <string>Open Mérou enregistre vos photos et vidéos dans la photothèque.</string> + <string>Open Mérou saves your photos and videos to the photo library.</string> <key>UIApplicationSceneManifest</key> <dict> <key>UIApplicationSupportsMultipleScenes</key> diff --git a/OpenMerou/InfoPlist.xcstrings b/OpenMerou/InfoPlist.xcstrings @@ -0,0 +1,74 @@ +{ + "sourceLanguage": "en", + "strings": { + "NSBluetoothAlwaysUsageDescription": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Open Mérou connects to the dive housing over Bluetooth to read its buttons and pressure and to control its vacuum pump." + } + }, + "fr": { + "stringUnit": { + "state": "translated", + "value": "Open Mérou se connecte en Bluetooth au boîtier de plongée pour lire ses boutons, sa pression et commander sa pompe à vide." + } + } + } + }, + "NSCameraUsageDescription": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Open Mérou uses the camera to take photos and videos underwater." + } + }, + "fr": { + "stringUnit": { + "state": "translated", + "value": "Open Mérou utilise l'appareil photo pour prendre des photos et des vidéos sous l'eau." + } + } + } + }, + "NSMicrophoneUsageDescription": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Open Mérou uses the microphone for the sound of videos." + } + }, + "fr": { + "stringUnit": { + "state": "translated", + "value": "Open Mérou utilise le micro pour le son des vidéos." + } + } + } + }, + "NSPhotoLibraryAddUsageDescription": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Open Mérou saves your photos and videos to the photo library." + } + }, + "fr": { + "stringUnit": { + "state": "translated", + "value": "Open Mérou enregistre vos photos et vidéos dans la photothèque." + } + } + } + } + }, + "version": "1.0" +} diff --git a/OpenMerou/Localizable.xcstrings b/OpenMerou/Localizable.xcstrings @@ -0,0 +1,2276 @@ +{ + "sourceLanguage": "en", + "strings": { + "%@ s timeout": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "délai de %@ s" + } + } + } + }, + "%@ this session · %@": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "%@ cette session · %@" + } + } + } + }, + "%@ · %@ fps": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "%@ · %@ i/s" + } + } + } + }, + "%lld": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "%lld" + } + } + } + }, + "%lld / %lld": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "%lld / %lld" + } + } + } + }, + "%lld/%lld": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "%lld/%lld" + } + } + } + }, + ".": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "." + } + } + } + }, + "1. Close and lock the housing": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "1. Fermez et verrouillez le boîtier" + } + } + } + }, + "1628 (alarm?)": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "1628 (alarme ?)" + } + } + } + }, + "1628 (alarm?) %@": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "1628 (alarme ?) %@" + } + } + } + }, + "2. Open the plug": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "2. Ouvrez le bouchon" + } + } + } + }, + "3. Pumping…": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "3. Pompage…" + } + } + } + }, + "4. Close the plug": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "4. Fermez le bouchon" + } + } + } + }, + "AE/AF": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "AE/AF" + } + } + } + }, + "AUTO": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "AUTO" + } + } + } + }, + "Airplane mode recommended (keep Bluetooth on)": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Mode avion conseillé (gardez le Bluetooth allumé)" + } + } + } + }, + "Alert": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Alerte" + } + } + } + }, + "Allow camera access in Settings → Open Mérou.": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Autorisez l'appareil photo dans Réglages → Open Mérou." + } + } + } + }, + "Any button: close": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "N'importe quel bouton : fermer" + } + } + } + }, + "Back": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Retour" + } + } + } + }, + "Batteries": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Batteries" + } + } + } + }, + "Battery": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Batterie" + } + } + } + }, + "Bluetooth ready": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Bluetooth prêt" + } + } + } + }, + "Bluetooth unavailable: %@": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Bluetooth indisponible : %@" + } + } + } + }, + "Brightness": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Luminosité" + } + } + } + }, + "CAL.": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "CAL." + } + } + } + }, + "Calibration failed": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Calibrage impossible" + } + } + } + }, + "Check the plug, the O-ring and the latch.": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Vérifiez le bouchon, le joint et le verrou." + } + } + } + }, + "Cinematic": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Cinématique" + } + } + } + }, + "Cinematic extended": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Cinématique étendue" + } + } + } + }, + "Colors": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Couleurs" + } + } + } + }, + "Colors calibrated": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Couleurs calibrées" + } + } + } + }, + "Colors calibrated (red at maximum)": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Couleurs calibrées (rouge au maximum)" + } + } + } + }, + "Colors: manual setting unavailable on this device": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Couleurs : réglage manuel indisponible sur cet appareil" + } + } + } + }, + "Connected": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Connecté" + } + } + } + }, + "Connected to %@": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Connecté à %@" + } + } + } + }, + "Connecting to %@…": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Connexion à %@…" + } + } + } + }, + "Connection failed: %@": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Échec de connexion : %@" + } + } + } + }, + "Corrected rise: %@ Pa": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Remontée corrigée : %@ Pa" + } + } + } + }, + "Development": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Développement" + } + } + } + }, + "Development mode logs": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Journaux du mode développement" + } + } + } + }, + "Device": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Appareil" + } + } + } + }, + "Disabled": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Désactivé" + } + } + } + }, + "Disconnect from the housing": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Se déconnecter du boîtier" + } + } + } + }, + "Disconnected (%@), reconnecting…": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Déconnecté (%@), reconnexion…" + } + } + } + }, + "Disconnected: %@": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Déconnecté : %@" + } + } + } + }, + "Disconnection requested": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Déconnexion demandée" + } + } + } + }, + "Down": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Bas" + } + } + } + }, + "Dry": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "À sec" + } + } + } + }, + "Dry run": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Essai à sec" + } + } + } + }, + "Enabled": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Activé" + } + } + } + }, + "Exposure": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Exposition" + } + } + } + }, + "External pressure (assumed)": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Pression extérieure (hypothèse)" + } + } + } + }, + "Firmware": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Micrologiciel" + } + } + } + }, + "Focus and exposure automatic": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Mise au point et exposition automatiques" + } + } + } + }, + "Focus and exposure locked": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Mise au point et exposition verrouillées" + } + } + } + }, + "HOT": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "CHAUD" + } + } + } + }, + "Hardware": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Matériel" + } + } + } + }, + "Housing": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Boîtier" + } + } + } + }, + "Housing %lld %%": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Boîtier %lld %%" + } + } + } + }, + "Housing battery low: %@ %%": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Batterie du boîtier faible : %@ %%" + } + } + } + }, + "Housing detected": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Boîtier détecté" + } + } + } + }, + "Housing disconnected": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Boîtier déconnecté" + } + } + } + }, + "Housing disconnected: seal not monitored, buttons inactive. Reconnecting…": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Boîtier déconnecté : étanchéité non surveillée, boutons inactifs. Reconnexion…" + } + } + } + }, + "Housing found (%@ dBm)": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Boîtier trouvé (%@ dBm)" + } + } + } + }, + "Housing vented": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Boîtier à l'air" + } + } + } + }, + "Information": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Informations" + } + } + } + }, + "Internal pressure": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Pression intérieure" + } + } + } + }, + "Internal pressure rose by %@ Pa": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "La pression intérieure est remontée de %@ Pa" + } + } + } + }, + "Internal pressure: %@ hPa": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Pression intérieure : %@ hPa" + } + } + } + }, + "Internal temperature": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Température intérieure" + } + } + } + }, + "It is already under vacuum: the leak test will start right away.": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Il est déjà sous vide : le test d'étanchéité va démarrer directement." + } + } + } + }, + "LEAK": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "FUITE" + } + } + } + }, + "Landscape": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Paysage" + } + } + } + }, + "Landscape flipped": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Paysage inversé" + } + } + } + }, + "Last button": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Dernier bouton" + } + } + } + }, + "Leak test": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Test d'étanchéité" + } + } + } + }, + "Leak: do not dive": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Fuite : ne plongez pas" + } + } + } + }, + "Leave the simulation": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Quitter la simulation" + } + } + } + }, + "Left": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Gauche" + } + } + } + }, + "Left button: stop": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Bouton gauche : arrêter" + } + } + } + }, + "Log": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Journal" + } + } + } + }, + "Long press right: back to the vacuum sequence": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Appui long à droite : revenir à la mise sous vide" + } + } + } + }, + "Long press right: open the housing": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Appui long à droite : ouvrir le boîtier" + } + } + } + }, + "Looking for the housing…": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Recherche du boîtier…" + } + } + } + }, + "Low free space: about %@ min of video in %@": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Peu d'espace libre : environ %@ min de vidéo en %@" + } + } + } + }, + "Manufacturer": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Fabricant" + } + } + } + }, + "Model": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Modèle" + } + } + } + }, + "Never": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Jamais" + } + } + } + }, + "No camera": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Aucun appareil photo" + } + } + } + }, + "No shots yet": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Aucune prise pour l'instant" + } + } + } + }, + "No vacuum: do not put the housing in the water.": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Pas de mise sous vide : ne mettez pas le boîtier à l'eau." + } + } + } + }, + "Not checked": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Non vérifié" + } + } + } + }, + "Off": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Désactivée" + } + } + } + }, + "Once disconnected, hold the right button of the housing for 2 seconds to turn it off.": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Une fois déconnecté, maintenez le bouton droit du boîtier 2 secondes pour l'éteindre." + } + } + } + }, + "Open Mérou": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Open Mérou" + } + } + } + }, + "Open the plug": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Ouvrez le bouchon" + } + } + } + }, + "Orientation": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Orientation" + } + } + } + }, + "P int %@ Pa rise %@ Pa": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "P int %@ Pa remontée %@ Pa" + } + } + } + }, + "PHOTO": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "PHOTO" + } + } + } + }, + "Permission denied: %@. Settings → Open Mérou.": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Autorisation refusée : %@. Réglages → Open Mérou." + } + } + } + }, + "Photo": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Photo" + } + } + } + }, + "Photo format": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Format photo" + } + } + } + }, + "Photo: %@": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Photo : %@" + } + } + } + }, + "Photos: %@": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Photos : %@" + } + } + } + }, + "Photos: %@ shot(s) saved": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Photos : %@ prise(s) enregistrée(s)" + } + } + } + }, + "Portrait": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Portrait" + } + } + } + }, + "Press the right button of the housing to continue": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Appuyez sur le bouton droit du boîtier pour continuer" + } + } + } + }, + "Pressure is monitored throughout the dive.": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "La pression reste surveillée pendant toute la plongée." + } + } + } + }, + "Pressure rose by %@ Pa. Get out of the water and check the O-ring.": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "La pression est remontée de %@ Pa. Sortez de l'eau et vérifiez le joint." + } + } + } + }, + "Pressure will return to normal.": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "La pression va revenir à la normale." + } + } + } + }, + "Pump": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Pompe" + } + } + } + }, + "Pump: start requested": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Pompe : marche demandée" + } + } + } + }, + "Pump: stop requested (%@)": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Pompe : arrêt demandé (%@)" + } + } + } + }, + "Pump: vacuum already reached (%@ Pa)": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Pompe : vide déjà atteint (%@ Pa)" + } + } + } + }, + "Put the iPhone in place (airplane mode recommended, Bluetooth on), close the housing and lock the latch.": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Placez l'iPhone (mode avion conseillé, Bluetooth allumé), fermez le boîtier et verrouillez le verrou." + } + } + } + }, + "RAW": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "RAW" + } + } + } + }, + "RED MAX": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "ROUGE MAX" + } + } + } + }, + "Reconnect": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Se reconnecter" + } + } + } + }, + "Right": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Droite" + } + } + } + }, + "Right button: continue": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Bouton droit : continuer" + } + } + } + }, + "Right button: disconnect, then hold it for 2 s to turn the housing off": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Bouton droit : se déconnecter, puis maintenez-le 2 s pour éteindre le boîtier" + } + } + } + }, + "Right button: done · left: cancel": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Bouton droit : c'est fait · gauche : annuler" + } + } + } + }, + "Right button: resume monitoring · long press right: open the housing": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Bouton droit : reprendre la surveillance · appui long à droite : ouvrir le boîtier" + } + } + } + }, + "Right button: start over · long press right: open the housing": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Bouton droit : recommencer · appui long à droite : ouvrir le boîtier" + } + } + } + }, + "Right button: start the pump · left: back": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Bouton droit : démarrer la pompe · gauche : retour" + } + } + } + }, + "Right button: start the test · left: back": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Bouton droit : lancer le test · gauche : retour" + } + } + } + }, + "R×%@ G×%@ B×%@": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "R×%@ V×%@ B×%@" + } + } + } + }, + "Screen sleep": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Veille de l'écran" + } + } + } + }, + "Sealed": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Étanche" + } + } + } + }, + "Sealed, have a good dive": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Étanche, bonne plongée" + } + } + } + }, + "Sequence: %@": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Séquence : %@" + } + } + } + }, + "Serial no.": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "N° de série" + } + } + } + }, + "Settings": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Réglages" + } + } + } + }, + "Shots": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Prises" + } + } + } + }, + "Shutter": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Déclencheur" + } + } + } + }, + "Simulate a housing": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Simuler un boîtier" + } + } + } + }, + "Simulated housing": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Boîtier simulé" + } + } + } + }, + "Simulation": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Simulation" + } + } + } + }, + "Simulation started": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Simulation démarrée" + } + } + } + }, + "Simulation stopped": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Simulation arrêtée" + } + } + } + }, + "Simulation · long press available": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Simulation · appui long possible" + } + } + } + }, + "Sleep": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Veille" + } + } + } + }, + "Software": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Logiciel" + } + } + } + }, + "Standard": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Standard" + } + } + } + }, + "Stop the pump": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Arrêter la pompe" + } + } + } + }, + "Surface and take the housing out of the water": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Remontez et sortez le boîtier de l'eau" + } + } + } + }, + "Testing": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Test en cours" + } + } + } + }, + "The housing is already under vacuum: the leak test will start right away.": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Le boîtier est déjà sous vide : le test d'étanchéité va démarrer directement." + } + } + } + }, + "The plug must be open before the pump starts.": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Le bouchon doit être ouvert avant de démarrer la pompe." + } + } + } + }, + "The pump stops by itself below 800 hPa.": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "La pompe s'arrête toute seule sous 800 hPa." + } + } + } + }, + "The seal is not verified yet.": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "L'étanchéité n'est pas encore vérifiée." + } + } + } + }, + "Turn the housing on: it will be detected automatically.": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Allumez le boîtier : il sera détecté tout seul." + } + } + } + }, + "Underwater, automatic": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Sous l'eau, automatique" + } + } + } + }, + "Underwater, calibrated": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Sous l'eau, calibrées" + } + } + } + }, + "Up": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Haut" + } + } + } + }, + "Up, down: browse · left: close": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Haut, bas : parcourir · gauche : fermer" + } + } + } + }, + "Up, down: choose · right: confirm · left: back": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Haut, bas : choisir · droite : valider · gauche : retour" + } + } + } + }, + "Use a housing · Bluetooth %@": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Utiliser un boîtier · Bluetooth %@" + } + } + } + }, + "Use a housing · searching": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Utiliser un boîtier · recherche" + } + } + } + }, + "VIDEO": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "VIDÉO" + } + } + } + }, + "Vacuum": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Mise sous vide" + } + } + } + }, + "Vacuum not reached": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Vide non atteint" + } + } + } + }, + "Vacuum reached. Close the plug, then confirm.": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Vide atteint. Refermez le bouchon, puis confirmez." + } + } + } + }, + "Video": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Vidéo" + } + } + } + }, + "Video quality": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Qualité vidéo" + } + } + } + }, + "Video stabilization": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Stabilisation vidéo" + } + } + } + }, + "Video: %@": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Vidéo : %@" + } + } + } + }, + "Without the housing, the seal is no longer monitored.": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Sans le boîtier, l'étanchéité n'est plus surveillée." + } + } + } + }, + "Write refused: %@": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Écriture refusée : %@" + } + } + } + }, + "You can open the housing. Remember to turn airplane mode off.": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Vous pouvez ouvrir le boîtier. Pensez à désactiver le mode avion." + } + } + } + }, + "access denied in Settings": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "accès refusé dans Réglages" + } + } + } + }, + "app in the background": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "app en arrière-plan" + } + } + } + }, + "battery %@ %%": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "batterie %@ %%" + } + } + } + }, + "button": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "bouton" + } + } + } + }, + "button %@": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "bouton %@" + } + } + } + }, + "button? %@": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "bouton ? %@" + } + } + } + }, + "calibration %@": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "calibrage %@" + } + } + } + }, + "camera: %@": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "caméra : %@" + } + } + } + }, + "colors %@": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "couleurs %@" + } + } + } + }, + "colors: red at maximum": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "couleurs : rouge au maximum" + } + } + } + }, + "colors: within limits": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "couleurs : dans les limites" + } + } + } + }, + "connection closed": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "fin de connexion" + } + } + } + }, + "disconnection": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "déconnexion" + } + } + } + }, + "dive end (estimated)": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "fin de plongée (estimée)" + } + } + } + }, + "dive start (estimated)": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "début de plongée (estimé)" + } + } + } + }, + "failed": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "échec" + } + } + } + }, + "found running": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "trouvée en marche" + } + } + } + }, + "gray world %@ ceiling ×%@": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "gris moyen %@ plafond ×%@" + } + } + } + }, + "gray world %@ ceiling %@": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "gris moyen %@ plafond %@" + } + } + } + }, + "housing %@ · iPhone %@": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "boîtier %@ · iPhone %@" + } + } + } + }, + "iPhone %lld %%": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "iPhone %lld %%" + } + } + } + }, + "iPhone (no correction)": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "iPhone (sans correction)" + } + } + } + }, + "iPhone battery low: %@ %%": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Batterie de l'iPhone faible : %@ %%" + } + } + } + }, + "iPhone in place (airplane mode recommended, Bluetooth on), housing closed, latch locked.": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "iPhone en place (mode avion conseillé, Bluetooth allumé), boîtier fermé, verrou verrouillé." + } + } + } + }, + "iPhone is hot": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "iPhone chaud" + } + } + } + }, + "iPhone is hot: video reduced to %@": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "iPhone chaud : vidéo réduite à %@" + } + } + } + }, + "iPhone setting": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Celle de l'iPhone" + } + } + } + }, + "iPhone thermal state %@": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "thermique iPhone %@" + } + } + } + }, + "lens %@": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "objectif %@" + } + } + } + }, + "log %@": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "journal %@" + } + } + } + }, + "log closed": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "journal fermé" + } + } + } + }, + "log opened": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "journal ouvert" + } + } + } + }, + "microphone (videos without sound)": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "micro (vidéos sans son)" + } + } + } + }, + "not supported": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "non pris en charge" + } + } + } + }, + "photo library (nothing will be saved)": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "photothèque (rien ne sera enregistré)" + } + } + } + }, + "photo library access denied (shots stay in Files → Open Mérou)": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "accès à la photothèque refusé (les prises restent dans Fichiers → Open Mérou)" + } + } + } + }, + "photo requested": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "photo demandée" + } + } + } + }, + "powered off": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "éteint" + } + } + } + }, + "pump %@ 1628 %@ batt %@ %%": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "pompe %@ 1628 %@ batt %@ %%" + } + } + } + }, + "pump (read) %@": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "pompe (lecture) %@" + } + } + } + }, + "pump state %@": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "état de la pompe %@" + } + } + } + }, + "running": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "en marche" + } + } + } + }, + "sequence": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "séquence" + } + } + } + }, + "settings: %@": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "réglages : %@" + } + } + } + }, + "shot written to disk": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "prise écrite sur disque" + } + } + } + }, + "simulated housing": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "boîtier simulé" + } + } + } + }, + "starting": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "démarrage" + } + } + } + }, + "step %@ iPhone thermal %@": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "étape %@ iPhone thermique %@" + } + } + } + }, + "stopped": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "arrêtée" + } + } + } + }, + "transfer failed": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "échec du transfert" + } + } + } + }, + "unknown (%@)": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "inconnu (%@)" + } + } + } + }, + "vacuum reached, %@ Pa": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "vide atteint, %@ Pa" + } + } + } + }, + "video: start": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "vidéo : début" + } + } + } + }, + "video: stop": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "vidéo : arrêt" + } + } + } + }, + "waiting": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "en attente" + } + } + } + }, + "≈ %@ min of video left": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "≈ %@ min de vidéo libres" + } + } + } + } + }, + "version": "1.0" +} diff --git a/OpenMerou/UI/CameraScreen.swift b/OpenMerou/UI/CameraScreen.swift @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0-only import AVFoundation import SwiftUI @@ -23,8 +24,8 @@ struct PreviewView: UIViewRepresentable { func updateUIView(_ view: Host, context: Context) {} } -/// Écran principal : l'image en plein écran, les informations autour, et par-dessus la séquence -/// de mise sous vide tant qu'elle garde les boutons. +/// Main screen: the image full screen, the information around it, and on top the vacuum +/// sequence as long as it keeps the buttons. struct CameraScreen: View { let model: AppModel @Environment(\.scenePhase) private var scenePhase @@ -38,7 +39,7 @@ struct CameraScreen: View { Color.black.ignoresSafeArea() PreviewView(layer: model.engine.previewLayer).ignoresSafeArea() - // Clignotement d'obturateur : l'image s'éteint un instant à chaque photo. + // Shutter blink: the image goes dark for an instant at each photo. Color.black.ignoresSafeArea().opacity(flashing ? 1 : 0).allowsHitTesting(false) VStack { @@ -54,7 +55,7 @@ struct CameraScreen: View { Group { if !model.camera.authorized { - card { Text("Autorisez l'appareil photo dans Réglages → Open Mérou.") } + card { Text("Allow camera access in Settings → Open Mérou.") } } else if housing.vacuum.step == .prepare, !housing.simulated { card { HomeView(model: model) } } else if !housing.vacuum.cameraHasButtons { @@ -70,13 +71,13 @@ struct CameraScreen: View { MenuView(model: model) } } - // En simulation, les panneaux se rangent à gauche pour laisser les boutons simulés visibles. + // In simulation, the panels move to the left to keep the simulated buttons visible. .frame(maxWidth: .infinity, alignment: housing.simulated ? .leading : .center) .padding(.leading, housing.simulated ? 40 : 0) if housing.vacuum.linkLost { VStack { - Label("Boîtier déconnecté : étanchéité non surveillée, boutons inactifs. Reconnexion…", systemImage: "antenna.radiowaves.left.and.right.slash") + Label("Housing disconnected: seal not monitored, buttons inactive. Reconnecting…", systemImage: "antenna.radiowaves.left.and.right.slash") .font(.subheadline.weight(.semibold)).foregroundStyle(.black) .padding(10).background(.orange, in: RoundedRectangle(cornerRadius: 12)) Spacer() @@ -106,7 +107,7 @@ struct CameraScreen: View { .onChange(of: scenePhase) { _, phase in if phase != .active { model.background() - if housing.pumpRequested { housing.stopPump(reason: "app en arrière-plan") } + if housing.pumpRequested { housing.stopPump(reason: String(localized: "app in the background")) } } } } @@ -124,9 +125,9 @@ struct CameraScreen: View { sealChip if let p = housing.readings.internalPressurePa { Text(String(format: "%.0f hPa", p / 100)) } if let t = housing.readings.temperatureC { Text(String(format: "%.0f °C", t)) } - if let b = housing.readings.batteryPercent { Text("Boîtier \(b) %").foregroundStyle(b <= 20 ? .orange : .white) } + if let b = housing.readings.batteryPercent { Text("Housing \(b) %").foregroundStyle(b <= 20 ? .orange : .white) } if let b = model.phoneBattery { Text("iPhone \(b) %").foregroundStyle(b <= 20 ? .orange : .white) } - if model.hot { Label("CHAUD", systemImage: "thermometer.high").foregroundStyle(.orange) } + if model.hot { Label("HOT", systemImage: "thermometer.high").foregroundStyle(.orange) } if let depth = model.depth, depth > 0.3 { Text(String(format: "≈ %.1f m", depth)) if let start = model.diveStart { Text(start, style: .timer) } @@ -146,7 +147,7 @@ struct CameraScreen: View { .shadow(radius: 3) } - /// Mode développement : valeurs brutes, pour les essais dans l'eau. + /// Development mode: raw values, for in-water trials. private var devOverlay: some View { let r = housing.readings, v = housing.vacuum let rise: Double? = switch v.step { @@ -154,14 +155,18 @@ struct CameraScreen: View { default: nil } func n(_ value: Double?, _ format: String) -> String { value.map { String(format: format, $0) } ?? "—" } + let pump = r.pumpState.map { "\($0)" } ?? "—", alarm = r.alarmRaw.map { String(format: "%02X", $0) } ?? "—" + let battery = r.batteryPercent.map(String.init) ?? "—" + let step = String(String(describing: v.step).prefix { $0 != "(" }) + let thermal = String(ProcessInfo.processInfo.thermalState.rawValue) let lines = [ - "P int \(n(r.internalPressurePa, "%.0f")) Pa remontée \(n(rise, "%+.0f")) Pa", + String(localized: "P int \(n(r.internalPressurePa, "%.0f")) Pa rise \(n(rise, "%+.0f")) Pa"), "P ext? \(n(r.externalPressurePa, "%.0f")) Pa T \(n(r.temperatureC, "%.2f")) °C", - "pompe \(r.pumpState.map { "\($0)" } ?? "—") 1628 \(r.alarmRaw.map { String(format: "%02X", $0) } ?? "—") batt \(r.batteryPercent.map(String.init) ?? "—") %", - "étape \(String(describing: v.step).prefix { $0 != "(" }) iPhone thermique \(ProcessInfo.processInfo.thermalState.rawValue)", - "couleurs \(model.camera.gains?.label ?? "iPhone")\(model.camera.gainsSaturated ? " MAX" : "")", - "gris moyen \(model.camera.grayWorld?.label ?? "—") plafond ×\(n(model.camera.maxGain, "%.2f"))", - "journal \(DevLog.shared.url?.lastPathComponent ?? "—")", + String(localized: "pump \(pump) 1628 \(alarm) batt \(battery) %"), + String(localized: "step \(step) iPhone thermal \(thermal)"), + String(localized: "colors \(model.camera.gains?.label ?? "iPhone")") + (model.camera.gainsSaturated ? " MAX" : ""), + String(localized: "gray world \(model.camera.grayWorld?.label ?? "—") ceiling ×\(n(model.camera.maxGain, "%.2f"))"), + String(localized: "log \(DevLog.shared.url?.lastPathComponent ?? "—")"), ] return HStack { VStack(alignment: .leading, spacing: 2) { @@ -176,11 +181,11 @@ struct CameraScreen: View { private var sealChip: some View { let (text, color): (String, Color) = switch housing.vacuum.step { - case .sealed: ("Étanche", .green) - case .testing: ("Test en cours", .orange) - case .bypassed: (housing.simulated ? "Simulation" : "À sec", .yellow) - case .failed: ("Alerte", .red) - default: ("Non vérifié", .gray) + case .sealed: (String(localized: "Sealed"), .green) + case .testing: (String(localized: "Testing"), .orange) + case .bypassed: (housing.simulated ? String(localized: "Simulation") : String(localized: "Dry"), .yellow) + case .failed: (String(localized: "Alert"), .red) + default: (String(localized: "Not checked"), .gray) } return HStack(spacing: 6) { Text(text) @@ -198,7 +203,7 @@ struct CameraScreen: View { private var bottomBar: some View { HStack { - Text(model.settings.mode == .photo ? "PHOTO" : "VIDÉO") + Text(model.settings.mode == .photo ? String(localized: "PHOTO") : String(localized: "VIDEO")) if model.settings.mode == .video { Text(model.settings.videoQuality.label) } if model.settings.mode == .photo, model.settings.photoFormat == .rawHeif { Text("RAW") } switch model.settings.colorMode { @@ -207,7 +212,7 @@ struct CameraScreen: View { case .calibrated: Label("CAL.", systemImage: "drop.fill") } if model.camera.focusLocked { Label("AE/AF", systemImage: "lock.fill").foregroundStyle(.yellow) } - if model.camera.gainsSaturated { Label("ROUGE MAX", systemImage: "exclamationmark.triangle.fill").foregroundStyle(.orange) } + if model.camera.gainsSaturated { Label("RED MAX", systemImage: "exclamationmark.triangle.fill").foregroundStyle(.orange) } if model.settings.exposureBias != 0 { Text(String(format: "%+.1f EV", model.settings.exposureBias)) } Label("\(model.roll.count)", systemImage: "photo.on.rectangle") .contentTransition(.numericText()) @@ -231,7 +236,7 @@ struct MenuView: View { var body: some View { let (title, rows, selected) = content - // En paysage, l'écran est bas : on montre une fenêtre de lignes qui suit la sélection. + // In landscape the screen is short: show a window of rows that follows the selection. let visible = 5 let first = max(0, min(selected - visible / 2, rows.count - visible)) let shown = Array(rows.indices).filter { $0 >= first && $0 < first + visible } @@ -254,7 +259,7 @@ struct MenuView: View { .foregroundStyle(i == selected ? .black : .white) } if first + visible < rows.count { Image(systemName: "chevron.compact.down").frame(maxWidth: .infinity).foregroundStyle(.secondary) } - Text("Haut, bas : choisir · droite : valider · gauche : retour") + Text("Up, down: choose · right: confirm · left: back") .font(.caption2).foregroundStyle(.secondary).padding(.top, 4) } .padding(.horizontal, 16).padding(.vertical, 12) @@ -279,7 +284,7 @@ struct MenuView: View { return (item.title, mark) }, i) case .settings(let i): - return ("Réglages", CameraSetting.listed.map { ($0.title, settings.current($0).label) }, i) + return (CameraMenu.RootItem.settings.title, CameraSetting.listed.map { ($0.title, settings.current($0).label) }, i) case .options(let setting, let i): let current = settings.current(setting) return (setting.title, settings.options(for: setting, caps).map { ($0.label, $0 == current ? "●" : nil) }, i) @@ -287,7 +292,7 @@ struct MenuView: View { } } -/// Boutons du boîtier simulé : même disposition que le vrai (croix à l'arrière, déclencheur en haut). +/// Buttons of the simulated housing: same layout as the real one (cross at the back, shutter on top). struct SimulatedButtons: View { let housing: HousingClient @@ -304,8 +309,8 @@ struct SimulatedButtons: View { key("chevron.down", .down) key("chevron.right", .right) } - Text("Simulation · appui long possible").font(.caption2) - Button("Quitter la simulation") { housing.stopSimulation() } + Text("Simulation · long press available").font(.caption2) + Button("Leave the simulation") { housing.stopSimulation() } .font(.caption).padding(6).background(.black.opacity(0.6), in: Capsule()) } } @@ -325,36 +330,38 @@ struct SimulatedButtons: View { } } -/// Informations du boîtier, ouvertes par le menu (le bouton ⓘ n'est pas atteignable sous l'eau). +/// Housing information, opened from the menu (the ⓘ button cannot be reached underwater). struct InfoPanel: View { let model: AppModel private var rows: [(String, String)] { let housing = model.housing, r = housing.readings func n(_ value: Double?, _ format: String) -> String { value.map { String(format: format, $0) } ?? "—" } + let housingBattery = r.batteryPercent.map { "\($0) %" } ?? "—", phoneBattery = model.phoneBattery.map { "\($0) %" } ?? "—" + let videoLeft = model.videoMinutesLeft.map { String(localized: "≈ \(String($0)) min of video left") } ?? "—" return [ - ("Boîtier", housing.status.label), - ("Pression intérieure", n(r.internalPressurePa.map { $0 / 100 }, "%.1f hPa")), - ("Pression extérieure (hypothèse)", n(r.externalPressurePa.map { $0 / 100 }, "%.1f hPa")), - ("Température intérieure", n(r.temperatureC, "%.1f °C")), - ("Batteries", "boîtier \(r.batteryPercent.map { "\($0) %" } ?? "—") · iPhone \(model.phoneBattery.map { "\($0) %" } ?? "—")"), - ("Couleurs", model.camera.gains?.label ?? "iPhone"), - ("Prises", "\(model.roll.count) cette session · \(model.videoMinutesLeft.map { "≈ \($0) min de vidéo libres" } ?? "—")"), - ("Micrologiciel", housing.deviceInfo["Micrologiciel"] ?? "—"), + (String(localized: "Housing"), housing.status.label), + (String(localized: "Internal pressure"), n(r.internalPressurePa.map { $0 / 100 }, "%.1f hPa")), + (String(localized: "External pressure (assumed)"), n(r.externalPressurePa.map { $0 / 100 }, "%.1f hPa")), + (String(localized: "Internal temperature"), n(r.temperatureC, "%.1f °C")), + (String(localized: "Batteries"), String(localized: "housing \(housingBattery) · iPhone \(phoneBattery)")), + (CameraSetting.color.title, model.camera.gains?.label ?? "iPhone"), + (String(localized: "Shots"), String(localized: "\(String(model.roll.count)) this session · \(videoLeft)")), + (DeviceInfoField.firmware.label, housing.deviceInfo[.firmware] ?? "—"), ] } var body: some View { let housing = model.housing VStack(alignment: .leading, spacing: 3) { - Text("Informations").font(.headline).padding(.bottom, 2) + Text("Information").font(.headline).padding(.bottom, 2) ForEach(rows, id: \.0) { row in HStack { Text(row.0).foregroundStyle(.secondary); Spacer(); Text(row.1).monospacedDigit() } } ForEach(housing.log.prefix(3)) { line in Text(line.text).font(.caption2).foregroundStyle(.secondary).lineLimit(1) } - Text("N'importe quel bouton : fermer").font(.caption2).foregroundStyle(.secondary).padding(.top, 2) + Text("Any button: close").font(.caption2).foregroundStyle(.secondary).padding(.top, 2) } .font(.footnote) .padding(.horizontal, 16).padding(.vertical, 12) @@ -364,19 +371,19 @@ struct InfoPanel: View { } } -/// Accueil : simuler un boîtier, ou utiliser le vrai dès qu'il est détecté. +/// Home: simulate a housing, or use the real one as soon as it is detected. struct HomeView: View { let model: AppModel - /// Ce qui mérite d'être corrigé avant de fermer le boîtier. + /// What is worth fixing before closing the housing. private var checks: [String] { var lines: [String] = [] - if let b = model.housing.readings.batteryPercent, b < 30 { lines.append("Batterie du boîtier faible : \(b) %") } - if let b = model.phoneBattery, b < 30 { lines.append("Batterie de l'iPhone faible : \(b) %") } + if let b = model.housing.readings.batteryPercent, b < 30 { lines.append(String(localized: "Housing battery low: \(String(b)) %")) } + if let b = model.phoneBattery, b < 30 { lines.append(String(localized: "iPhone battery low: \(String(b)) %")) } if let minutes = model.videoMinutesLeft, minutes < 20 { - lines.append("Peu d'espace libre : environ \(minutes) min de vidéo en \(model.settings.videoQuality.label)") + lines.append(String(localized: "Low free space: about \(String(minutes)) min of video in \(model.settings.videoQuality.label)")) } - if model.online { lines.append("Mode avion conseillé (gardez le Bluetooth allumé)") } + if model.online { lines.append(String(localized: "Airplane mode recommended (keep Bluetooth on)")) } return lines } @@ -386,7 +393,7 @@ struct HomeView: View { Text("Open Mérou").font(.title2.bold()) Button { housing.startSimulation() } label: { - Label("Simuler un boîtier", systemImage: "play.rectangle.fill").frame(maxWidth: .infinity) + Label("Simulate a housing", systemImage: "play.rectangle.fill").frame(maxWidth: .infinity) } .buttonStyle(.borderedProminent) .tint(.yellow) @@ -395,30 +402,30 @@ struct HomeView: View { if housing.isConnected { VStack(alignment: .leading, spacing: 6) { - Label("Boîtier détecté", systemImage: "checkmark.circle.fill").font(.headline).foregroundStyle(.green) + Label("Housing detected", systemImage: "checkmark.circle.fill").font(.headline).foregroundStyle(.green) if let p = housing.vacuum.pressurePa, p < VacuumSequence.alreadyUnderVacuumPa { - Text("Il est déjà sous vide : le test d'étanchéité va démarrer directement.") + Text("It is already under vacuum: the leak test will start right away.") } else { - Text("Placez l'iPhone (mode avion conseillé, Bluetooth allumé), fermez le boîtier et verrouillez le verrou.") + Text("Put the iPhone in place (airplane mode recommended, Bluetooth on), close the housing and lock the latch.") } ForEach(checks, id: \.self) { line in Label(line, systemImage: "exclamationmark.triangle.fill").font(.footnote).foregroundStyle(.orange) } - Text("Appuyez sur le bouton droit du boîtier pour continuer").font(.headline) + Text("Press the right button of the housing to continue").font(.headline) } } else { - // Pas un vrai bouton : il se « valide » tout seul quand le boîtier répond. + // Not a real button: it "confirms" by itself when the housing answers. Button {} label: { HStack { Image(systemName: "dot.radiowaves.left.and.right") if case .bluetoothUnavailable(let why) = housing.status { - Text("Utiliser un boîtier · Bluetooth \(why)") + Text("Use a housing · Bluetooth \(why)") } else { TimelineView(.periodic(from: .now, by: 0.5)) { context in let dots = Int(context.date.timeIntervalSinceReferenceDate * 2) % 3 + 1 - // Toujours trois points (largeur fixe, même police) ; seuls les premiers sont visibles. + // Always three dots (fixed width, same font); only the first ones are visible. HStack(spacing: 0) { - Text("Utiliser un boîtier · recherche") + Text("Use a housing · searching") ForEach(0..<3, id: \.self) { i in Text(".").opacity(i < dots ? 1 : 0) } } } @@ -428,18 +435,18 @@ struct HomeView: View { } .buttonStyle(.bordered) .disabled(true) - Text("Allumez le boîtier : il sera détecté tout seul.").font(.footnote).foregroundStyle(.secondary) + Text("Turn the housing on: it will be detected automatically.").font(.footnote).foregroundStyle(.secondary) } ForEach(model.camera.denied, id: \.self) { item in - Label("Autorisation refusée : \(item). Réglages → Open Mérou.", systemImage: "exclamationmark.triangle.fill") + Label("Permission denied: \(item). Settings → Open Mérou.", systemImage: "exclamationmark.triangle.fill") .font(.footnote).foregroundStyle(.orange) } } } } -/// Galerie de la session, pilotée par les boutons du boîtier (les originaux sont déjà dans Photos). +/// Gallery of the session, driven by the housing buttons (the originals are already in Photos). struct GalleryView: View { let model: AppModel let gallery: AppModel.Gallery @@ -454,12 +461,12 @@ struct GalleryView: View { VStack { HStack { Text("\(gallery.index + 1) / \(model.roll.count)").monospacedDigit() - if isVideo { Label("VIDÉO", systemImage: "video.fill") } + if isVideo { Label("VIDEO", systemImage: "video.fill") } Spacer() } .font(.subheadline.weight(.semibold)).shadow(radius: 3) Spacer() - Text("Haut, bas : parcourir · gauche : fermer") + Text("Up, down: browse · left: close") .font(.caption).padding(8).background(.black.opacity(0.5), in: Capsule()) } .padding() @@ -467,7 +474,7 @@ struct GalleryView: View { } } -/// Alarme de fuite : plein écran, clignotante, impossible à manquer. +/// Leak alarm: full screen, blinking, impossible to miss. struct LeakAlarm: View { let risePa: Double @@ -478,10 +485,10 @@ struct LeakAlarm: View { (on ? Color.red : Color.black).opacity(0.9).ignoresSafeArea() VStack(spacing: 10) { Image(systemName: "exclamationmark.triangle.fill").font(.system(size: 60)) - Text("FUITE").font(.system(size: 64, weight: .black)) - Text("Remontez et sortez le boîtier de l'eau").font(.title2.bold()) - Text(String(format: "La pression intérieure est remontée de %.0f Pa", risePa)).font(.subheadline) - Text("Bouton droit : reprendre la surveillance · appui long à droite : ouvrir le boîtier").font(.footnote) + Text("LEAK").font(.system(size: 64, weight: .black)) + Text("Surface and take the housing out of the water").font(.title2.bold()) + Text("Internal pressure rose by \(String(format: "%.0f", risePa)) Pa").font(.subheadline) + Text("Right button: resume monitoring · long press right: open the housing").font(.footnote) } .foregroundStyle(.white) .multilineTextAlignment(.center) diff --git a/OpenMerou/UI/HousingView.swift b/OpenMerou/UI/HousingView.swift @@ -1,6 +1,7 @@ +// SPDX-License-Identifier: GPL-2.0-only import SwiftUI -/// Écran de diagnostic du prototype : tout ce que le boîtier envoie, en direct. +/// Diagnostics screen of the prototype: everything the housing sends, live. struct HousingView: View { let housing: HousingClient @Environment(\.dismiss) private var dismiss @@ -12,7 +13,7 @@ struct HousingView: View { Text(housing.status.label) if let event = housing.readings.lastButton { HStack { - Text("Dernier bouton") + Text("Last button") Spacer() Text(event.button.label + (event.isLong ? " (long)" : "")) .font(.title2.bold()) @@ -20,55 +21,56 @@ struct HousingView: View { } } - Section("Mise sous vide") { + Section("Vacuum") { VacuumView(vacuum: housing.vacuum) } - Section("Boîtier") { - row("Pression intérieure", housing.readings.internalPressurePa.map { hPa($0) }) - row("Pression extérieure (hypothèse)", housing.readings.externalPressurePa.map { hPa($0) }) - row("Température intérieure", housing.readings.temperatureC.map { String(format: "%.2f °C", $0) }) - row("Batterie", housing.readings.batteryPercent.map { "\($0) %" }) - row("Pompe", housing.readings.pumpState.map(pumpLabel)) - row("1628 (alarme ?)", housing.readings.alarmRaw.map { String(format: "%02X", $0) }) + Section("Housing") { + row("Internal pressure", housing.readings.internalPressurePa.map { hPa($0) }) + row("External pressure (assumed)", housing.readings.externalPressurePa.map { hPa($0) }) + row("Internal temperature", housing.readings.temperatureC.map { String(format: "%.2f °C", $0) }) + row("Battery", housing.readings.batteryPercent.map { "\($0) %" }) + row("Pump", housing.readings.pumpState.map(pumpLabel)) + row("1628 (alarm?)", housing.readings.alarmRaw.map { String(format: "%02X", $0) }) } if housing.pumpRequested { Section { - Button("Arrêter la pompe", role: .destructive) { housing.stopPump(reason: "bouton") } + Button("Stop the pump", role: .destructive) { housing.stopPump(reason: String(localized: "button")) } } } if housing.simulated { - Section { Button("Quitter la simulation") { housing.stopSimulation() } } + Section { Button("Leave the simulation") { housing.stopSimulation() } } } else if housing.released { - Section { Button("Se reconnecter") { housing.reconnect() } } + Section { Button("Reconnect") { housing.reconnect() } } } else if housing.isConnected { Section { - Button("Se déconnecter du boîtier", role: .destructive) { housing.release() } + Button("Disconnect from the housing", role: .destructive) { housing.release() } } footer: { - Text("Une fois déconnecté, maintenez le bouton droit du boîtier 2 secondes pour l'éteindre.") + Text("Once disconnected, hold the right button of the housing for 2 seconds to turn it off.") } } if !housing.deviceInfo.isEmpty { - Section("Appareil") { - ForEach(housing.deviceInfo.keys.sorted(), id: \.self) { key in - row(key, housing.deviceInfo[key]) + Section("Device") { + // Sorted by displayed label, as the rows always were. + ForEach(housing.deviceInfo.keys.sorted { $0.label < $1.label }, id: \.self) { field in + LabeledContent(field.label, value: housing.deviceInfo[field] ?? "—") } } } let files = DevLog.files if !files.isEmpty { - Section("Journaux du mode développement") { + Section("Development mode logs") { ForEach(files, id: \.self) { file in ShareLink(item: file) { Text(file.lastPathComponent).font(.footnote) } } } } - Section("Journal") { + Section("Log") { ForEach(housing.log) { line in HStack(alignment: .firstTextBaseline) { Text(line.date, format: .dateTime.hour().minute().second()) @@ -84,13 +86,13 @@ struct HousingView: View { .navigationBarTitleDisplayMode(.inline) .toolbar { ToolbarItem(placement: .cancellationAction) { - Button { dismiss() } label: { Label("Retour", systemImage: "chevron.left").labelStyle(.titleAndIcon) } + Button { dismiss() } label: { Label("Back", systemImage: "chevron.left").labelStyle(.titleAndIcon) } } } } } - private func row(_ title: String, _ value: String?) -> some View { + private func row(_ title: LocalizedStringKey, _ value: String?) -> some View { LabeledContent(title, value: value ?? "—") } @@ -100,9 +102,9 @@ struct HousingView: View { private func pumpLabel(_ state: PumpState) -> String { switch state { - case .running: "en marche" - case .stopped: "arrêtée" - case .other(let byte): String(format: "inconnu (%02X)", byte) + case .running: String(localized: "running") + case .stopped: String(localized: "stopped") + case .other(let byte): String(localized: "unknown (\(String(format: "%02X", byte)))") } } } diff --git a/OpenMerou/UI/VacuumView.swift b/OpenMerou/UI/VacuumView.swift @@ -1,6 +1,7 @@ +// SPDX-License-Identifier: GPL-2.0-only import SwiftUI -/// Carte de la séquence de mise sous vide : une consigne, la pression, et le bouton du boîtier à utiliser. +/// Card of the vacuum sequence: an instruction, the pressure, and the housing button to use. struct VacuumView: View { let vacuum: VacuumSequence @@ -16,9 +17,9 @@ struct VacuumView: View { } } if let p = vacuum.pressurePa { - Text(String(format: "Pression intérieure : %.1f hPa", p / 100)).monospacedDigit() + Text("Internal pressure: \(String(format: "%.1f", p / 100)) hPa").monospacedDigit() } - if let rise { Text(String(format: "Remontée corrigée : %+.0f Pa", rise)).monospacedDigit() } + if let rise { Text("Corrected rise: \(String(format: "%+.0f", rise)) Pa").monospacedDigit() } if let hint { Text(hint).font(.footnote).foregroundStyle(.secondary) } } .sensoryFeedback(trigger: vacuum.step) { _, new in @@ -46,56 +47,56 @@ struct VacuumView: View { } } - private var title: String { + private var title: LocalizedStringKey { switch vacuum.step { - case .prepare: "1. Fermez et verrouillez le boîtier" - case .openPlug: "2. Ouvrez le bouchon" - case .pumping: "3. Pompage…" - case .closePlug: "4. Fermez le bouchon" - case .testing: "Test d'étanchéité" - case .sealed: "Étanche, bonne plongée" - case .failed(.vacuumNotReached): "Vide non atteint" - case .failed(.leak): "Fuite : ne plongez pas" - case .failed(.connectionLost): "Boîtier déconnecté" - case .opening: "Ouvrez le bouchon" - case .opened: "Boîtier à l'air" - case .bypassed: "Essai à sec" + case .prepare: "1. Close and lock the housing" + case .openPlug: "2. Open the plug" + case .pumping: "3. Pumping…" + case .closePlug: "4. Close the plug" + case .testing: "Leak test" + case .sealed: "Sealed, have a good dive" + case .failed(.vacuumNotReached): "Vacuum not reached" + case .failed(.leak): "Leak: do not dive" + case .failed(.connectionLost): "Housing disconnected" + case .opening: "Open the plug" + case .opened: "Housing vented" + case .bypassed: "Dry run" } } - private var detail: String? { + private var detail: LocalizedStringKey? { switch vacuum.step { case .prepare: if let p = vacuum.pressurePa, p < VacuumSequence.alreadyUnderVacuumPa { - "Le boîtier est déjà sous vide : le test d'étanchéité va démarrer directement." + "The housing is already under vacuum: the leak test will start right away." } else { - "iPhone en place (mode avion conseillé, Bluetooth allumé), boîtier fermé, verrou verrouillé." + "iPhone in place (airplane mode recommended, Bluetooth on), housing closed, latch locked." } - case .openPlug: "Le bouchon doit être ouvert avant de démarrer la pompe." - case .pumping: "La pompe s'arrête toute seule sous 800 hPa." - case .closePlug: "Vide atteint. Refermez le bouchon, puis confirmez." - case .testing: "L'étanchéité n'est pas encore vérifiée." - case .sealed: "La pression reste surveillée pendant toute la plongée." - case .failed(.vacuumNotReached): "Vérifiez le bouchon, le joint et le verrou." - case .failed(.leak(let rise)): String(format: "La pression est remontée de %.0f Pa. Sortez de l'eau et vérifiez le joint.", rise) - case .failed(.connectionLost): "Sans le boîtier, l'étanchéité n'est plus surveillée." - case .opening: "La pression va revenir à la normale." - case .opened: "Vous pouvez ouvrir le boîtier. Pensez à désactiver le mode avion." - case .bypassed: "Pas de mise sous vide : ne mettez pas le boîtier à l'eau." + case .openPlug: "The plug must be open before the pump starts." + case .pumping: "The pump stops by itself below 800 hPa." + case .closePlug: "Vacuum reached. Close the plug, then confirm." + case .testing: "The seal is not verified yet." + case .sealed: "Pressure is monitored throughout the dive." + case .failed(.vacuumNotReached): "Check the plug, the O-ring and the latch." + case .failed(.leak(let rise)): "Pressure rose by \(String(format: "%.0f", rise)) Pa. Get out of the water and check the O-ring." + case .failed(.connectionLost): "Without the housing, the seal is no longer monitored." + case .opening: "Pressure will return to normal." + case .opened: "You can open the housing. Remember to turn airplane mode off." + case .bypassed: "No vacuum: do not put the housing in the water." } } - private var hint: String? { + private var hint: LocalizedStringKey? { switch vacuum.step { - case .prepare: "Bouton droit : continuer" - case .openPlug: "Bouton droit : démarrer la pompe · gauche : retour" - case .pumping: "Bouton gauche : arrêter" - case .closePlug: "Bouton droit : lancer le test · gauche : retour" - case .testing, .sealed: "Appui long à droite : ouvrir le boîtier" - case .failed: "Bouton droit : recommencer · appui long à droite : ouvrir le boîtier" - case .opening: "Bouton droit : c'est fait · gauche : annuler" - case .bypassed: "Appui long à droite : revenir à la mise sous vide" - case .opened: "Bouton droit : se déconnecter, puis maintenez-le 2 s pour éteindre le boîtier" + case .prepare: "Right button: continue" + case .openPlug: "Right button: start the pump · left: back" + case .pumping: "Left button: stop" + case .closePlug: "Right button: start the test · left: back" + case .testing, .sealed: "Long press right: open the housing" + case .failed: "Right button: start over · long press right: open the housing" + case .opening: "Right button: done · left: cancel" + case .bypassed: "Long press right: back to the vacuum sequence" + case .opened: "Right button: disconnect, then hold it for 2 s to turn the housing off" } } } diff --git a/OpenMerouTests/CameraMenuTests.swift b/OpenMerouTests/CameraMenuTests.swift @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0-only import Testing @testable import OpenMerou @@ -18,9 +19,9 @@ struct CameraMenuTests { var menu = CameraMenu(), settings = CameraSettings() settings.videoQuality = VideoQuality(height: 1080, fps: 30) menu.open() - for _ in 0..<3 { _ = menu.handle(.down, settings: &settings, caps: caps) } // Réglages + for _ in 0..<3 { _ = menu.handle(.down, settings: &settings, caps: caps) } // Settings _ = menu.handle(.right, settings: &settings, caps: caps) - for _ in 0..<4 { _ = menu.handle(.down, settings: &settings, caps: caps) } // Qualité vidéo + for _ in 0..<4 { _ = menu.handle(.down, settings: &settings, caps: caps) } // Video quality _ = menu.handle(.right, settings: &settings, caps: caps) #expect(menu.level == .options(.videoQuality, 0)) _ = menu.handle(.down, settings: &settings, caps: caps) @@ -36,14 +37,14 @@ struct CameraMenuTests { for _ in 0..<3 { _ = menu.handle(.down, settings: &settings, caps: caps) } _ = menu.handle(.right, settings: &settings, caps: caps) _ = menu.handle(.down, settings: &settings, caps: caps) - _ = menu.handle(.right, settings: &settings, caps: caps) // Format photo + _ = menu.handle(.right, settings: &settings, caps: caps) // Photo format _ = menu.handle(.down, settings: &settings, caps: caps) _ = menu.handle(.left, settings: &settings, caps: caps) #expect(settings.photoFormat == .heif) } @Test func gainsAreFittedToTheSensor() { - // Eau bleue : il faudrait ×6 de rouge, le capteur plafonne à ×4. + // Blue water: ×6 of red would be needed, the sensor caps at ×4. let deep = ColorGains(red: 3.0, green: 0.6, blue: 0.5).fitted(max: 4) #expect(deep.gains == ColorGains(red: 4, green: 1.2, blue: 1)) #expect(deep.saturated) @@ -53,7 +54,7 @@ struct CameraMenuTests { } @Test func onlyRedRaisesTheWarning() { - // Lampe chaude : il faudrait ×5 de bleu ; le bleu bute, pas le rouge. + // Warm light: ×5 of blue would be needed; blue hits the cap, not red. let tungsten = ColorGains(red: 1.0, green: 1.4, blue: 5.0).fitted(max: 4) #expect(!tungsten.saturated) #expect(tungsten.gains.blue == 4) @@ -67,7 +68,7 @@ struct CameraMenuTests { @Test func brightnessFromTheRootMenu() { var menu = CameraMenu(), settings = CameraSettings() menu.open() - for _ in 0..<4 { _ = menu.handle(.down, settings: &settings, caps: caps) } // Luminosité + for _ in 0..<4 { _ = menu.handle(.down, settings: &settings, caps: caps) } // Brightness _ = menu.handle(.right, settings: &settings, caps: caps) #expect(menu.level == .options(.brightness, 0)) for _ in 0..<3 { _ = menu.handle(.down, settings: &settings, caps: caps) } diff --git a/OpenMerouTests/HousingProtocolTests.swift b/OpenMerouTests/HousingProtocolTests.swift @@ -1,9 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0-only @preconcurrency import CoreBluetooth import Foundation import Testing @testable import OpenMerou -/// Valeurs tirées de la capture du 2026-11-13 et des lectures nRF Connect (docs/PROTOCOLE.md). +/// Values taken from the 2026-11-13 capture and from the nRF Connect reads (docs/PROTOCOL.md). struct HousingProtocolTests { @Test(arguments: [ (UInt8(0x10), HousingButton.left, false), @@ -52,7 +53,7 @@ struct HousingProtocolTests { @Test func negativeTemperature() { var readings = HousingReadings() - readings.apply(HousingUUID.temperature, Data([0x38, 0xFF, 0xFF, 0xFF])) // -2,00 °C + readings.apply(HousingUUID.temperature, Data([0x38, 0xFF, 0xFF, 0xFF])) // -2.00 °C #expect(readings.temperatureC == -2) } diff --git a/OpenMerouTests/VacuumSequenceTests.swift b/OpenMerouTests/VacuumSequenceTests.swift @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0-only import Foundation import Testing @testable import OpenMerou @@ -7,7 +8,7 @@ struct VacuumSequenceTests { func press(_ byte: UInt8) -> ButtonEvent { ButtonEvent(Data([byte]))! } let right: UInt8 = 0x30, left: UInt8 = 0x10, rightLong: UInt8 = 0x31 - /// Amène la séquence au début du test d'étanchéité, à 79 574 Pa et 21,17 °C (capture du 2026-11-13). + /// Brings the sequence to the start of the leak test, at 79,574 Pa and 21.17 °C (2026-11-13 capture). func sealedStart() -> VacuumSequence { var s = VacuumSequence() _ = s.sensors(pressurePa: 100_960, temperatureC: 21.0, now: t0) @@ -39,12 +40,12 @@ struct VacuumSequenceTests { @Test func warmingAloneDoesNotFailTheTest() { var s = sealedStart() - // Fin de la capture : 80 001 Pa à 22,2 °C, soit ~+150 Pa une fois corrigé. + // End of the capture: 80,001 Pa at 22.2 °C, that is ~+150 Pa once corrected. #expect(s.sensors(pressurePa: 80_001, temperatureC: 22.2, now: t0 + 20 + 179) == []) - guard case .testing(let b) = s.step else { Issue.record("test interrompu"); return } + guard case .testing(let b) = s.step else { Issue.record("test interrupted"); return } #expect(abs(s.correctedRise(since: b)! - 149) < 15) _ = s.sensors(pressurePa: 80_001, temperatureC: 22.2, now: t0 + 20 + 180) - guard case .sealed = s.step else { Issue.record("pas étanche : \(s.step)"); return } + guard case .sealed = s.step else { Issue.record("not sealed: \(s.step)"); return } } @Test func leakFailsTheTest() { @@ -56,10 +57,10 @@ struct VacuumSequenceTests { @Test func leakDuringTheDive() { var s = sealedStart() _ = s.sensors(pressurePa: 79_600, temperatureC: 21.17, now: t0 + 300) - _ = s.sensors(pressurePa: 78_000, temperatureC: 12, now: t0 + 1200) // eau froide : pas d'alerte - guard case .sealed = s.step else { Issue.record("fausse alerte : \(s.step)"); return } + _ = s.sensors(pressurePa: 78_000, temperatureC: 12, now: t0 + 1200) // cold water: no alert + guard case .sealed = s.step else { Issue.record("false alert: \(s.step)"); return } _ = s.sensors(pressurePa: 82_000, temperatureC: 12, now: t0 + 1300) - guard case .failed(.leak) = s.step else { Issue.record("fuite non vue"); return } + guard case .failed(.leak) = s.step else { Issue.record("leak not seen"); return } } @Test func pumpTimeout() { @@ -91,11 +92,11 @@ struct VacuumSequenceTests { var s = sealedStart() s.connectionLost() #expect(s.linkLost) - guard case .testing = s.step else { Issue.record("état perdu : \(s.step)"); return } - // Au retour du boîtier, la surveillance reprend avec la même référence. + guard case .testing = s.step else { Issue.record("state lost: \(s.step)"); return } + // When the housing comes back, monitoring resumes with the same baseline. _ = s.sensors(pressurePa: 79_600, temperatureC: 21.2, now: t0 + 300) #expect(!s.linkLost) - guard case .sealed = s.step else { Issue.record("pas repris : \(s.step)"); return } + guard case .sealed = s.step else { Issue.record("not resumed: \(s.step)"); return } } @Test func connectionLostWhilePumpingFails() { diff --git a/README.md b/README.md @@ -1,25 +1,41 @@ # Open Mérou -App iOS libre et gratuite pour le boîtier de plongée Oceanic+ : boutons, pompe à vide, capteurs, -et bientôt la caméra avec correction des couleurs, sans abonnement. +A free, open-source iOS app for the Oceanic+ dive housing: buttons, vacuum pump, sensors and camera with +color correction, without a subscription. -Le protocole Bluetooth du boîtier a été obtenu par rétro-ingénierie, pour l'interopérabilité, -à partir des échanges entre le boîtier et l'app officielle : voir [docs/PROTOCOLE.md](docs/PROTOCOLE.md). -Ce projet n'est ni affilié à Huish Outdoors ni approuvé par eux ; « Oceanic » est leur marque. +The Bluetooth protocol of the housing was reverse-engineered, for interoperability, from the exchanges +between the housing and the official app: see [docs/PROTOCOL.md](docs/PROTOCOL.md). +This project is neither affiliated with nor endorsed by Huish Outdoors; "Oceanic" is their trademark. -## État +The app is available in English and French. -Version 0.4 : connexion automatique au boîtier (« HUISH ») ; mise sous vide guidée par les boutons, test -d'étanchéité corrigé par la température, surveillance continue ; caméra pilotée par les boutons (photo pleine -résolution, ProRAW, vidéo jusqu'à ce que l'iPhone sait faire, objectifs, exposition, stabilisation, veille). +## Status -## Développement +Version 0.4: automatic connection to the housing ("HUISH"); vacuum sequence guided by the buttons, leak +test corrected for temperature, continuous monitoring; camera driven by the buttons (full-resolution photo, +ProRAW, video up to what the iPhone can do, lenses, exposure, stabilization, sleep). -Projet XcodeGen (`project.yml`), Swift 6, iOS 17. Le code vit sur hotrats, Xcode sur chunga : +## Development + +XcodeGen project (`project.yml`), Swift 6, iOS 17. The Makefile assumes the author's setup: the sources are +edited on a Linux host and synced with `rsync` to a Mac reachable over SSH as `chunga`, which runs Xcode. Set +`CHUNGA` (the SSH host) and `REMOTE` (the directory on the Mac) to adapt it: ```bash -make build # rsync vers chunga, xcodegen, compilation -make test # tests unitaires du protocole (simulateur « OpenMerou test iPhone ») +make build # rsync to the Mac, xcodegen, build +make test # unit tests (simulator "OpenMerou test iPhone") ``` -Outils : `tools/pklg.py` décode un journal Bluetooth iOS (PacketLogger, sysdiagnose). +Or work directly on a Mac: run `xcodegen` at the root of the repository and open the generated Xcode project +(`project.yml` is the source of truth; the `.xcodeproj` is not versioned). + +English is the source language of the interface; the French translation lives in +`OpenMerou/Localizable.xcstrings` and `OpenMerou/InfoPlist.xcstrings`. + +Launch options: `-simulation` (simulated housing from the start), `-demoMenu` (opens the settings menu). + +Tools: `tools/pklg.py` decodes an iOS Bluetooth log (PacketLogger, sysdiagnose). + +## License + +GPL-2.0-only. See [LICENSE](LICENSE). diff --git a/docs/PROTOCOL.md b/docs/PROTOCOL.md @@ -0,0 +1,88 @@ +# BLE protocol of the Oceanic+ housing (reverse-engineered) + +Source: iOS HCI capture (sysdiagnose) of 2026-11-13, official app in its free version, +iPhone iOS 24B119. Decoding: `tools/pklg.py`. The times in the log are shifted by -5 h +from local time (07:55 in the log = 12:55 on the clock). + +Nothing is encrypted at the application level: raw, little-endian values. + +## Identity (nRF Connect, 2026-11-13) + +- Advertised name: `HUISH`, connectable. Nordic chip (nRF5 SDK), DFU available. +- Manufacturer data: Nordic (0x0059) `D0B4 AF9F 7FAA`. +- Standard services: 1800, 1801, Battery 180F (2A19 = handle 0x0016), Device Information 180A + (2A29 manufacturer, 2A24 model, 2A25 serial number, 2A27 hardware revision…). +- **Nordic LED Button Service** (the SDK's "Blinky" sample) `00001523-1212-EFDE-1523-785FEABCD123`: + - `00001524-…` Button State (read, notify) = handle 0x0010, button codes below; + - `00001525-…` LED State (read, write): role unknown, not used in the capture. +- Custom service `00001623-1212-EFDE-1523-785FEABCD123` (characteristics 1624 to 1629, see the table). +- Secure DFU `FE59`, characteristic Buttonless DFU Without Bonds `8EC90003-F315-4F60-9F…`. + **Never write to it**: the housing would switch to update mode. + +Common base of the UUIDs: `0000XXXX-1212-EFDE-1523-785FEABCD123`. + +## Observed characteristics (by ATT handle; UUIDs to be confirmed) + +| Handle | UUID (XXXX) | Properties | Format | Role | +|---|---|---|---|---| +| 0x0010 | 1524 (service 1523) | read, notify | 1 byte | **Button**: high nibble = button, low nibble = 0 short / 1 long | +| 0x0013 | 1525 (service 1523) | read, write | ? | "LED" of the Nordic sample, not used by the app | +| 0x0016 | 2A19 (180F) | read, notify | 1 byte | **Battery** (%): 92→88 while pumping | +| 0x0027 | 1624 (service 1623) | read, write | 1 byte | **Pump**: `01` = start, `00` = stop | +| 0x0029 | 1625 | read, notify (~3 Hz) | uint32 | Assumption: **external pressure** (depth gauge) in daPa: 9940 = 99.4 kPa in air | +| 0x002C | 1626 | read, notify (~3 Hz) | int32 | Internal **temperature**, hundredths of °C (2100 = 21.00 °C) | +| 0x002F | 1627 | read, notify (~3 Hz) | uint32 | Absolute internal **pressure**, Pa (100,960 = 1009.6 hPa) | +| 0x0032 | 1628 | read, notify | 1 byte | Unknown, `00` at rest, never notified (water alarm?) | +| 0x0035 | 1629 | read, notify | 1 byte | **Pump state**: `01` = running, `02` = stopped | + +Handle ↔ UUID mapping **confirmed** by the nRF Connect discovery log (13:18): +1523 (2 characteristics), 180F, 180A with 6 characteristics (2A29, 2A24, 2A25, 2A27, 2A26, 2A28), +1623 = 0x0025 (1624 without descriptor, 1625–1629 with CCCD, 3 handles each), FE59. Each observed +handle falls exactly on the value of the expected characteristic. + +### Buttons (0x0010) + +| Value | Button | +|---|---| +| 0x10 | left | +| 0x20 | shutter | +| 0x30 | right | +| 0x40 | up | +| 0x50 | down | +| 0x_1 | long press (2 s), e.g. 0x31 = right long | + +The housing only reports the presses: all the behaviour (photo, menus, pump) is in the app. + +## Observed vacuum cycle + +1. 12:55:02 right press (0x30) → the app writes `01` to 0x0027 → 0x0035 = `01`. +2. Pressure: 100.96 kPa → 79.57 kPa in 10 s (≈ 2 kPa/s); 0x0016: 92 → 88. +3. 12:55:12 the app writes `00` to 0x0027 (P = 79,574 Pa, first sample < 80,000 Pa, + or a 10 s timeout: to be settled) → 0x0035 = `02`. +4. 3 min leak test done **by the app** on the pressure: 79.57 → 80.01 kPa in 4 min, + while the temperature rises from 21.2 to 22.2 °C (the gas law explains ~+280 Pa out of +434). +5. Opening (app side, guided): long press right (0x31) = start the opening sequence, + then right presses (0x30) = step confirmations (open the plug, purge, close the plug). + 12:59:40 back to 99.3 kPa when the plug is open: mechanical venting, no BLE write. +6. Power-off: no BLE order. The housing only turns off on a long press right **once disconnected**; + while connected, the long press is only notified (0x31). The official app therefore drops the connection + (HCI 0x16) at the end of the sequence, then the user does the long press. + +## Validated on the housing with Open Mérou 0.2 (2026-11-13) + +- Buttons detected; 1627 = internal pressure; writing 01/00 to 1624 = pump, the pressure + drops with the housing closed. +- **The plug must be open before starting the pump** (Jean's instruction, as in the official app). + +## Validated on the iPhone 18 Pro (2026-11-13) + +- Preview upright in landscape with the default orientation ("Landscape"); lenses 0.5× 1× 2× 4× 8× offered. + +## To do + +- nRF Connect read of 2026-11-13 13:2x, housing in air: 1625 = 9940, 1626 = 23.64 °C, + 1627 = 99,869 Pa, 1628 = `00`. +- Read the Device Information strings (firmware version). +- 1625 = external pressure? (value underwater, or when pressing on the sensor). +- Pump stop threshold (pressure or timeout): second capture. +- What happens at power-off (long press right). diff --git a/docs/PROTOCOLE.md b/docs/PROTOCOLE.md @@ -1,88 +0,0 @@ -# Protocole BLE du boîtier Oceanic+ (rétro-ingénierie) - -Source : capture HCI iOS (sysdiagnose) du 2026-11-13, app officielle en version gratuite, -iPhone iOS 24B119. Décodage : `tools/pklg.py`. Les heures du journal sont décalées de -5 h -par rapport à l'heure locale (07:55 dans le journal = 12:55 à l'horloge). - -Rien n'est chiffré au niveau applicatif : valeurs brutes, petit-boutistes. - -## Identité (nRF Connect, 2026-11-13) - -- Nom annoncé : `HUISH`, connectable. Puce Nordic (nRF5 SDK), DFU disponible. -- Données fabricant : Nordic (0x0059) `D0B4 AF9F 7FAA`. -- Services standards : 1800, 1801, Battery 180F (2A19 = handle 0x0016), Device Information 180A - (2A29 fabricant, 2A24 modèle, 2A25 n° de série, 2A27 révision matérielle…). -- **Nordic LED Button Service** (exemple « Blinky » du SDK) `00001523-1212-EFDE-1523-785FEABCD123` : - - `00001524-…` Button State (read, notify) = handle 0x0010, codes des boutons ci-dessous ; - - `00001525-…` LED State (read, write) : rôle inconnu, non utilisé dans la capture. -- Service propre `00001623-1212-EFDE-1523-785FEABCD123` (caractéristiques 1624 à 1629, voir tableau). -- Secure DFU `FE59`, caractéristique Buttonless DFU Without Bonds `8EC90003-F315-4F60-9F…`. - **Ne jamais y écrire** : le boîtier passerait en mode mise à jour. - -Base commune des UUID : `0000XXXX-1212-EFDE-1523-785FEABCD123`. - -## Caractéristiques observées (par handle ATT ; UUID à confirmer) - -| Handle | UUID (XXXX) | Propriétés | Format | Rôle | -|---|---|---|---|---| -| 0x0010 | 1524 (service 1523) | read, notify | 1 octet | **Bouton** : quartet haut = bouton, quartet bas = 0 court / 1 long | -| 0x0013 | 1525 (service 1523) | read, write | ? | « LED » de l'exemple Nordic, non utilisée par l'app | -| 0x0016 | 2A19 (180F) | read, notify | 1 octet | **Batterie** (%) : 92→88 pendant le pompage | -| 0x0027 | 1624 (service 1623) | read, write | 1 octet | **Pompe** : `01` = marche, `00` = arrêt | -| 0x0029 | 1625 | read, notify (~3 Hz) | uint32 | Hypothèse : **pression extérieure** (profondimètre) en daPa : 9940 = 99,4 kPa à l'air | -| 0x002C | 1626 | read, notify (~3 Hz) | int32 | **Température** interne, centièmes de °C (2100 = 21,00 °C) | -| 0x002F | 1627 | read, notify (~3 Hz) | uint32 | **Pression** interne absolue, Pa (100 960 = 1009,6 hPa) | -| 0x0032 | 1628 | read, notify | 1 octet | Inconnu, `00` au repos, jamais notifié (alarme d'eau ?) | -| 0x0035 | 1629 | read, notify | 1 octet | **État de la pompe** : `01` = en marche, `02` = arrêtée | - -Correspondance handles ↔ UUID **confirmée** par le journal de découverte nRF Connect (13:18) : -1523 (2 caractéristiques), 180F, 180A à 6 caractéristiques (2A29, 2A24, 2A25, 2A27, 2A26, 2A28), -1623 = 0x0025 (1624 sans descripteur, 1625–1629 avec CCCD, 3 handles chacun), FE59. Chaque handle -observé tombe exactement sur la valeur de la caractéristique attendue. - -### Boutons (0x0010) - -| Valeur | Bouton | -|---|---| -| 0x10 | gauche | -| 0x20 | obturateur (déclencheur) | -| 0x30 | droite | -| 0x40 | haut | -| 0x50 | bas | -| 0x_1 | appui long (2 s), ex. 0x31 = droite long | - -Le boîtier ne fait qu'annoncer les appuis : tout le comportement (photo, menus, pompe) est dans l'app. - -## Cycle de vide observé - -1. 12:55:02 appui droite (0x30) → l'app écrit `01` dans 0x0027 → 0x0035 = `01`. -2. Pression : 100,96 kPa → 79,57 kPa en 10 s (≈ 2 kPa/s) ; 0x0016 : 92 → 88. -3. 12:55:12 l'app écrit `00` dans 0x0027 (P = 79 574 Pa, premier échantillon < 80 000 Pa, - ou délai de 10 s : à départager) → 0x0035 = `02`. -4. Test d'étanchéité de 3 min fait **par l'app** sur la pression : 79,57 → 80,01 kPa en 4 min, - pendant que la température monte de 21,2 à 22,2 °C (la loi des gaz explique ~+280 Pa sur +434). -5. Ouverture (côté app, guidée) : appui long droite (0x31) = lancer la séquence d'ouverture, - puis appuis droite (0x30) = confirmations d'étapes (ouvrir le bouchon, purge, fermer le bouchon). - 12:59:40 retour à 99,3 kPa quand le bouchon est ouvert : mise à l'air mécanique, aucune écriture BLE. -6. Extinction : aucun ordre BLE. Le boîtier ne s'éteint par appui long à droite **qu'une fois déconnecté** ; - connecté, l'appui long est seulement notifié (0x31). L'app officielle coupe donc la connexion - (HCI 0x16) à la fin de la séquence, puis l'usager fait l'appui long. - -## Validé sur le boîtier avec Open Mérou 0.2 (2026-11-13) - -- Boutons détectés ; 1627 = pression intérieure ; écriture 01/00 dans 1624 = pompe, la pression - baisse boîtier fermé. -- **Le bouchon doit être ouvert avant de démarrer la pompe** (consigne de Jean, comme dans l'app officielle). - -## Validé sur l'iPhone 18 Pro (2026-11-13) - -- Aperçu droit en paysage avec l'orientation par défaut (« Paysage ») ; objectifs 0,5× 1× 2× 4× 8× proposés. - -## À faire - -- Lecture nRF Connect du 2026-11-13 13:2x, boîtier à l'air : 1625 = 9940, 1626 = 23,64 °C, - 1627 = 99 869 Pa, 1628 = `00`. -- Lire les chaînes Device Information (version du micrologiciel). -- 1625 = pression extérieure ? (valeur sous l'eau, ou en appuyant sur le capteur). -- Seuil d'arrêt de la pompe (pression ou délai) : deuxième capture. -- Ce qui se passe à l'extinction (appui long droite). diff --git a/fastlane/Fastfile b/fastlane/Fastfile @@ -2,7 +2,7 @@ require "tmpdir" default_platform(:ios) -# Compte développeur perso (équipe CM5RQKJH56), clé App Store Connect lue dans ~/.zshrc_build de chunga. +# Developer account (team CM5RQKJH56); the App Store Connect key comes from the environment (~/.zshrc_build on the build Mac). APP_ID = "org.schurger.openmerou" def api_key @@ -33,25 +33,25 @@ platform :ios do [res.code.to_i, (JSON.parse(res.body) rescue {})] end - desc "Enregistre l'identifiant de l'app (la fiche App Store se crée à la main)" + desc "Registers the app identifier (the App Store record is created by hand)" lane :register do api_key if Spaceship::ConnectAPI::BundleId.find(APP_ID) - UI.message("#{APP_ID} déjà enregistré") + UI.message("#{APP_ID} already registered") else Spaceship::ConnectAPI::BundleId.create(name: "Open Merou", identifier: APP_ID, platform: "IOS") - UI.success("#{APP_ID} enregistré") + UI.success("#{APP_ID} registered") end end - desc "La fiche App Store Connect existe-t-elle ?" + desc "Does the App Store Connect record exist?" lane :app_exists do api_key app = Spaceship::ConnectAPI::App.find(APP_ID) - UI.message(app ? "FICHE #{app.id} #{app.name}" : "FICHE ABSENTE") + UI.message(app ? "APP RECORD #{app.id} #{app.name}" : "NO APP RECORD") end - desc "Archive signée (sans envoi) ; BUILD=n pour fixer le numéro" + desc "Signed archive (no upload); BUILD=n sets the build number" lane :archive do key = api_key get_certificates(api_key: key, output_path: Dir.tmpdir) @@ -79,7 +79,7 @@ platform :ios do </plist> PLIST - # rsync de Homebrew devant /usr/bin casse -exportArchive (« Copy failed »). + # Homebrew's rsync ahead of /usr/bin breaks -exportArchive ("Copy failed"). ENV["PATH"] = "/usr/bin:/bin:#{ENV["PATH"]}" sh("xcodebuild", "-project", "../OpenMerou.xcodeproj", "-scheme", "OpenMerou", "-configuration", "Release", "-destination", "generic/platform=iOS", "-archivePath", archive_path, @@ -90,43 +90,44 @@ platform :ios do lane_context[:OM_BUILD] = build_number end - desc "Archive puis envoi sur TestFlight (la fiche App Store Connect doit exister)" + desc "Archive then upload to TestFlight (the App Store Connect record must exist)" lane :testflight do archive upload_to_testflight(api_key: api_key, ipa: lane_context[:OM_IPA], skip_waiting_for_build_processing: true) - UI.success("Build #{lane_context[:OM_BUILD]} envoyée sur TestFlight") + UI.success("Build #{lane_context[:OM_BUILD]} uploaded to TestFlight") end - desc "Envoi sur TestFlight d'une IPA déjà construite (build_output/OpenMerou.ipa), après un envoi bloqué" + desc "Uploads an already built IPA (build_output/OpenMerou.ipa) to TestFlight, after a stuck upload" lane :upload do upload_to_testflight(api_key: api_key, ipa: File.expand_path("../build_output/OpenMerou.ipa"), skip_waiting_for_build_processing: true) end - # Rattache une build au groupe « Externes » et la soumet à la revue bêta (sans effet si déjà fait). + # Adds a build to the "Externes" group and submits it to beta review (no effect when already done). + # "Externes" and "Interne" are the names of the tester groups in App Store Connect. def share_external(app, build) _, groups = asc(:get, "/v1/apps/#{app.id}/betaGroups") group = groups["data"].find { |g| g["attributes"]["name"] == "Externes" } - return UI.message("EXTERNES : pas de groupe") unless group + return UI.message("EXTERNAL: no group") unless group c, r = asc(:post, "/v1/betaGroups/#{group["id"]}/relationships/builds", { data: [{ type: "builds", id: build["id"] }] }) - UI.message("EXTERNES build #{build["attributes"]["version"]} -> #{c} #{(r["errors"] || []).map { |e| e["detail"] }.join(" ; ")}") + UI.message("EXTERNAL build #{build["attributes"]["version"]} -> #{c} #{(r["errors"] || []).map { |e| e["detail"] }.join(" ; ")}") _, sub = asc(:get, "/v1/builds/#{build["id"]}/betaAppReviewSubmission") if sub["data"] - UI.message("REVUE BETA déjà demandée : #{sub["data"]["attributes"]["betaReviewState"]}") + UI.message("BETA REVIEW already requested: #{sub["data"]["attributes"]["betaReviewState"]}") else c, r = asc(:post, "/v1/betaAppReviewSubmissions", { data: { type: "betaAppReviewSubmissions", relationships: { build: { data: { type: "builds", id: build["id"] } } } } }) - UI.message("REVUE BETA soumise -> #{c} #{(r["errors"] || []).map { |e| e["detail"] }.join(" ; ")}") + UI.message("BETA REVIEW submitted -> #{c} #{(r["errors"] || []).map { |e| e["detail"] }.join(" ; ")}") end end - desc "Invite un testeur externe (email:...) : groupe « Externes », dernière build attachée, revue bêta" + desc "Invites an external tester (email:...): \"Externes\" group, latest build attached, beta review" lane :invite do |opts| api_key - email = opts[:email] or UI.user_error!("email: manquant") + email = opts[:email] or UI.user_error!("email: missing") app = Spaceship::ConnectAPI::App.find(APP_ID) err = ->(r) { (r["errors"] || []).map { |e| e["detail"] }.join(" ; ") } - # Infos de revue bêta : reprises de Sonodrill (même compte) si elles manquent ici. + # Beta review details: copied from Sonodrill (same account) when they are missing here. _, mine = asc(:get, "/v1/betaAppReviewDetails/#{app.id}") attrs = mine.dig("data", "attributes") || {} if attrs["contactEmail"].to_s.empty? @@ -138,7 +139,7 @@ platform :ios do contactEmail: a["contactEmail"], contactPhone: a["contactPhone"], demoAccountRequired: false, notes: "No account needed. The app controls a Bluetooth dive housing; without one, tap 'Simulate a housing' on the first screen to try every feature with on-screen housing buttons." } } } c, r = asc(:patch, "/v1/betaAppReviewDetails/#{app.id}", body) - UI.message("REVUE BETA infos -> #{c} #{err.(r)}") + UI.message("BETA REVIEW details -> #{c} #{err.(r)}") end _, groups = asc(:get, "/v1/apps/#{app.id}/betaGroups") @@ -146,7 +147,7 @@ platform :ios do unless group c, r = asc(:post, "/v1/betaGroups", { data: { type: "betaGroups", attributes: { name: "Externes" }, relationships: { app: { data: { type: "apps", id: app.id } } } } }) - UI.message("GROUPE Externes -> #{c} #{err.(r)}") + UI.message("GROUP Externes -> #{c} #{err.(r)}") group = r["data"] end @@ -154,39 +155,42 @@ platform :ios do if testers["data"].empty? c, r = asc(:post, "/v1/betaTesters", { data: { type: "betaTesters", attributes: { email: email }, relationships: { betaGroups: { data: [{ type: "betaGroups", id: group["id"] }] } } } }) - UI.message("TESTEUR #{email} -> #{c} #{err.(r)}") + UI.message("TESTER #{email} -> #{c} #{err.(r)}") else c, r = asc(:post, "/v1/betaGroups/#{group["id"]}/relationships/betaTesters", { data: [{ type: "betaTesters", id: testers["data"][0]["id"] }] }) - UI.message("TESTEUR #{email} déjà connu, ajouté au groupe -> #{c} #{err.(r)}") + UI.message("TESTER #{email} already known, added to the group -> #{c} #{err.(r)}") end _, builds = asc(:get, "/v1/builds?filter[app]=#{app.id}&sort=-uploadedDate&limit=1") - build = builds["data"].first or UI.user_error!("aucune build") + build = builds["data"].first or UI.user_error!("no build") share_external(app, build) end - desc "TestFlight : groupe interne « Interne » (toutes les builds) avec Jean, textes bêta fr/en, « À tester » de la dernière build" + desc "TestFlight: internal group \"Interne\" (all builds) with the internal tester, fr/en beta texts, \"What to test\" of the latest build" lane :beta_setup do api_key app = Spaceship::ConnectAPI::App.find(APP_ID) _, groups = asc(:get, "/v1/apps/#{app.id}/betaGroups") group = groups["data"].find { |g| g["attributes"]["name"] == "Interne" } unless group - # POST brut : spaceship envoie publicLinkLimitEnabled, refusé pour un groupe interne. + # Raw POST: spaceship sends publicLinkLimitEnabled, which is refused for an internal group. c, r = asc(:post, "/v1/betaGroups", { data: { type: "betaGroups", attributes: { name: "Interne", isInternalGroup: true, hasAccessToAllBuilds: true }, relationships: { app: { data: { type: "apps", id: app.id } } } } }) - UI.message("GROUPE Interne -> #{c} #{(r["errors"] || []).map { |e| e["detail"] }.join(" ; ")}") + UI.message("GROUP Interne -> #{c} #{(r["errors"] || []).map { |e| e["detail"] }.join(" ; ")}") group = r["data"] end - email = ENV["PERSO_APPLE_ID"] || "jean@schurger.org" + # The internal tester comes from the build machine's environment, never from the repository. + email = ENV["PERSO_APPLE_ID"] or UI.user_error!("PERSO_APPLE_ID is not set") + first_name = ENV["PERSO_FIRST_NAME"] || "Internal" + last_name = ENV["PERSO_LAST_NAME"] || "Tester" _, testers = asc(:get, "/v1/betaTesters?filter[email]=#{email}&filter[apps]=#{app.id}") if testers["data"].empty? - c, r = asc(:post, "/v1/betaTesters", { data: { type: "betaTesters", attributes: { email: email, firstName: "Jean", lastName: "Schurger" }, + c, r = asc(:post, "/v1/betaTesters", { data: { type: "betaTesters", attributes: { email: email, firstName: first_name, lastName: last_name }, relationships: { betaGroups: { data: [{ type: "betaGroups", id: group["id"] }] } } } }) - UI.message("TESTEUR #{email} -> #{c} #{(r["errors"] || []).map { |e| e["detail"] }.join(" ; ")}") + UI.message("TESTER #{email} -> #{c} #{(r["errors"] || []).map { |e| e["detail"] }.join(" ; ")}") else - UI.message("TESTEUR #{email} déjà présent") + UI.message("TESTER #{email} already there") end texts = { "fr-CA" => ["App libre et gratuite pour boîtier de plongée compatible : boutons, pompe à vide, capteurs, caméra.", @@ -208,7 +212,7 @@ platform :ios do end _, builds = asc(:get, "/v1/builds?filter[app]=#{app.id}&sort=-uploadedDate&limit=1") build = builds["data"].first - UI.user_error!("Aucune build encore visible") unless build + UI.user_error!("No build visible yet") unless build UI.message("BUILD #{build["attributes"]["version"]} #{build["attributes"]["processingState"]}") _, blocs = asc(:get, "/v1/builds/#{build["id"]}/betaBuildLocalizations") texts.each do |locale, (_, what)| @@ -219,7 +223,7 @@ platform :ios do asc(:post, "/v1/betaBuildLocalizations", { data: { type: "betaBuildLocalizations", attributes: { locale: locale, whatsNew: what }, relationships: { build: { data: { type: "builds", id: build["id"] } } } } }) end - UI.message("A TESTER #{locale} -> #{c} #{(r["errors"] || []).map { |e| e["detail"] }.join(" ; ")}") + UI.message("WHAT TO TEST #{locale} -> #{c} #{(r["errors"] || []).map { |e| e["detail"] }.join(" ; ")}") end share_external(app, build) if build["attributes"]["processingState"] == "VALID" end diff --git a/project.yml b/project.yml @@ -1,8 +1,10 @@ -# Projet Xcode généré par XcodeGen (`xcodegen` sur chunga) : modifier ce fichier, pas le .xcodeproj. +# Xcode project generated by XcodeGen (`xcodegen`): edit this file, not the .xcodeproj. +# English is the source language; the French translation lives in OpenMerou/Localizable.xcstrings +# and OpenMerou/InfoPlist.xcstrings (CFBundleLocalizations in OpenMerou/Info.plist lists both). name: OpenMerou options: bundleIdPrefix: org.schurger - developmentLanguage: fr + developmentLanguage: en deploymentTarget: iOS: "17.0" settings: diff --git a/tools/make-icon.swift b/tools/make-icon.swift @@ -1,4 +1,6 @@ -// Génère l'icône 1024×1024 (sans transparence) : swift tools/make-icon.swift chemin.png +// SPDX-License-Identifier: GPL-2.0-only +// Generates the 1024×1024 icon (no transparency): swift tools/make-icon.swift path.png +// A grouper ("mérou" in French). import CoreGraphics import Foundation import ImageIO @@ -14,45 +16,45 @@ func rgb(_ r: Double, _ g: Double, _ b: Double, _ a: Double = 1) -> CGColor { CGColor(red: r / 255, green: g / 255, blue: b / 255, alpha: a) } -// Fond : bleu profond vers turquoise (lumière venant d'en haut). +// Background: deep blue to turquoise (light coming from above). let bg = CGGradient(colorsSpace: CGColorSpaceCreateDeviceRGB(), colors: [rgb(8, 36, 84), rgb(10, 92, 140), rgb(40, 170, 190)] as CFArray, locations: [0, 0.6, 1])! ctx.drawLinearGradient(bg, start: CGPoint(x: 0, y: 0), end: CGPoint(x: 0, y: size), options: []) -// Rayons de lumière. +// Light rays. ctx.setFillColor(rgb(255, 255, 255, 0.06)) for x in [180.0, 420.0, 700.0] { ctx.move(to: CGPoint(x: x, y: size)); ctx.addLine(to: CGPoint(x: x + 120, y: size)) ctx.addLine(to: CGPoint(x: x - 80, y: 0)); ctx.addLine(to: CGPoint(x: x - 260, y: 0)); ctx.fillPath() } -// Mérou : corps trapu, grande bouche, nageoire caudale arrondie. +// Grouper: stocky body, large mouth, rounded tail fin. let body = rgb(150, 96, 62), belly = rgb(214, 170, 120), dark = rgb(92, 56, 36) ctx.setFillColor(body) -ctx.move(to: CGPoint(x: 250, y: 520)) // queue +ctx.move(to: CGPoint(x: 250, y: 520)) // tail ctx.addCurve(to: CGPoint(x: 120, y: 360), control1: CGPoint(x: 190, y: 470), control2: CGPoint(x: 120, y: 420)) ctx.addCurve(to: CGPoint(x: 120, y: 680), control1: CGPoint(x: 160, y: 520), control2: CGPoint(x: 160, y: 520)) ctx.addCurve(to: CGPoint(x: 250, y: 520), control1: CGPoint(x: 120, y: 620), control2: CGPoint(x: 190, y: 570)) ctx.fillPath() ctx.fillEllipse(in: CGRect(x: 210, y: 330, width: 640, height: 380)) -// Nageoire dorsale. +// Dorsal fin. ctx.move(to: CGPoint(x: 330, y: 680)); ctx.addCurve(to: CGPoint(x: 700, y: 690), control1: CGPoint(x: 420, y: 800), control2: CGPoint(x: 620, y: 800)) ctx.fillPath() -// Ventre. +// Belly. ctx.setFillColor(belly) ctx.fillEllipse(in: CGRect(x: 300, y: 340, width: 500, height: 150)) -// Taches. +// Spots. ctx.setFillColor(dark) for (x, y, r) in [(380.0, 600.0, 26.0), (470, 640, 20), (450, 540, 30), (560, 600, 24), (620, 540, 18), (340, 520, 18)] { ctx.fillEllipse(in: CGRect(x: x - r, y: y - r, width: 2 * r, height: 2 * r)) } -// Bouche (lèvres épaisses). +// Mouth (thick lips). ctx.setFillColor(dark) ctx.fillEllipse(in: CGRect(x: 790, y: 440, width: 110, height: 70)) ctx.setFillColor(rgb(60, 30, 20)) ctx.fillEllipse(in: CGRect(x: 830, y: 462, width: 60, height: 26)) -// Œil. +// Eye. ctx.setFillColor(rgb(250, 240, 210)) ctx.fillEllipse(in: CGRect(x: 690, y: 560, width: 80, height: 80)) ctx.setFillColor(rgb(20, 20, 30)) @@ -60,7 +62,7 @@ ctx.fillEllipse(in: CGRect(x: 718, y: 582, width: 40, height: 40)) ctx.setFillColor(rgb(255, 255, 255)) ctx.fillEllipse(in: CGRect(x: 738, y: 604, width: 12, height: 12)) -// Bulles. +// Bubbles. ctx.setStrokeColor(rgb(255, 255, 255, 0.85)); ctx.setLineWidth(10) for (x, y, r) in [(880.0, 600.0, 22.0), (920, 700, 32), (870, 820, 44)] { ctx.strokeEllipse(in: CGRect(x: x - r, y: y - r, width: 2 * r, height: 2 * r)) diff --git a/tools/pklg.py b/tools/pklg.py @@ -1,7 +1,8 @@ #!/usr/bin/env python3 -"""Décodeur minimal de journaux Apple PacketLogger (.pklg) : HCI, LE, L2CAP, ATT. +# SPDX-License-Identifier: GPL-2.0-only +"""Minimal decoder for Apple PacketLogger logs (.pklg): HCI, LE, L2CAP, ATT. -Usage : pklg.py fichier.pklg [--handle 0x0040] [--att] [--notes] [--conn] +Usage: pklg.py file.pklg [--handle 0x0040] [--att] [--notes] [--conn] """ import argparse import datetime as dt @@ -21,12 +22,12 @@ ATT_OPS = { def records(path): data = open(path, "rb").read() - # Détecter l'ordre des octets : la longueur du premier enregistrement doit être plausible. + # Detect the byte order: the length of the first record must be plausible. be = struct.unpack(">I", data[:4])[0] le = struct.unpack("<I", data[:4])[0] endian = ">" if 9 <= be < 0x10000 else "<" if not (9 <= (be if endian == ">" else le) < 0x10000): - sys.exit("format pklg non reconnu") + sys.exit("unrecognized pklg format") off = 0 while off + 13 <= len(data): (length,) = struct.unpack(endian + "I", data[off:off + 4]) @@ -68,7 +69,7 @@ def att_decode(p): e = rest[i:i + n] h = struct.unpack("<H", e[:2])[0] v = e[2:] - if len(v) in (5, 19): # déclaration de caractéristique + if len(v) in (5, 19): # characteristic declaration props, vh = v[0], struct.unpack("<H", v[1:3])[0] items.append(f"[decl 0x{h:04X} props=0x{props:02X} val=0x{vh:04X} uuid={uuid_str(v[3:])}]") else: @@ -96,11 +97,11 @@ def att_decode(p): def main(): ap = argparse.ArgumentParser() ap.add_argument("file") - ap.add_argument("--handle", type=lambda x: int(x, 0), help="ne garder qu'une connexion HCI") - ap.add_argument("--att", action="store_true", help="afficher l'ATT") - ap.add_argument("--notes", action="store_true", help="afficher les notes texte de bluetoothd") - ap.add_argument("--conn", action="store_true", help="connexions LE et noms annoncés") - ap.add_argument("--grep", help="filtrer les notes") + ap.add_argument("--handle", type=lambda x: int(x, 0), help="keep a single HCI connection") + ap.add_argument("--att", action="store_true", help="show ATT") + ap.add_argument("--notes", action="store_true", help="show the text notes of bluetoothd") + ap.add_argument("--conn", action="store_true", help="LE connections and advertised names") + ap.add_argument("--grep", help="filter the notes") a = ap.parse_args() frag = {} @@ -111,7 +112,7 @@ def main(): if a.handle is not None and handle != a.handle: continue body = p[4:4 + ln] - if pb in (0, 2): # début + if pb in (0, 2): # start frag[(handle, typ)] = body else: frag[(handle, typ)] = frag.get((handle, typ), b"") + body @@ -134,7 +135,7 @@ def main(): addr = p[8:14][::-1].hex(":") print(f"{ts(t)} LE_CONN status={status} handle=0x{h:03X} peer={addr} type={p[7]}") elif sub in (0x02, 0x0D): - # rapports d'annonce : chercher les noms (AD type 0x08/0x09) + # advertising reports: look for the names (AD type 0x08/0x09) raw = p[3:] i = 0 while i < len(raw) - 1: diff --git a/tools/upload.sh b/tools/upload.sh @@ -1,12 +1,12 @@ #!/bin/bash -# Sur chunga : envoie build_output/OpenMerou.ipa ; abandonne au bout de 5 min (altool reste parfois bloqué). +# On the build Mac: uploads build_output/OpenMerou.ipa; gives up after 5 min (altool sometimes hangs). log=/tmp/merou-upload.log fastlane ios upload > "$log" 2>&1 & for i in $(seq 1 60); do - grep -q "Successfully uploaded the new binary" "$log" && { echo "ENVOYÉ"; exit 0; } + grep -q "Successfully uploaded the new binary" "$log" && { echo "UPLOADED"; exit 0; } grep -q -E '\[!\]|rror:' "$log" && { tail -5 "$log"; exit 1; } /bin/sleep 5 done pkill -f "fastlane ios upload"; pkill -f "altool --upload-app" -echo "ENVOI BLOQUÉ : relancer make release" +echo "UPLOAD STUCK: run make release again" exit 2 diff --git a/tools/wait-beta.sh b/tools/wait-beta.sh @@ -1,11 +1,12 @@ #!/bin/bash -# Sur hotrats : attend que la dernière build soit traitée, puis notes d'essai + groupes + revue bêta. +# On the development host: waits until the latest build is processed, then test notes + groups + beta review. +# The words matched below are the ones printed by the beta_setup lane (fastlane/Fastfile). host=$1; dir=$2 build=$(ssh "$host" "ls -t ~/Library/Developer/Xcode/Archives/ | head -1" | sed -E 's/OpenMerou-([0-9]+).*/\1/') for i in $(seq 1 30); do - out=$(ssh "$host" "cd $dir && fastlane ios beta_setup 2>&1" | grep -E "BUILD |A TESTER|EXTERNES|REVUE BETA") - if echo "$out" | grep -q "BUILD $build VALID" && echo "$out" | grep -q "REVUE BETA"; then echo "$out"; exit 0; fi + out=$(ssh "$host" "cd $dir && fastlane ios beta_setup 2>&1" | grep -E "BUILD |WHAT TO TEST|EXTERNAL|BETA REVIEW") + if echo "$out" | grep -q "BUILD $build VALID" && echo "$out" | grep -q "BETA REVIEW"; then echo "$out"; exit 0; fi sleep 45 done -echo "build $build pas encore traitée : relancer tools/wait-beta.sh $host $dir" +echo "build $build not processed yet: run tools/wait-beta.sh $host $dir again" exit 1