Welcome, Guest
Username: Password: Remember me
Discussions for CodeTyphon Object Pascal Programming Language
  • Page:
  • 1

TOPIC:

New components SMBIOS-SystemInfo 2 years 1 week ago #17323

  • Augusto Angelim
  • Augusto Angelim's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 4
  • Thank you received: 0
New components to make it easier to use when programming!

SMBIOS as a SuystemInfo component
unit SystemInfo;
 [attachment=3762]SMBIOS-SystemInfo.zip[/attachment] [attachment=3762]SMBIOS-SystemInfo.zip[/attachment]
{$mode ObjFPC}{$H+}

interface

uses
  Classes, SysUtils, StrUtils, LResources, Forms, Controls, Graphics, Dialogs, uSMBIOS;

type
  TSystemInfo = class(TComponent)
  private
    fVendor         : String;
    fVersion        : String;
    fReleaseDate    : String;
    fBIOSROMSize    : String;
    fBIOSMajorRel   : String;
    fBIOSMinorRel   : String;
    fManufacter     : String;
    fProductName    : String;
    fSerialNumber   : String;
    fUUID           : String;
    fFamily         : String;
    fMemorySize     : String;
    fFormFactory    : String;
    fSpeed          : String;
    fMManufacturer  : String;
    fMSerialNumber  : String;
    fMAssetTag      : String;
    fMPartNumber    : String;
    fMDeviceLocator : String;
    fSMBIOSVersion  : String;
  protected
     procedure GetSystemInfoCREATE;
  public
    constructor Create(TheOwner: TComponent); override;
  published
     property Vendor           : String read fVendor         write fVendor;
     property Version          : String read fVersion        write fVersion;
     property ReleaseDate      : String read fReleaseDate    write fReleaseDate;
     property BIOSROMSize      : String read fBIOSROMSize    write fBIOSROMSize;
     property BIOSMajorRelease : String read fBIOSMajorRel   write fBIOSMajorRel;
     property BIOSMinorRelease : String read fBIOSMinorRel   write fBIOSMinorRel;
     property Manufacter       : String read fManufacter     write fManufacter;
     property ProductName      : String read fProductName    write fProductName;
     property SerialNumber     : String read fSerialNumber   write fSerialNumber;
     property UUID             : String read fUUID           write fUUID;
     property Family           : String read fFamily         write fFamily;
     property MemorySize       : String read fMemorySize     write fMemorySize;
     property FormFactor       : String read fFormFactory    write fFormFactory;
     property DeviceLocator    : String read fMDeviceLocator write fMDeviceLocator;
     property MemSpeed         : String read fSpeed          write fSpeed;
     property MemManufacturer  : String read fMManufacturer  write fMManufacturer;
     property MemSerialNumber  : String read fMSerialNumber  write fMSerialNumber;
     property MemAssetTag      : String read fMAssetTag      write fMAssetTag;
     property MemPartNumber    : String read fMPartNumber    write fMPartNumber;
//     property SMBIOSVersion    : String read fSMBIOSVersion  write fSMBIOSVersion;
  end;

procedure Register;

implementation

procedure TSystemInfo.GetSystemInfoCREATE;
Var
  SMBios  : TSMBios;
  LBIOS   : TBiosInformation;
  sUUID   : Array[0..31] of AnsiChar;
  LMemoryDevice: TMemoryDeviceInformation;
