Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Fri Nov 24, 2017 12:44 am
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: RealStudio 2012 Eval. - Access COM Objects in Delphi-DLL
PostPosted: Thu Apr 25, 2013 12:41 pm 
Offline

Joined: Thu Apr 25, 2013 11:15 am
Posts: 3
Hi to all,

i am evaluating RealStudio. One of my topics is the question if RealStudio can access COM-Objects in a DLL written with Delphi.

Can someone provide me this information, because i didn't find answers or working examples with RS2012.

Thanks in advance
Jürgen


Top
 Profile  
Reply with quote  
 Post subject: Re: RealStudio 2012 Eval. - Access COM Objects in Delphi-DL
PostPosted: Sun Apr 28, 2013 12:21 am 
Offline
User avatar

Joined: Sun Aug 12, 2007 10:10 am
Posts: 1086
Location: Boiling Springs, SC
Do you have a public dll that you could post for demo creation purposes? I prefer to use windows LoadLibrary Apis to load library functions or declare the functions as you would any other API..making reference to the dll file. If you can post a dll, it would be easier to show by providing code than explain in depth :-)

_________________
Matthew A. Combatti
Real Studio 2012 r1.2

Visit Xojo Developer's Spot!
Systems I Use:
Windows XP/Windows Vista/Windows Server 2008 r2/Windows 7/Windows 8
Mac OSX 10.5/Mac OSX 10.6/Mac OSX Server/Ubuntu/Debian/Suse/Red Hat/
Windows Server 2011/CentOS 5.4 /ReactOS/SimOS

~All Xojo Compatible~


Top
 Profile  
Reply with quote  
 Post subject: Re: RealStudio 2012 Eval. - Access COM Objects in Delphi-DL
PostPosted: Sun Apr 28, 2013 6:16 am 
Offline

Joined: Thu Apr 25, 2013 11:15 am
Posts: 3
Hi Metthew,

it is a DLL to access the Bootloader of a microcontroller. Here is the Code of the Delphi Interface Unit:
The main-object is the IAVRootloader which uses the other objects.
Is there a way to attach the DLL-file to this thread?

unit AVRootIntf;

interface

uses Windows, Classes;

const
// IApplication.Output() Code
ocInfo = $10000000;
ocError = $11000000;
ocOthers = $12000000;
// RetCode Flags
msCrypt = $01;
msCryptFlash = $02;
msCryptEeprom = $04;
msVersioning = $08;
// Return Codes of AVR Bootloader Software
SUCCESS = $30;
ERRORVERIFY = $C0;
ERRORCOMMAND = $C1;
ERRORCRC = $C2;
ERRORBOUNDS = $C3;
ERRORCRYPT = $C4;
ERRORPROG = $C5;
ERRORVERSION = $C6;
ERRORUNKNOWN = $CF;

RETMASK = $F0;

// IDevice.Support Flags
sfCrypt = $0001; // Cryptography supported
sfCryptFlash = $0002; // FLASH Write must be encrypted, unencrypted FLASH write not supported
sfCryptEeprom = $0004; // EEPROM Write must be encrypted, unencrypted EEPROM write not supported
sfVersioning = $0008; // Versioning supported
sfReadEeprom = $0100; // command EEPROM Read supported, examined at runtime
sfWriteEeprom = $0200; // command EEPROM Write supported, examined at runtime
sfReadRam = $0400; // command RAM Read supported, examined at runtime
sfVerifyFlash = $0800; // command Verify FLASH supported, examined at runtime

type
// RS232 encapsulation of windows COM port
TCRCFlag = (crcReset, crcSend);
TCRCFlags = set of TCRCFlag;

ICOM = interface
procedure Flush; stdcall;
procedure Purge; stdcall;

procedure SetTimeout(Value: Cardinal; const ProcName: WideString = ''); stdcall;
procedure SetParams(Baudrate: Cardinal; Parity: Byte = NOPARITY; Databits: Byte = 8; Stopbits: Byte = ONESTOPBIT; const ProcName: WideString = ''); stdcall;
procedure SetEchoMode(Value: Bool); stdcall;
function EchoMode: Bool; stdcall;

procedure SetDTR(Value: Bool); stdcall;
procedure SetRTS(Value: Bool); stdcall;
procedure WriteData(Buffer: Pointer; Size: Integer; Flags: TCRCFlags = []; const ProcName: WideString = ''); stdcall;
procedure WriteByte(Value: Byte; Flags: TCRCFlags = []; const ProcName: WideString = ''); stdcall;
procedure WriteChar(Value: Char; Flags: TCRCFlags = []; const ProcName: WideString = ''); stdcall;
procedure WriteWord(Value: Word; Flags: TCRCFlags = []; const ProcName: WideString = ''); stdcall;
procedure WriteLong(Value: Cardinal; Flags: TCRCFlags = []; const ProcName: WideString = ''); stdcall;
procedure WriteCRC(const ProcName: WideString = ''); stdcall;
procedure ResetCRC; stdcall;

procedure ReadData(Buffer: Pointer; Size: Integer; Flags: TCRCFlags = []; const ProcName: WideString = ''); stdcall;
function ReadByte(Flags: TCRCFlags = []; const ProcName: WideString = ''): Byte; stdcall;
function ReadChar(Flags: TCRCFlags = []; const ProcName: WideString = ''): Char; stdcall;
function ReadWord(Flags: TCRCFlags = []; const ProcName: WideString = ''): Word; stdcall;
function ReadLong(Flags: TCRCFlags = []; const ProcName: WideString = ''): Cardinal; stdcall;
function ReadCRC(const ProcName: WideString = ''): Bool; stdcall;
end;

