📜 ⬆️ ⬇️

A perverted approach to using the mouse when creating a tiflopler



Have you ever come across a situation in which you need to urgently accomplish some task, but you do not have the necessary knowledge for this? Knowledge, of course, can be gained, but what if there may not be enough time for this as part of this task? And often you can lean against the lack of finance, equipment or the ability to purchase the necessary things. In such situations, you just have to look around - sometimes the most banal and primitive things can become the key to realization.

Introduction


To begin with - what is tiflopleer? Tiflopleer - a special player that allows you to play (some models - and record) audio books for the blind and visually impaired.

Actually, what did I need it for? It so happened that my mom's parents see almost nothing at the moment. On this, they all have their own reasons and sad stories and they are not for this place. Besides the fact that it is absolutely terrible in everyday life, it also took away from them the opportunity to do one of the most favorite things - to read. They lost their sight not synchronously and initially dealt with this problem in their own way. But then this opportunity disappeared. Then it was decided to download audiobooks and listen to them on all sorts of players / speakers / tape recorders using flash drives or sd cards. But over time, unpleasant details were discovered in these devices - when the flash drive or card was rearranged, the player often believed that it was the same and started a new book from the place where he finished the old one. And so it happened with all purchased, even with those that are expensive. And the machinations with cards and flash drives are not the easiest for those who do not see. Therefore, being a “programmer”, I tried to fix it.
')

"Hardware" implementation


It was obvious that in the created system it is necessary to record the time and the file of the end of the last book. Well, nothing more. By myself, I program in C #, but at that moment microcomputers like the Raspberry Pi were gaining popularity. Actually from the raspberry and began. But, either because of my terrible laziness, or because of the lack of knowledge in that area, I didn’t work out (it was a long time ago, now I understand how insignificant it was a task). Then I tried different options, and from the other side. There was also a hdmi media player and other toys in this style, but everything didn’t add up. Every day, in principle, it came to the realization that 89 years is not 19, and I have every day counts. I had to decide on a quick and angry option.

Actually, speed and anger were moving towards C # and Windows. But it was necessary to find some kind of device on Windows. Minicomputers with Windows are sometimes found, but they are expensive and they do not always give a complete set of what was necessary (well, there was no time to deal with the nuances), so after certain frauds it was decided to use an old netbook. In order for a weakly seeing person to be able to turn it on, it took a couple of handicraft improvements. A large red button was soldered instead of a power button.



Then the most important question arose - controls. The mouse is too hard, the keyboard all the more. Ayr stik with mediaplayer worked fine, but would also be complicated. And so, once, thinking about it to everyone in a conversation with a colleague, I realized that the mouse is the ideal option in my situation. That is not quite a mouse, but its buttons.

Based on the idea, it was necessary to have 7 functions:

  1. Play
  2. Pause
  3. Next track (part of the book)
  4. Previous track (part of the book)
  5. Next book
  6. Previous book
  7. Volume control

In fact, I needed a mouse on 6 buttons. After the analysis, as well as the understanding of the fact that C # processes only 5 buttons (I didn’t really try to figure out how to solve this issue, since 5 is enough), the first two points were combined. And for the volume was used wheel.

Actually, I quickly found the mouse - for 360 UAH (I don’t even know how much it was in dollars) in a store near work. The company initially did not inspire confidence that, in fact, let me down a little. The whole point of such a purchase was in the next idea - to solder the mouse to fit my buttons (unfortunately, I never learned how to write drivers for my devices) and use it without problems as a remote control.

Then I went to the radio market, to a large hardware store - I received large multi-colored buttons, and a bunch of improvised means from which I planned to make a console. Total - not very well with the appearance (in the figure "remote" with the improvised means from which it was made). I think if there would be more patience and forethought, this option would not be so bad, but something went wrong.



To my luck, it so happened that one good person worked in a design studio, where I could cut out what I needed from wood. A couple of days later I received a beautiful box. Unfortunately, we did not understand each other a little, and it was left without a cover for the battery compartment. But these are trifles (although this issue has not yet been resolved). Then there was a lot of soldering / cutting / glueing work. I simply soldered the buttons instead of the mouse buttons (not without problems, because of the quality of the board).



I took a piece of rack, cut out the battery compartment in it. Compartment for batteries connected to the toggle switch. So that more and more obvious. I took the second piece and cut out the base for the wheel. With this in the end, I had problems - I broke a rod with him by shoving him into an unfinished board. I tried to put the potentiometer in there somehow, but something didn’t happen. I had to look for another wheel, but it also turned out to be not so easy, so I took the rod from the engraver's used nozzles and gave them shape (very curved, but it worked). As a result, I received a full volume button (even if it is spinning with effort).









"Software" implementation


All that remains to be done is to write a program. As I suspected, it took about 20 minutes. The algorithm (although rather simply general statements on how it works) is as follows:

  1. In a specially crammed folder (crutches) we look for folders with books (even the nesting of folders works here).
  2. Each book has an audio file header (recorded on a microphone or cut from the beginning of the book).
  3. All this is shown on the monitor in large contrast letters (even the monitor is there, although there is not much point in it)
  4. When it all works, the active book reads its name an infinite number of times until the user switches to another book, or turns on the active one.
  5. If the book is paused or stopped, or switched to another without stopping, it is written to the log file from which it will be read the next time the book is turned on (for that it was all).
  6. Well, also - to add a book, you need to insert a flash drive and select a folder with a book. That does not look hard, even when you come to visit every half a year

Listing the program will not show. In fact, there is essentially no special meaning, special complexity, design patterns and the rest. The lines of code that make sense there are 60 pieces, 25 of which are the generated xaml code. Although if suddenly someone needs it - I can add.

But I think I need to say a few words about how it all lives in Windows - several registry keys allow you to run the application instead of explorer.exe. The window properties are maxemized, topmost = true. That's all. All extra services are disabled, not a hint of antivirus and update service - just what you need (in principle, this is how most service machines work).

Total something like this came out:



Instead of conclusion


Those to whom it was intended were very pleased. Yes, and it turned out that I had guessed quite a lot about the appearance - all the big buttons and controls, the weight and size of the box, contributed to the fact that everything was intuitive (I heard it that way). It is also quite obvious where the top is, where is the bottom, and the console itself, like the power button, is hard to lose.

In general, that's all. Thanks for attention.

Source: https://habr.com/ru/post/368793/


All Articles