Tüm Platformlar için Hızlı Uygulama Geliştirme --->    Kitabımız...      Delphi

Konuyu Paylaş : facebook gplus twitter

Konuyu Oyla:
  • Derecelendirme: 3/5 - 1 oy
  • 1
  • 2
  • 3
  • 4
  • 5
Android ADB USB üzeri cihaz bilgilerini okuma
#1
Android ADB USB üzeri cihaz bilgilerini okuma

69068k.png


function IsWinNT: boolean;
var
  OSV: OSVERSIONINFO;
begin
  OSV.dwOSVersionInfoSize := sizeof(osv);
  GetVersionEx(OSV);
  result := OSV.dwPlatformId = VER_PLATFORM_WIN32_NT;
end;
 function Shell(Cmd: string): string;
var
  Buffer: array[0..10096] of Char;
  si: STARTUPINFO;
  sa: SECURITY_ATTRIBUTES;
  sd: SECURITY_DESCRIPTOR;
  pi: PROCESS_INFORMATION;
  newstdin, newstdout, read_stdout, write_stdin: THandle;
  exitcod, bread, avail: Cardinal;
  Str: string;
begin

  Result:= '';
SetCurrentDir(ExtractFilePath(Application.ExeName));
  if IsWinNT then
  begin
    InitializeSecurityDescriptor(@sd, SECURITY_DESCRIPTOR_REVISION);
    SetSecurityDescriptorDacl(@sd, true, nil, false);
    sa.lpSecurityDescriptor := @sd;
  end
  else sa.lpSecurityDescriptor := nil;
  sa.nLength := sizeof(SECURITY_ATTRIBUTES);
  sa.bInheritHandle := TRUE;
  if CreatePipe(newstdin, write_stdin, @sa, 0) then
  begin
    if CreatePipe(read_stdout, newstdout, @sa, 0) then
    begin
      GetStartupInfo(si);
      with si do
      begin
        dwFlags := STARTF_USESTDHANDLES or STARTF_USESHOWWINDOW;
        wShowWindow := SW_HIDE;

        hStdOutput := newstdout;
        hStdError := newstdout;
        hStdInput := newstdin;
      end;
      Fillchar(Buffer, SizeOf(Buffer), 0);
      GetEnvironmentVariable('COMSPEC', @Buffer, SizeOf(Buffer) - 1);
      StrCat(@Buffer,PChar(' /c ' + cmd));
      if CreateProcess(nil, @Buffer, nil, nil, TRUE, CREATE_NEW_CONSOLE, nil, nil, si, pi) then
      begin
        Str:= #13;
        WriteFile(write_stdin,PChar(Str)^,Length(Str),bread,nil);
        repeat
          PeekNamedPipe(read_stdout, @Buffer, SizeOf(Buffer) - 1, @bread, @avail, nil);
          if bread > 0 then
          begin
            Fillchar(Buffer, SizeOf(Buffer), 0);
            ReadFile(read_stdout, Buffer, bread, bread, nil);
            Result:= Result + String(PChar(@Buffer));
          end;
          GetExitCodeProcess(pi.hProcess, exitcod);
        until (exitcod <> STILL_ACTIVE) and (bread = 0);
      end;
      CloseHandle(read_stdout);
      CloseHandle(newstdout);
    end;
    CloseHandle(newstdin);
    CloseHandle(write_stdin);
  end;
  end;
//*********************************************************************************
Function getbeetwen( text, ilk, son:String ): String;
begin
   Delete(Text, 1, pos(ilk, Text) + Length(ilk)-1);
   Result := Copy(Text, 1, Pos(Son, Text)-1);
end;
//****************************************************************************
procedure TForm1.readinfo;
var  devicetype , imei, chk, cihaz_ara : String;
begin
begin
txtlog('Cihaz Aranıyor...  ');
 txtlog.Clear;
cihaz_ara :=(Shell('adb get-state'));
 if pos('unknown',cihaz_ara)>0 then  begin
 txtlog('Cihaz bulunmadı !');
 end
 else
