Ver Mensaje Individual
  #5  
Antiguo 19-05-2021
pruz pruz is offline
Miembro
 
Registrado: sep 2003
Posts: 170
Reputación: 21
pruz Va por buen camino
memo1.lines.Add(aBlueDevices.Items[i].DeviceName);
Gracias amigos.
ya solucione el problema de la impresion, se debe manejar como un dispositivo Bluetoon.
les dejo el codigo si alguien lo necesita.


Código Delphi [-]
//ESTA RUTINA BUSCA EL DISPOSITIVO
Var

  Msg, Texto, ServiceGui, ServiceName: string;
  BluetoothAdapter: TBluetoothAdapter;
  FBluetoothManager : TBluetoothManager;
  ListaDeAparelhosPareados: TBluetoothDeviceList;
  LServices: TBluetoothServiceList; 

BEGIN

try
   
    FBluetoothManager := TBluetoothManager.Current;
    BluetoothAdapter := FBluetoothManager.CurrentAdapter;
    ListaDeAparelhosPareados := BluetoothAdapter.PairedDevices;


    for I := 0 to ListaDeAparelhosPareados.Count - 1 do
    begin
      LDevice := ListaDeAparelhosPareados[i] as TBluetoothDevice;
       LABEL1.cAPTION := LDevice.DeviceName;  //NOMBRE DEL DISPOSITIVO

      if LDevice.IsPaired then
      begin
        LServices := LDevice.GetServices;
        for B := 0 to LServices.Count - 1 do
        begin
          ServiceGUI := GUIDToString(LServices[b].UUID);
          Guid := LServices[b].UUID;
          ServiceName := LServices[b].Name;
        end;
      end;
    end;
  except
   on E: Exception do
   begin
     Msg := E.Message;
     ShowMessage('Error al Conectar la Impresora ' + Msg) ;
   end;
 end;




END;



//Y ESTA IMPRIME

BEGIN

    FSocket := LDevice.CreateClientSocket(Guid, true);
    if FSocket = nil then BEGIN
        Memo1.Lines.Add('FSocket nulo');
        EXIT;
    END;


   if Assigned(FSocket) and (FSocket <> nil)
   then Begin

        if NOT FSocket.Connected then FSocket.Connect;
         TRY

            lineax := #27 + ' ' + #13#10;
            lineax := #27#69#49  + 'Prueba Teste 1 ' + #13#10;
            lineax := lineax + #27#69#48 + 'Prueba Teste 2 ' + #13#10;
            lineax := lineax + #27 + 'hola 3 ' + #13#10;
            lineax := lineax + #27#69#49 + 'Prueba Teste 4 ' + #13#10;
            lineax := lineax + #27 + 'hla 5 ' + #13#10;
            lineax := lineax + #27#69#48 + ' Prueba Teste 5 ' + #13#10;
            lineax := lineax +  #13#10;

            Texto := lineax ;

            ToSend := TEncoding.UTF8.GetBytes(Texto);
            FSocket.SendData(ToSend);
            Sleep(100);



         EXCEPT
             MENSAJEMSG('NO CONECTADO Imprimir 1 ');
         END;
   End else begin

      MENSAJEMSG('NO CONECTADO Imprimir 2 ');

   end;
END.

Última edición por Casimiro Notevi fecha: 19-05-2021 a las 22:33:18.
Responder Con Cita