Main Site Documentation

N command


#1

I’m using the ALFAT USB Board.

Purpose is to read .JPG files in a folder and convert the embedded WGS84 coordinates to Lambert projection, which is a typical lineair Begian coordinate grid.

When opening the folder, I started with only reading the .JPG files name. See log below.
“Origi No WGS84” is the name of the folder containing the .JPG files. No problems here.

GHI Electronics, LLC

ALFAT SoC Processor
!00
J
!00
$20
!00

Stick attached
Mounting stick …
I U0:
!00
Stick mounted
@ U0:\Origi No WGS84
!00
N
!00
.
$30
$00000000
!00
N
!00

$10
$00000000
!00
N
!00
.DS_Store
$22
$00006004
!00
N
!00
._.DS_Store
$22
$00001000
!00
N
!00
_D4E3764.JPG
$20
$00513D61
!00
N
!00
_D4E3765.JPG
$20
$006882C6
!00
N
!00
_D4E3766.JPG
$20
$00765507
!00
N
!00
_D4E3767.JPG
$20
$006BE685
!00
N
!00
_D4E3768.JPG
$20
$006D333E
!00
N
!00
_D4E3769.JPG
$20
$0069BC40
!00
N
!00
_D4E3770.JPG
$20
$0064CD58
!00

But then I did the same including opening for reading and closing the file.
See Log file below.

GHI Electronics, LLC

ALFAT SoC Processor
!00
J
!00
$20
!00

Stick attached
Mounting stick …
I U0:
!00
Stick mounted
@ U0:\Origi No WGS84
!00
N
!00
.
$30
$00000000
!00
N
!00

$10
$00000000
!00
N
!00
.DS_Store
$22
$00006004
!00
N
!00
._.DS_Store
$22
$00001000
!00
N
!00
_D4E3764.JPG
$20
$00513D61
!00
O 1R>U0:\Origi No WGS84_D4E3764.JPG
!00
C 1
!00
N
!00
_D4E3780.JPG
$20
$006B19C3
!00
O 1R>U0:\Origi No WGS84_D4E3780.JPG
!00
C 1
!00
N
!00
_D4E3780.JPG
$20
$006B19C3
!00
O 1R>U0:\Origi No WGS84_D4E3780.JPG
!00
C 1
!00
N
!00
_D4E3780.JPG
$20
$006B19C3
!00
O 1R>U0:\Origi No WGS84_D4E3780.JPG
!00
C 1
!00
N
!00
_D4E3780.JPG
$20
$006B19C3
!00
O 1R>U0:\Origi No WGS84_D4E3780.JPG
!00
C 1
!00
N
!00
_D4E3780.JPG
$20
$006B19C3
!00
O 1R>U0:\Origi No WGS84_D4E3780.JPG
!00
C 1
!00
N
!00
_D4E3780.JPG
$20
$006B19C3
!00
O 1R>U0:\Origi No WGS84_D4E3780.JPG
!00
C 1
!00

As you can see, the ALFAT module first skipped 15 files and then always opened the same file.

What am I doing wrong?


#2

@ DLT -

You did correctly, just an explanation,

Because while you exploring a folder by N command, if you call O to open a handle, ALFAT will reset the pointer to start at beginning to make sure the file you wanted to open does exist or not. In your case, you open a file in same folder, but another user can open with different folder. So call @ again after you open to read, write a handle.

If you want to jump back right the file by N command before, this can be done in master by adding a little code, ALFAT doesn’t need to remember it.


#3

What do you mean by “this can be done in master by adding a little code, ALFAT doesn’t need to remember it.”?
My processor is “talking” with the ALFAT module via UART.


#4

He means your micro by saying master.


#5

Now I’m very confused. Probably because English is not my mother language.
What do you mean with “your micro by saying master.”?


#6

Let me see if I can clarify. I will replace the correct syntax in the following reprinted quote from Dat. The correction is in bold text:


#7

What he means is that you have code in your microcontroller. It is sending data to ALFAT. Make it have the intelligence, add to the code there. The ALFAT doesn’t persist a directory pointer when you open files, you should parse the directory, and explicitly open the file not rely on a moving pointer.


#8

Basically, like this:

BOOL JumpBackFile(String path, String filename)
{
         SendInitializeFolderCMD(path);// @ command
          while(  GetFileNameByNCommand() != filename 
         && GetFileNameByNCommand() != ErrorCodeEndOfFolder)
          {
                SendNCMD();
          }
         return TRUE or FALSE if not found;
}

After this funtion return TRUE, call N command will be jump to next file which is right after the file you wanted.
@ and N command return value very quick, so the speed won’t be a problem.

There are many CMD like rename file, Open file, find file, even delete file… so if we decide to implement, we have to do that for all command and this is not necessary , since it can be done and faster in master.