Hi!
Have anyone made any test implementation in Delphi?
How to load and use the DLL...
Best regards
/Luddet
Have anyone made any test implementation in Delphi?
Moderator: Telldus
I have just started to develop a test program for TellStick with Delphi, using static linking. You have to declare all functions and procedures like this in the program header (before the Implementation section, I think):
Hope this will do for a start. As stated above, I'm in an initial phase of the development and will have to gain more experience with each of the functions and procedures.
BTW, I think those C++ functions without paramteres must me declared as procedures in Delphi.
Hope anyone has done more Delphi programming with TellStick than I, and would like to keep this post going!
TelldusCore.dll has to reside in the same directory with the Delphi program, or in Windows\System32, or in a PATH directory. In my case it's in the Delphi program directory for speedy access.
Code: Select all
Function tdTurnOn (deviceID: Integer): Boolean; External 'TelldusCore.dll';
Procedure tdInit; External 'TelldusCore.dll';
Procedure tdClose; External 'TelldusCore.dll';
Procedure tdReleaseString (S: String); External 'TelldusCore.dll';
Function tdTurnOff (deviceID: Integer): Boolean; External 'TelldusCore.dll';
Function tdBell (deviceID: Integer): Boolean; External 'TelldusCore.dll';
Function tdDim (deviceID: Integer; Level: Byte): Boolean; External 'TelldusCore.dll';
Function tdMethods (deviceID: Integer; methodsSupported: Integer): Integer;
External 'TelldusCore.dll';
Function tdGetDeviceId (a: Integer): Integer; External 'TelldusCore.dll';
Function tdGetName (I: Integer): String; External 'TelldusCore.dll';
Function tdGetNumberOfDevices: Integer; External 'TelldusCore.dll';
Procedure tdSetName (intDeviceId: Integer; chNewName: String); External 'TelldusCore.dll';
Procedure tdRemoveDevice (intDeviceId: Integer); External 'TelldusCore.dll';
Procedure tdAddDevice; External 'TelldusCore.dll';
BTW, I think those C++ functions without paramteres must me declared as procedures in Delphi.
Hope anyone has done more Delphi programming with TellStick than I, and would like to keep this post going!
TelldusCore.dll has to reside in the same directory with the Delphi program, or in Windows\System32, or in a PATH directory. In my case it's in the Delphi program directory for speedy access.
Documentation
Bump:
Forgot to mention: A good starting point in any language is located at
http://developer.telldus.se/doxygen/gro ... f1cd532b33
Forgot to mention: A good starting point in any language is located at
http://developer.telldus.se/doxygen/gro ... f1cd532b33
Re: Have anyone made any test implementation in Delphi?
Simple example in Delphi
Code: Select all
unit TelldusEx;
//------------------------------------------------------------------------------
// To run this example you have to do:
// 1. Download and install Telldus center from: http://www.telldus.se/products/tellstick
// 2. Install a Tellstick in an USB port of your computer
// 3. Get a remote on/off switch, ex NEXA OnOff, connect it to the currrent and a lamp to see it working.
// 4. You must install the switch (NEXA) in TelldusCenter, give it a name (eks: NEXA1) and unit nr 1, and run the learning process.
// 5. Copy TelldusCore.dll to the .exe directory of this program.
// 6. Compile and run this example.
// 8. You should now be able to paly with the switch, turn it on and off.
//
//---------------------------arneolavatmyttingdotes--------------------------------
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
But_On: TButton;
But_off: TButton;
Label1: TLabel;
procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure But_OnClick(Sender: TObject);
procedure But_offClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
Procedure tdInit; Stdcall; External 'TelldusCore.dll';
Procedure tdClose; Stdcall; External 'TelldusCore.dll';
Function tdTurnOn (deviceID: Integer): Integer; Stdcall; External 'TelldusCore.dll';
Function tdTurnOff (deviceID: Integer): Integer; Stdcall; External 'TelldusCore.dll';
var
Form1: TForm1;
var ResultCod : Integer; // No handling of result, just for futher use
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
tdInit; { Allways perform init/open }
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
tdClose; { Allways perform a close }
end;
procedure TForm1.But_OnClick(Sender: TObject);
begin
ResultCod := tdTurnOn (1); { Unit number 1, selected in Tellus Center }
end;
procedure TForm1.But_offClick(Sender: TObject);
begin
ResultCod := tdTurnOff (1) ; { Unit number 1, selected in Tellus Center }
end;
end.
-
- Posts: 1
- Joined: Fri Mar 17, 2023 9:45 am
Re: Have anyone made any test implementation in Delphi?
Now you got my brain working... I guess there is a "delphi" version for linux.
But i have a Tellstick Net. It would be real nice if we could have a telldus core and firmware for that to. Delphi and VB is the only language i have used in the past.
But i have a Tellstick Net. It would be real nice if we could have a telldus core and firmware for that to. Delphi and VB is the only language i have used in the past.