// Timeout Record for IApplication
TTimeouts = packed record
Baudrate: Integer;
Connect: Integer;
Base: Integer;
Erase: Integer;
Flash: Integer;
Eeprom: Integer;
Buffer: Integer;
AppCmd: Integer;
KeepAlive: Integer;
RTSPulse: Integer;
RTSInterval: Integer;
ConnectTrials: Integer;
MaxPacketSize: Integer;
Options: Integer;
end;

// Application Callback Interface, must be provided to OpenAVRootloader()
IApplication = interface
['{62DEB67D-8AB2-476E-9CB6-F582A508B1F7}']
function ProcessMessages: Bool; stdcall;
procedure Changed; stdcall;
procedure Output(const Msg: WideString; Code: Integer); stdcall;

function GetFLASHFileName: WideString; stdcall;
function GetEEPROMFileName: WideString; stdcall;
function GetACYFileName: WideString; stdcall;
function GetPassword: WideString; stdcall;
function GetBootSign: WideString; stdcall;
function GetTimeouts: TTimeouts; stdcall;
function GetAppCmd: WideString; stdcall;
function GetAppCmdResponse: WideString; stdcall;
function GetAppVersion(Masked: Bool = False): Integer; stdcall;
function GetACYInfo: WideString; stdcall;

function OpenCommunication(Index: Integer): ICOM; stdcall;
end;

// individual Commands to send to AVR Bootloader software, part of IAVRootloader
ICommandSet = interface
['{E9C64A3F-306C-4694-B250-FC57D2CB2DEB}']
function SetAddr(Address: Integer): Bool; stdcall;
function SetBuffer(Buffer: Pointer; Size: Integer; Code: Byte = 0): Bool; stdcall;
function Run(Code: Byte = 1): Bool; stdcall;
function EraseFlash(Pages: Byte = 1): Bool; stdcall;
function VerifyFlash(Pages: Byte = 1): Bool; stdcall;
function WriteFlash(Pages: Byte = 1): Bool; stdcall;
function WriteEeprom(Size: Integer; Pages: Byte = 1): Bool; stdcall;
function ReadEeprom(Buffer: Pointer; Size: Integer; Address: Integer = 0): Bool; stdcall;
function ReadRam(Buffer: Pointer; Size: Integer; Address: Integer = 0): Bool; stdcall;
end;

// connected Device Information, part of IAVRootloader
IDevice = interface
['{9EC8A92B-F6BB-47F3-A9C9-DF8F4F481F49}']
function Signature: Integer; stdcall;
function Name: WideString; stdcall;
function Info: WideString; stdcall;
function FlashSize: Integer; stdcall;
function AppFlashSize: Integer; stdcall;
function AppVersion: Integer; stdcall;
function AppVersionString: WideString; stdcall;
function EepromSize: Integer; stdcall;
function RamSize: Integer; stdcall;
function RamStartAddress: Integer; stdcall;
function PageSize: Integer; stdcall;
function BufferSize: Integer; stdcall;
function Version: Integer; stdcall;
function UseBootSection: Bool; stdcall;
function RetCode: Byte; stdcall;
function Support: Integer; stdcall;
function XMLFileName: WideString; stdcall;
end;

TMode = (moDisconnected, moConnecting, moConnected, moWorking, moTimer, moAbort);

// Bootloader Interface
IAVRootloader = interface
['{3A2E99C2-CE9E-407B-8943-A6D5EB1F6B7A}']
function Mode: TMode; stdcall;

function DoConnect(Working: Bool = False): Bool; stdcall;
procedure DoDisconnect; stdcall;
procedure DoAbort; stdcall;

function DoProgram(EraseFlash: Bool; VerifyFlash: Bool): Bool; stdcall;
function DoCompile(EraseFlash: Bool; VerifyFlash: Bool): Bool; stdcall;
function DoVerifyFlash: Bool; stdcall;
function DoEraseFlash: Bool; stdcall;
function DoEraseEeprom: Bool; stdcall;

function COM: ICOM; stdcall;
function Device: IDevice; stdcall;
function Command: ICommandSet; stdcall;
end;


function OpenCOM(const Port: WideString; const Application: IApplication): ICOM; stdcall; external 'AVRootloader.dll';
function OpenAVRootloader(const Application: IApplication): IAVRootloader; stdcall; external 'AVRootloader.dll';

implementation

end.


Top
 Profile  
Reply with quote  
 Post subject: Re: RealStudio 2012 Eval. - Access COM Objects in Delphi-DL
PostPosted: Sun Apr 28, 2013 2:03 pm 
Offline
User avatar

Joined: Sun Aug 12, 2007 10:10 am
Posts: 1086
Location: Boiling Springs, SC
You an use a free file host like fileden or email the dll to matt@realdevspot.com.

_________________
Matthew A. Combatti
Real Studio 2012 r1.2

Visit Xojo Developer's Spot!
Systems I Use:
Windows XP/Windows Vista/Windows Server 2008 r2/Windows 7/Windows 8
Mac OSX 10.5/Mac OSX 10.6/Mac OSX Server/Ubuntu/Debian/Suse/Red Hat/
Windows Server 2011/CentOS 5.4 /ReactOS/SimOS

~All Xojo Compatible~


Top
 Profile  
Reply with quote  
 Post subject: Re: RealStudio 2012 Eval. - Access COM Objects in Delphi-DL
PostPosted: Sun Apr 28, 2013 2:13 pm 
Offline

Joined: Thu Apr 25, 2013 11:15 am
Posts: 3
Hi Metthew,
i sent you a mail.

Best regards
Jürgen


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group