Reading a raw data from SD Card
-
10 aprilie 2012 06:18
Dear all, I am developing the project to read raw data from the 2GB SD Card in C#. My Task is to read raw data from sd-card then put it in the structure and upload it to the data base and then generate the excel files from the data base based on the user inputs. I have searched a lot on the google to get some useful information on how to read raw data from sd card. But i could not found useful one. Can some one give me the right direct on the reading the sd-card raw data.
Thanks a lot.
regards
wep1
I am trying to read the raw data from sd card on PC side.- Editat de wep1 10 aprilie 2012 06:28
Toate mesajele
-
10 aprilie 2012 06:19
Dear all, I am developing the project to read raw data from the 2GB SD Card in C#. My Task is to read raw data from sd-card then put it in the structure and upload it to the data base and then generate the excel files from the data base based on the user inputs. I have searched a lot on the google to get some useful information on how to read raw data from sd card. But i could not found useful one. Can some one give me the right direct on the reading the sd-card raw data.
Thanks a lot.
regards
wep1
- Mutat de CoolDadTxMVP, Moderator 10 aprilie 2012 17:04 Not IDE related (From:Visual C# IDE)
- Îmbinat de Bob ShenMicrosoft Contingent Staff, Moderator 12 aprilie 2012 03:10 duplicate
-
10 aprilie 2012 07:28
You need to P/Invoke CreateFile, see the paragraph about Physical Disks and Volumes.- Marcat ca răspuns de Bob ShenMicrosoft Contingent Staff, Moderator 23 aprilie 2012 04:28
-
10 aprilie 2012 12:30
Hi wep1.
can you describe the requirements in more detail?
I would expect that any system would use a SD card as a regulard disk and just places a file with raw data on the file system. But from what you wrote it could be understood in a way, that no filesystem is used at all and the data is directly written on the SD disk.
Could you please clarify this point?
In general, you can have these solutions:
1st) This is easy because you are opening the file and read it. The data must be taken in the correct format (which must be specified of course!).
2nd) Thius is a little harder. The core solution in here is to use P/Invoke and then call some functions like CreateFile (http://msdn.microsoft.com/en-us/library/aa363858.aspx).
If you provide more information we could point your further on how to read the file or device.
With kind regards,
Konrad
- Marcat ca răspuns de Bob ShenMicrosoft Contingent Staff, Moderator 23 aprilie 2012 04:28
-
16 aprilie 2012 09:49
Hi Konrad,
Thanks a lot for your reply. I have a SD card which has used in retail billing machine. While doing the all kind of billing, the all data is stored in SD card. That SD card data i have to get on the PC. I am directly trying to access data from SD card on the PC. Their i have to generate the report. But I am not able to read the SD card data itself. Could you please get the sample source code for the same. By the way you are right Konrad, While writing data to the SD card their is not file system available. We are just dumping hex data to the SD card. Please get me some help on the same. Thanks a lot.
Best regards
WeP1
-
16 aprilie 2012 11:13
Hi,
I think there might be multiple parts you are interested in:
a) It could be important that your applications is aware of new devices or the removal of devices. There is a project on CodeProject which demonstates how this could work:
http://www.codeproject.com/Articles/18062/Detecting-USB-Drive-Removal-in-a-C-Program
b) next you might want to read the device. From my point of view, CreateFile is the method you should use. The documentation of that function can be found at http://msdn.microsoft.com/en-us/library/aa363858.aspx. PInvoke.net has the signature: http://pinvoke.net/default.aspx/kernel32/CreateFile.html. To Read, ReadFile could be used: http://pinvoke.net/default.aspx/kernel32.ReadFile. Do not forget to close handles that you opened!
With the parts of a and b you should be able to build up your solution. The When the device is inserted, you will get a message which also includes the Dive Name / Path. So you can use that open it and read from it. If you know the name, you can use that directly, too. (I didn't check for a way to list all devices right now.)
With kind regards,
Konrad
- Marcat ca răspuns de Bob ShenMicrosoft Contingent Staff, Moderator 23 aprilie 2012 04:28
-
16 aprilie 2012 17:20
Please check following link it may be useful to you.
http://www.techimo.com/forum/general-tech-discussion/206607-reading-raw-data-off-sd-mmc-card.html
http://www.codeproject.com/Articles/18062/Detecting-USB-Drive-Removal-in-a-C-Program
http://www.pcreview.co.uk/forums/can-read-sd-card-id-similar-information-t3548762.html
- Marcat ca răspuns de Bob ShenMicrosoft Contingent Staff, Moderator 23 aprilie 2012 04:28