Before rushing off to buy a Toshiba Flashair SD+wifi card to use in your PAP machine you should read the other threads here about using a Flashair card, in particular this one:
Let me also say that I have a Resmed S9 Autoset, hence that is the only machine I have tried. Other machines probably store data on the SD card differently, so my script (later, below) will have to be modified. If you do so and get the script working with a different machine, please post back here how you did it for the benefit of others.
I should also point out that Apnea Board member Jack_Russell_fan has written a Windows utility that makes it simple. He has recently released a new version that will run under WINE. But I don't want to install a massive thing like WINE just to use one small app. Therefore I decided to figure out how to do it natively.
Before connecting you will want to make some changes to the default settings on the card. Settings are found in the file /SD_WLAN/CONFIG on the card, which you can access only if the card is mounted on your computer, so start by inserting the card into the SD card reader on your laptop or your USB card reader if your laptop doesn't have a card reader. This file is plain text, so open it in your favorite text editor (Gedit, Kate, etc.). Consider making the following changes:
#setting to zero disables the timeout, which I find preferable. You can also set it in milliseconds, to a maximum of 4294967294.
APPSSID= #enter here the name you want it to have on your network. The default on mine was flashair_123456789ap, which looks silly.
APPNETWORKKEY= #enter here the password to connect to the card. The default is 12345678. If you leave it blank the wifi will be open and anyone can connect to it. I left mine blank. Take note NSA: Send someone out to my house and you can download my CPAP data!
If you browse on "flashair" you can find the Toshiba Developers Forum, where these and other settings in the config file are explained.
While the card is still mounted on your computer you need to make sure you can connect to it. Here I am assuming you are using a laptop and that you are connecting at home to a wireless router. I am also assuming you are using network manager and that you have a network icon somewhere in your panel. (If you are using wicd instead of network manager you can translate this paragraph to its options.) Click on the network icon (right-click on some desktops) and you will see a list of available wireless networks, and you will see that you are currently connected to your wireless router. You should also see the Flashair; if not, open a terminal and do sudo "ifconfig wlan0 down," followed by "sudo ifconfig wlan0 up." If you get an error message that it can't find wlan0 enter just "ifconfig" to see what your network device is. Repeat using the correct device name instead of wlan0.
If you select the Flashair your wireless chip will automatically disconnect from your wireless router and then connect to the Flashair.
[Side comment: If you are connected via ethernet you will have to disconnect it before you can connect to the Flashair.]
The stupid part
Assuming things went according to plan you should now be connected to the Flashair. Unfortunately, Toshiba made the lame decision to present all files in html instead of using a simple FTP server. So to see what is on the card open a browser tab and put 192.168.0.1 in the URL bar. You should see a lovely display of the files on the card. Before going further use your browser's "view source" option. This will show how the filenames are scattered all over the html code. Close the source window; I only wanted you to see what a mess Toshiba made of things by deciding to use html to present the files. Oh, and if that wasn't bad enough, Toshiba also hardwired the card to be 192.168.0.1 and you can't change it. That was the address of my home router so I had to change my home router's address before I could continue.
Using the Flashair in your CPAP machine
You are now ready to put the Flashair in your CPAP machine, but be prepared for more stupidity, this time thanks to the manufacturer of your machine. As I expected, when I put the Flashair into my S9 Autoset the machine immediately asked me if I wanted to "erase" the card. Don't worry, it won't wipe out the wireless capability, so let it go ahead. It erases the card, plus it adds the folder DATALOG, and also adds some files so that it will recognize it in the future. Unfortunately, my S9 Autoset is so lame that if I take the card out of the machine and put it back in again the machine will still insist that it needs to "erase" the card. This will wipe out previous data, so once the machine is happy with the card, don't ever take it out again.
You should take a moment at this point and go to your computer to make sure it can still see the card. The official range is 10m, but mine is about 15m away with a floor in between, and I can still connect to it. although the connection is a bit slow.
Now you have to spend a night so the machine will record some data on the card.
Retrieving the data
The next morning just get up as usual, but leave the card in the machine. Go to your computer where you are going to create a shell script. Open a new blank text document and paste in the following:
wget -qO - http://192.168.0.1/DATALOG | grep 'DATALOG.*fname' | sed -e "s/^.*fname\"\:\"//" -e "s/\", \"fsize.*//" | while read line; do cd /home/jjj/CPAP/Resmed/DATALOG; wget -nc "http://192.168.0.1/DATALOG/$line";done
I created the folder CPAP/Resmed/DATALOG on my computer. The S9 Autoset saves eight files every day to the DATALOG folder that it created on the card, and that is where SleepyHead will expect to find them. Make the folder anywhere you want on your computer, but be sure to make a DATALOG folder inside it, and then change the script above to reflect your folder.
Save the script somewhere, calling it "Flashair script" or whatever you want to call it. With your file browser right click on it and select Properties, then the Permissions tab, and set it to Executable. (Or do it from the command line if you prefer.) Now you are ready for the big moment. Open a file browser with a view of the DATALOG folder on your computer. Execute the script. You should see eight files appear in the folder. And now point SleepyHead at the folder (the Resmed folder if you used my folder format, not the DATALOG folder).
Did it work? In the interests of improving this tutorial, please report back with problems and how you solved them. Other comments are welcome as well.