Ver Mensaje Individual
  #1  
Antiguo 22-03-2013
bigguntm bigguntm is offline
Miembro
NULL
 
Registrado: nov 2012
Posts: 16
Reputación: 0
bigguntm Va por buen camino
Ayuda para conectar celular en la app

Hola a todos de nuevo, al comienzo de mi programa queria que los blackberry's se conectaran a mi app para poder leerles sus datos, lo principal seria el imei y el mep. Bueno, nunca lo pude hacer, debe ser por el poco tiempo que llevo programando, un colega en un foro, me facilito esto,

Código:
RIMRADIOCOMLib_TLB.pass
se los puse en un .rar abajo lo pueden descargar..

en un archivo .bat , colocamos esto..

//para registrar la dll y pueda funcionar correctamente.

Código:
regsvr32 RIMRadioCOM.dll
en la Unit principal esto..

Código Delphi [-]
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ActiveX, RIMRADIOCOMLib_TLB, StdCtrls, ExtCtrls;

type
  TForm1 = class(TForm)
    btnReadInfo: TButton;
    edtIMEI: TLabeledEdit;
    edtMEP: TLabeledEdit;
    procedure btnReadInfoClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.btnReadInfoClick(Sender: TObject);
var
i: Cardinal;
SwPartList: IGetSwPartList;
PartList: PSafeArray;
RRO: TRIMRadioObj;
Connection: IConnection;
IMEI: IReadIMEI;
StrImei: WideString;
pl: WideString;
BBPIN: IReadBBPIN;
edtClipBoard: TEdit;
begin
// Create RIM Radio Object
RRO := TRIMRadioObj.Create(Form1);
// Query different interfaces to see if are supported
// if OK then read desired information
if RRO.DefaultInterface.QueryInterface(IID_IConnection, Connection) = S_OK then
begin
// Connect to phone
Connection.Connect('USB', 300, 19200, '');
// Read BBPIN
if (Connection.IsConnected = 1) and (RRO.DefaultInterface.QueryInterface(IID_IReadBBPIN, BBPIN) = S_OK) then
begin
// Use IntToHex(BBPIN.Execute,6) to show BBPIN
end;
// IMEI
if (Connection.IsConnected = 1) and (RRO.DefaultInterface.QueryInterface(IID_IReadIMEI, IMEI) = S_OK) then
begin
IMEI.Execute(StrImei);
edtIMEI.Text := StringReplace(StrImei, '/', '', [rfReplaceAll]);
end;
// PartList
if (Connection.IsConnected = 1) and (RRO.DefaultInterface.QueryInterface(IID_IGetSwPartList, SwPartList) = S_OK) then
begin
SwPartList.Execute(PartList);
for i:=0 to PartList.rgsabound[0].cElements-1 do
begin
SafeArrayGetElement(PartList, i, pl);
// From all partlist info just show MEP
if Pos('MEP', pl) > 0  then
edtMEP.Text := pl;
end;
end;
// Create a TEdit to put IMEI + MEP together and paste it to clipboard
edtClipBoard := TEdit.Create(Form1);
edtClipBoard.Parent := Form1;
edtClipBoard.Text := 'IMEI:' + edtIMEI.Text + ' MEP:' + edtMEP.Text;
edtClipBoard.SelectAll;
edtClipBoard.CopyToClipboard;
edtClipBoard.Free;
// Finish then disconnect interface
Connection.Disconnect;
end;
// Release Rim Radio Object
RRO.Free;
end;

end.



el problema es que todo esta "correctamente", la aplicacion no me da ningun error, pero tampoco lee la data del blackberry cuando lo conecto.. Saludos y gracias de antemano..
Archivos Adjuntos
Tipo de Archivo: rar RIMRADIOCOMLib_TLB.rar (50,0 KB, 7 visitas)
Responder Con Cita