begin
  SMBios:=TSMBios.Create;
  try
    try
      LBIOS :=SMBios.BiosInfo;
      fVendor       := LBIOS.VendorStr;
      fVersion      := LBIOS.VersionStr;
      fReleaseDate  := LBIOS.ReleaseDateStr;
      fBIOSROMSize  := Format('%d k',[64*(LBIOS.RAWBiosInformation^.BiosRomSize+1)]);
      //
      if LBIOS.RAWBiosInformation^.SystemBIOSMajorRelease<>$ff then
           fBIOSMajorRel := Format('%d',[LBIOS.RAWBiosInformation^.SystemBIOSMajorRelease])
      else fBIOSMajorRel := '0';
      //
      if LBIOS.RAWBiosInformation^.SystemBIOSMinorRelease<>$ff then
           fBIOSMinorRel := Format('%d',[LBIOS.RAWBiosInformation^.SystemBIOSMinorRelease])
      else fBIOSMinorRel := '0';
      //
      fManufacter    := SMBios.SysInfo.ManufacturerStr;
      fProductName   := SMBios.SysInfo.ProductNameStr;
      fSerialNumber  := SMBios.SysInfo.SerialNumberStr;
      fFamily        := SMBios.SysInfo.FamilyStr;;
      fSMBIOSVersion := SMBIOS.SysInfo.SKUNumberStr;
      //
      BinToHex(@SMBios.SysInfo.RAWSystemInformation^.UUID,sUUID,SizeOf(SMBios.SysInfo.RAWSystemInformation^.UUID));
      fUUID := sUUID;
      //
//      fSKUNumber := SMBios.SysInfo.SKUNumberStr;
      //
      if SMBios.HasMemoryDeviceInfo then begin
         for LMemoryDevice in SMBios.MemoryDeviceInfo do begin
             fMemorySize     := Format('%d Mbytes',[ LMemoryDevice.GetSize ]);
             fFormFactory    := LMemoryDevice.GetFormFactor;
             fMDeviceLocator := LMemoryDevice.GetDeviceLocatorStr;
             fSpeed          := Format('%d MHz',[LMemoryDevice.RAWMemoryDeviceInfo^.Speed]);
             fMManufacturer  := LMemoryDevice.ManufacturerStr;
             fMSerialNumber  := LMemoryDevice.SerialNumberStr;
             fMAssetTag      := LMemoryDevice.AssetTagStr;
             fMPartNumber    := LMemoryDevice.PartNumberStr;
         end;
        //
        end;
    except
      ShowMessage('Erro no TSystemInfo');
    end;
  finally
    SMBios.Free;
  end;

end;

constructor TSystemInfo.Create(TheOwner: TComponent);
begin
  inherited Create(TheOwner);
  //
  GetSystemInfoCREATE;
  //
end;

procedure Register;
begin
  RegisterComponents('Muga',[TSystemInfo]);
end;

end.
Attachments:

Please Log in or Create an account to join the conversation.

New components SMBIOS-SystemInfo 2 years 1 week ago #17324

  • Sternas Stefanos
  • Sternas Stefanos's Avatar
  • Offline
  • Moderator
  • Moderator
  • Ex Pilot, M.Sc, Ph.D
  • Posts: 4523
  • Thank you received: 1108
Thanks Sir
We add your code to unreleased LAB CT 8.00
 
PilotLogic Architect and Core Programmer
The following user(s) said Thank You: Augusto Angelim

Please Log in or Create an account to join the conversation.

Last edit: by Sternas Stefanos.

New components TDINotebook (Lika a MDI in TPageControl->TabSheet 2 years 5 days ago #17334

  • Augusto Angelim
  • Augusto Angelim's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 4
  • Thank you received: 0
Like RX MID!
This works SO FINE on Windows and Raspberry Pi 3b+ and Ubuntu!




 

Please Log in or Create an account to join the conversation.

Last edit: by Augusto Angelim.

New components TDINotebook (Lika a MDI in TPageControl->TabSheet 2 years 5 days ago #17335

  • Sternas Stefanos
  • Sternas Stefanos's Avatar
  • Offline
  • Moderator
  • Moderator
  • Ex Pilot, M.Sc, Ph.D
  • Posts: 4523
  • Thank you received: 1108
Thanks
We will test and add this comp to LAB CT
PilotLogic Architect and Core Programmer
The following user(s) said Thank You: Augusto Angelim

Please Log in or Create an account to join the conversation.

Last edit: by Sternas Stefanos.
  • Page:
  • 1