txtlog('Cihaz Bulundu !');
txtlog('Reading Info............');
  txtlog(AnsiUpperCase(Trim('Manufacturer  :  '+(Shell('adb shell getprop ro.product.brand')))));
  txtlog(AnsiUpperCase(Trim('Hardware  :  '+(Shell('adb shell getprop ro.hardware')))));
  txtlog(AnsiUpperCase(Trim('Model  :  '+(Shell('adb shell getprop ro.product.model')))));
  txtlog(AnsiUpperCase(Trim('BaseBand  :  '+(Shell('adb shell getprop ro.boot.baseband')))));
  txtlog(AnsiUpperCase(Trim('Board  :  '+(Shell('adb shell getprop ro.product.board')))));
  txtlog(AnsiUpperCase(Trim('Version  :  '+(Shell('adb shell getprop ro.build.version.release')))));
  chk:=Shell('adb shell dumpsys iphonesubinfo');
  devicetype:=getbeetwen(chk, 'Type =', 'Device');
  imei:=copy(chk,62,15);
  txtlog(AnsiUpperCase(Trim('Device Type : '+devicetype)));
  txtlog(AnsiUpperCase(Trim('Country Code  :  '+(Shell('adb shell getprop ro.build.target_country')))));
  txtlog(AnsiUpperCase(Trim('Connection Mode  :  '+(Shell('adb shell getprop sys.usb.config')))));
  txtlog(AnsiUpperCase(Trim('IMEI : '+imei)));
end;

procedure TForm1.txtlog(s: string);
begin
Memo1.Lines.Add(s);
end;
//*********************************************************************************
procedure TForm1.Button1Click(Sender: TObject);
begin
readinfo;
end;
WWW
Cevapla
#2
Sizlerden ricam bu konuda biraz daha bilgi örnek varsa paylaşırmısınız. Benim için çok önemli..  Verdiğiniz örneği test etmek istedim fakat dönen bilgiler çince olarak döndü bunu nasıl değiştirebiliriz. Sorun nerede ?

