Модуль "ObexFM" (часть 12) - SetPath
последняя версия: 3.0.9 build 961 beta
от 07 декабря 2007 г.
от 07 декабря 2007 г.
procedure TfrmOBEXFM.SetPath(s: ShortString); var c, len: word; pw: array [0..255] of WideChar; frmProgress: tfrmProgress; si: integer; sb: string;
begin
frmProgress:= TfrmProgress.Create(self);
if OBEX_Opened=False then exit;
// Predefined command: jump to parent folder
Logger('SetPath: ' + s);
if s='..'
then
begin
xCurentDir:= xCurentDir - 1;
if xCurentDir < 0 then exit;
if iOBEXType = 0 then for c:=0 to 9 do Buffer[c]:=byte(PatternDir[c])
else for c:=0 to 9 do Buffer[c]:=byte(PatternDir2[c]);
// Set little bitmask for parent jump. W/o this bit request equals to "Root" SETPATH.
Buffer[3]:=$03;
BufLen:=10;
sb:= '';
for si:= 0 to BufLen-1 do sb:= sb + IntToHex(Buffer[si], 2) + ' ';
Logger('=== OBEX_SendCommand (write): ' + sb);
OBEX_SendCommand(0, frmProgress);
exit;
end;
// Predefined command: jump to root folder
if s='/'
then
begin
xCurentDir:= 0;
if iOBEXType = 0 then for c:=0 to 12 do Buffer[c]:=byte(RootDir[c])
else for c:=0 to 12 do Buffer[c]:=byte(RootDir2[c]);
BufLen:=13;
sb:= '';
for si:= 0 to BufLen-1 do sb:= sb + IntToHex(Buffer[si], 2) + ' ';
Logger('=== OBEX_SendCommand (write): ' + sb);
OBEX_SendCommand(0, frmProgress);
exit;
end;
if xCurentDir < 0 then begin frmProgress.Free; exit; end;
if iOBEXType = 0 then for c:=0 to 9 do Buffer[c]:=byte(PatternDir[c])
else for c:=0 to 9 do Buffer[c]:=byte(PatternDir2[c]);
BufLen:=10;
if s<>'..'
then
begin
xCurentDir:= xCurentDir + 1;
len:=10 + 3 + Length(s)*2 + 2;
BufLen:=len;
Buffer[1]:=len div 256;
Buffer[2]:=len mod 256;
Buffer[10]:=$01;
len:=3 + Length(s)*2 + 2;
Buffer[11]:=len div 256;
Buffer[12]:=len mod 256;
FillChar(Buffer[13],255,#0);
StringToWideChar(s,@pw,256);
for c:=1 to Length(s) do
begin
//Buffer[12+i*2-1]:=word(pw[i-1]) div 256;
//Buffer[10+i*2]:=word(pw[i-1]) mod 256;
Buffer[12+c*2-1]:=word(pw[c-1]) div 256;
Buffer[12+c*2]:=word(pw[c-1]) mod 256;
end;
{for c:=1 to Length(s) do
begin
Buffer[12+c*2-1]:=$00;
Buffer[12+c*2]:=byte(s[c]);
end;}
Buffer[12+Length(s)*2+2-1]:=$00;
Buffer[12+Length(s)*2+2]:=$00;
end;
sb:= '';
for si:= 0 to BufLen-1 do sb:= sb + IntToHex(Buffer[si], 2) + ' ';
Logger('=== OBEX_SendCommand (write): ' + sb);
OBEX_SendCommand(0, frmProgress);
frmProgress.Free;
end;
Еще записи по теме
- Модуль "ObexFM" (часть 20) - droptophone
- Модуль "P2KApi" (часть 73) - TP2KAPI.GetVERSION
- Модуль "Стили звонка" (часть 5) - GetMelodiesFromPhone
- Модуль "Flash_SHX" (часть 5) - FlashFirmware
- Модуль "Календарь" (часть 25) - DateBookRestore2
- Модуль "АТ-команды" (часть 10) - GetPlatform_AT
- Модуль "Пункты меню" (часть 29) - EditItem