Birde kodunuzda gözden kaçan ufak bir yazım hatası olduğunu kullanacak arkadaşlara hatırlatmak isterim. Çift begin  var. kullanmadan önce birini silin.
procedure TForm1.readinfo;
var  devicetype , imei, chk, cihaz_ara : String;
begin
begin
txtlog('
Cevapla
#3
(27-11-2017, Saat: 01:36)Lord_Ares Adlı Kullanıcıdan Alıntı: Linkleri Görebilmeniz İçin Giriş yap veya Üye OlSizlerden ricam bu konuda biraz daha bilgi örnek varsa paylaşırmısınız. Benim için çok önemli..  Verdiğiniz örneği test etmek istedim fakat dönen bilgiler çince olarak döndü bunu nasıl değiştirebiliriz. Sorun nerede ?

Birde kodunuzda gözden kaçan ufak bir yazım hatası olduğunu kullanacak arkadaşlara hatırlatmak isterim. Çift begin  var. kullanmadan önce birini silin.
procedure TForm1.readinfo;
var  devicetype , imei, chk, cihaz_ara : String;
begin
begin
txtlog('

Merhaba, 

adb harici exe kullanarak bağlantı sağlanıyor, 
shell komutlarıyla cihazdan bilgi döndürebilirsiniz, aynı Linux gibi, 
Memo1.Lines.Add('adb shell getprop'); 
Tüm bilgileri listeleyecektir. 

[persist.radio.defdataSIMchange]: [true]
[persist.radio.initphone-type]: [1]
[persist.radio.multisim.config]: [dsds]
[persist.radio.plmnname_1]: [VODAFONE TR]
[persist.radio.plmnname_2]: []
[persist.radio.sib16_support]: [0]
[persist.radio.silent-reset]: [8]
[persist.radio.ss.voiceclass_1]: [false]
[persist.radio.ss.voiceclass_2]: [false]
[persist.radio.user.change]: [1]
[persist.ril.ims.eutranParam]: [0]
[persist.ril.ims.pdnFailCause]: [0]
[persist.ril.ims.utranParam]: [0]
[persist.ril.modem.board]: [SHANNON315]
[persist.ril.modem.board2]: [SHANNON315]
[persist.ril.xcap.pdnFailCause]: [0]
[persist.security.ams.enforcing]: [3]
[persist.security.tlc.ccm]: [0]
[persist.security.tlc.otp]: [0]
[persist.security.tlc.tui]: [1]
[persist.service.bdroid.version]: [4.2]
[persist.sys.SUWRebootReason]: []
[persist.sys.ccm.date]: [Tue Sep  6 23:48:18 KST 2016]
[persist.sys.clssprld1]: [1020]
[persist.sys.clssprld2]: [485]
[persist.sys.country]: []
[persist.sys.dalvik.vm.lib.2]: [libart.so]
[persist.sys.drs.date]: [Tue Sep  6 23:48:18 KST 2016]
[persist.sys.kap.date]: [Tue Sep  6 23:48:18 KST 2016]
[persist.sys.kap.status]: [NONE]
[persist.sys.language]: []
[persist.sys.locale]: [tr-TR]
[persist.sys.localedefault]: [vi-VN]
[persist.sys.localevar]: []
[persist.sys.profiler_ms]: [0]
[persist.sys.setupwizard]: [FINISH]
[persist.sys.silent]: [0]
[persist.sys.sm_mode]: [1]
[persist.sys.storage_preload]: [2]
[persist.sys.timezone]: [Europe/Istanbul]
[persist.sys.usb.config]: [mtp,adb]
[persist.sys.webview.vmsize]: [104857600]
[persist.usb.eng]: [2]
[qcom.bluetooth.soc]: [rome]
[ril.CompleteMsg]: [OK]
[ril.ICC_TYPE]: [2,0]
[ril.RildInit]: [1,1]
[ril.approved_codever]: [none]
[ril.approved_cscver]: [none]
[ril.approved_modemver]: [none]
[ril.atd_status]: [2_0_0]
[ril.backoffstate]: [1024]
[ril.cbd.boot_done]: [1]
[ril.cbd.dt_revision]: [007]
[ril.cbd.rfs_check_done]: [1]
[ril.clatd.v4-wlan0]: [down]
[ril.cs_svc]: [1]
[ril.dds.command_slot]: [0]
[ril.dds.progressing]: [0]
[ril.ecclist00]: [112,911]
[ril.ecclist10]: [112,911]
[ril.ecclist_net0]: []
[ril.hasisim]: [1,0]
[ril.hw_ver]: [MP0.400]
[ril.hw_ver2]: [MP0.400]
[ril.ims.ecsupport]: [2]
[ril.ims.ltevoicesupport]: [2]
[ril.initPB]: [1]
[ril.isIccChanged]: [0]
[ril.model_id]: [QB4991678]
[ril.model_id2]: [QB4991678]
[ril.modem.board]: [SHANNON315]
[ril.modem.board2]: [SHANNON315]
[ril.modem.lte.powercontrol]: [on]
[ril.nitz.savedattime]: [524465435]
[ril.official_cscver]: [J710FOLB1APE2]
[ril.product_code]: [SM-J710FZDUXXV]
[ril.product_code2]: [SM-J710FZDUXXV]
[ril.radiostate]: [0]
[ril.rfcal_date]: [20161029]
[ril.rfcal_date2]: [20161029]
[ril.serialnumber]: [R58HA5TBN8D]
[ril.servicestate]: [0,3]
[ril.sib16.last.systemTime]: [1511957340976]
[ril.ss.routing]: [0]
[ril.subinfo]: [0:1,1:2147483644]
[ril.sw_ver]: [J710FXXU1API3]
[ril.sw_ver2]: [J710FXXU1API3]
[ril.timezoneID]: [Europe/Istanbul]
[ril.voice.rat]: [3]
[rild.libpath]: [/system/lib/libsec-ril.so]
[rild.libpath2]: [/system/lib/libsec-ril-dsds.so]
[ro.adb.qemud]: [1]
[ro.adb.secure]: [1]
[ro.allow.mock.location]: [0]
[ro.arch]: [exynos7870]
[ro.astcenc.astcsupport]: [1]
[ro.baseband]: [unknown]
[ro.board.platform]: [exynos5]
[ro.boot.boot_salescode]: []
[ro.boot.bootloader]: [J710FXXU1API3]
[ro.boot.debug_level]: [0x4f4c]
[ro.boot.emmc_checksum]: [3]
[ro.boot.hardware]: [samsungexynos7870]
[ro.boot.hmac_mismatch]: [0]
[ro.boot.hw_rev]: [7]
[ro.boot.odin_download]: [1]
[ro.boot.sec_atd.tty]: [/dev/ttySAC2]
[ro.boot.security_mode]: [1526595584]
[ro.boot.selinux]: [enforcing]
[ro.boot.serialno]: [5203092d439e93e3]
[ro.boot.ucs_mode]: [0]
[ro.boot.warranty_bit]: [1]
[ro.boot_recovery]: [unknown]
[ro.bootimage.build.date]: [Tue Sep 6 23:50:50 KST 2016]
[ro.bootimage.build.date.utc]: [1473173450]
[ro.bootimage.build.fingerprint]: [samsung/j7xeltexx/j7xelte:6.0.1/MMB29K/J710F
XU1API3:user/test-keys]
[ro.bootloader]: [J710FXXU1API3]
[ro.bootmode]: [unknown]
[ro.bt.bdaddr_path]: [/efs/bluetooth/bt_addr]
[ro.build.PDA]: [J710FXXU1API3]
[ro.build.changelist]: [7686600]
[ro.build.characteristics]: [phone]
[ro.build.date]: [Tue Sep  6 23:48:18 KST 2016]
[ro.build.date.utc]: [1473173298]
[ro.build.description]: [j7xeltexx-user 6.0.1 MMB29K J710FXXU1API3 release-keys

[ro.build.display.id]: [MMB29K.J710FXXU1API3]
[ro.build.fingerprint]: [samsung/j7xeltexx/j7xelte:6.0.1/MMB29K/J710FXXU1API3:u
er/release-keys]
[ro.build.flavor]: [j7xeltexx-user]
[ro.build.hidden_ver]: [J710FXXU1API3]
[ro.build.host]: [SWDD6517]
[ro.build.id]: [MMB29K]
[ro.build.official.release]: [true]
[ro.build.product]: [j7xelte]
[ro.build.scafe.cream]: [white]
[ro.build.scafe.shot]: [double]
[ro.build.scafe.size]: [short]
[ro.build.scafe.version]: [2016A]
[ro.build.selinux]: [1]
[ro.build.selinux.enforce]: [1]
[ro.build.tags]: [release-keys]
[ro.build.type]: [user]
[ro.build.user]: [dpi]
[ro.build.version.all_codenames]: [REL]
[ro.build.version.base_os]: []
[ro.build.version.codename]: [REL]
[ro.build.version.incremental]: [J710FXXU1API3]
[ro.build.version.preview_sdk]: [0]
[ro.build.version.release]: [6.0.1]
[ro.build.version.sdk]: [23]
[ro.build.version.sdl]: [2301]
[ro.build.version.security_patch]: [2016-09-01]
[ro.carrier]: [unknown]
[ro.chipname]: [exynos7870]
[ro.com.google.clientidbase]: [android-samsung]
[ro.com.google.gmsversion]: [6.0_r6]
[ro.config.alarm_alert]: [Morning_Flower.ogg]
[ro.config.dmverity]: [true]
[ro.config.kap]: [true]
[ro.config.knox]: [v30]
[ro.config.media_sound]: [Media_preview_Touch_the_light.ogg]
[ro.config.notification_sound]: [Skyline.ogg]
[ro.config.notification_sound_2]: [S_Charming_Bell.ogg]
[ro.config.ringtone]: [Over_the_Horizon.ogg]
[ro.config.ringtone_2]: [Basic_Bell.ogg]
[ro.config.rkp]: [true]
[ro.config.rm_preload_enabled]: [0]
[ro.config.tima]: [1]
[ro.config.timaversion]: [3.0]
[ro.cp_debug_level]: [unknown]
[ro.crypto.default.encrypted]: [true]
[ro.crypto.fs_crypto_blkdev]: [/dev/block/dm-0]
[ro.crypto.fuse_sdcard]: [true]
[ro.crypto.state]: [encrypted]
[ro.crypto.type]: [block]
[ro.csc.country_code]: [VIETNAM]
[ro.csc.countryiso_code]: [VN]
[ro.csc.sales_code]: [XXV]
[ro.dalvik.vm.native.bridge]: [0]
[ro.debug_level]: [0x4f4c]
[ro.debuggable]: [0]
[ro.emmc_checksum]: [3]
[ro.error.receiver.default]: [com.samsung.receiver.error]
[ro.expect.recovery_id]: [0xd5170c5c0715dd54cace720af981ceb1e0c2979b00000000000
000000000000]
[ro.fmp_config]: [unknown]
[ro.frp.pst]: [/dev/block/persistent]
[ro.hardware]: [samsungexynos7870]
[ro.hdcp2.rx]: [tz]
[ro.hmac_mismatch]: [0]
[ro.hwui.drop_shadow_cache_size]: [2]
[ro.hwui.fbo_cache_size]: [8]
[ro.hwui.gradient_cache_size]: [0.5]
[ro.hwui.layer_cache_size]: [16]
[ro.hwui.path_cache_size]: [4]
[ro.hwui.r_buffer_cache_size]: [2]
[ro.hwui.shape_cache_size]: [1]
[ro.hwui.text_large_cache_height]: [1024]
[ro.hwui.text_large_cache_width]: [2048]
[ro.hwui.text_small_cache_height]: [512]
[ro.hwui.text_small_cache_width]: [1024]
[ro.hwui.texture_cache_flushrate]: [0.4]
[ro.hwui.texture_cache_size]: [24]
[ro.im.param.offset]: [unknown]
[ro.kernel.qemu]: [0]
[ro.kernel.qemu.gles]: [1]
[ro.mct.compressiontype]: [ETC1]
[ro.me.param.offset]: [unknown]
[ro.multisim.simslotcount]: [2]
[ro.nfc.port]: [I2C]
[ro.opengles.version]: [196608]
[ro.pr.param.offset]: [unknown]
[ro.product.board]: [universal7870]
[ro.product.brand]: [samsung]
[ro.product.cpu.abi]: [armeabi-v7a]
[ro.product.cpu.abi2]: [armeabi]
[ro.product.cpu.abilist]: [armeabi-v7a,armeabi]
[ro.product.cpu.abilist32]: [armeabi-v7a,armeabi]
[ro.product.cpu.abilist64]: []
[ro.product.device]: [j7xelte]
[ro.product.locale]: [en-GB]
[ro.product.manufacturer]: [samsung]
[ro.product.model]: [SM-J710F]
[ro.product.name]: [j7xeltexx]
[ro.product_ship]: [true]
[ro.revision]: [7]
[ro.ril.gprsclass]: [10]
[ro.ril.hsxpa]: [1]
[ro.rtn_config]: [unknown]
[ro.runtime.firstboot]: [1511432917982]
[ro.sec.fle.encryption]: [true]
[ro.secure]: [1]
[ro.securestorage.support]: [true]
[ro.security.icd.flagmode]: [multi]
[ro.security.reactive.version]: [2.0.9]
[ro.security_mode]: [1526595584]
[ro.serialno]: [5203092d439e93e3]
[ro.setupwizard.mode]: [OPTIONAL]
[ro.sf.lcd_density]: [320]
[ro.sku.param.offset]: [unknown]
[ro.sn.param.offset]: [unknown]
[ro.telephony.default_network]: [9]
[ro.vold.forceencryption]: [1]
[ro.warranty_bit]: [1]
[ro.wifi.channels]: []
[ro.zygote]: [zygote32]
[rw.km_fips_status]: [ready]
[sec.fle.encryption.status]: [Dec NewFile IncludeMedia]
[security.mdpp.mass]: [skmm]
[selinux.policy_version]: [SEPF_SECMOBILE_6.0.1_0010]
[selinux.reload_policy]: [1]
[service.bootanim.exit]: [0]
[service.brcm.fm.start_mute]: [255]
[service.camera.rec.running]: [0]
[service.camera.running]: [0]
[service.media.powersnd]: [1]
[storage.mmc.size]: [15758000128]
[sukernel.mount]: [1]
[supolicy.loaded]: [1]
[sys.boot_completed]: [1]
[sys.cameramode.blackbox]: [0]
[sys.cameramode.vtcall]: [0]
[sys.config.mars_version]: [1.00]
[sys.dockstate]: [0]
[sys.enterprise.billing.version]: [1.2.0]
[sys.enterprise.otp.version]: [2.6.0]
[sys.isdumpstaterunning]: [0]
[sys.knox.exists]: [0]
[sys.knox.store]: [0]
[sys.mobicoredaemon.enable]: [true]
[sys.nfc.support]: [1]
[sys.oem_unlock_allowed]: [1]
[sys.settings_global_version]: [144]
[sys.settings_secure_version]: [36]
[sys.settings_system_version]: [276]
[sys.siop.level]: [0]
[sys.ssrm.mdnie]: [-1]
[sys.sysctl.compact_memory]: [0]
[sys.sysctl.extra_free_kbytes]: [10800]
[sys.sysctl.tcp_adv_win_scale]: [1]
[sys.sysctl.tcp_def_init_rwnd]: [60]
[sys.usb.config]: [mtp,adb]
[sys.usb.configfs]: [0]
[sys.usb.state]: [mtp,adb]
[system.camera.CC.disable]: [0]
[telephony.lteOnCdmaDevice]: [0]
[vold.crypt.type]: [default]
[vold.decrypt]: [trigger_restart_framework]
[vold.encrypt_progress]: []
[vold.has_adoptable]: [0]
[vold.post_fs_data_done]: [1]
[vzw.os.rooted]: [false]
[wifi.interface]: [wlan0]
[wlan.driver.status]: [ok]
[wlan.p2p.chkintent]: [0]

Ardından örneğin cihazın Donanım ismini almak istiyorsan, 
böyle komut vermeniz yeterli
adb shell getprop ro.boot.hardware
Bu bilgiyi döndürecektir : samsungexynos7870
- Namyelus
WWW
Cevapla
#4
Çok teşekkürler.
Cevapla

Konuyu Paylaş : facebook gplus twitter



Konu ile Alakalı Benzer Konular
Konular Yazar Yorumlar Okunma Son Yorum
  Geçici hafıza okuma Lord_Ares 2 205 12-11-2017, Saat: 22:27
Son Yorum: Lord_Ares
  E fatura okuma hakkında cinarbil 7 461 06-10-2017, Saat: 15:28
Son Yorum: cinarbil
  Hızlı satır okuma bu fonksiyonu çalıştıramadım satır okuma fonksiyonu Delphiseven 21 783 10-07-2017, Saat: 17:16
Son Yorum: ismailkocacan
  IMEI Üzeri Cihaz bilgilerini okuma dicle_gsm 9 449 12-05-2017, Saat: 14:00
Son Yorum: nguzeller
  STRIKE SC702 Proximity Kart Okuyucu Cihaz Kamuran Alpkaya 2 466 04-03-2017, Saat: 10:17
Son Yorum: hasanozturk



Konuyu Okuyanlar: 1 Ziyaretçi