mirror of
https://github.com/KeymonSoft/Durakelo.git
synced 2026-04-17 19:36:12 +00:00
# Conflicts: # B4A/B4XMainPage.bas # B4A/C_Cliente.bas # B4A/C_Clientes.bas # B4A/C_Historico.bas # B4A/C_NoVenta.bas # B4A/C_Nota.bas # B4A/C_Principal.bas # B4A/C_Productos.bas # B4A/C_TicketsDia.bas # B4A/CameraExClass.bas # B4A/DBRequestManager.bas # B4A/Durakelo.b4a # B4A/Durakelo.b4a.meta # B4A/Files/cliente.bal # B4A/Files/clientes.bal # B4A/Files/detalle_promo.bal # B4A/Files/foto.bal # B4A/Files/guardagestion.bal # B4A/Files/historico.bal # B4A/Files/kelloggs.png # B4A/Files/kmt.db # B4A/Files/login.bal # B4A/Files/mapa.bal # B4A/Files/mapa_rutas.bal # B4A/Files/noventa.bal # B4A/Files/nuevocliente.bal # B4A/Files/palomita_verde.png # B4A/Files/pedido.bal # B4A/Files/principal.bal # B4A/Files/productos.bal # B4A/Files/tache_rojo.png # B4A/Starter.bas # B4A/Tracker.bas
108 lines
3.5 KiB
QBasic
108 lines
3.5 KiB
QBasic
B4A=true
|
|
Group=Default Group
|
|
ModulesStructureVersion=1
|
|
Type=Service
|
|
Version=9.85
|
|
@EndOfDesignText@
|
|
#Region Service Attributes
|
|
#StartAtBoot: False
|
|
#ExcludeFromLibrary: True
|
|
#End Region
|
|
|
|
Sub Process_Globals
|
|
'These global variables will be declared once when the application starts.
|
|
'These variables can be accessed from all modules.
|
|
Dim logger As Boolean = True
|
|
Dim lat_gps, lon_gps As String
|
|
Dim rp As RuntimePermissions
|
|
Dim skmt As SQL
|
|
Dim usuario As String
|
|
Dim ultimaActualizacionGPS As String = 235959
|
|
Private BTAdmin As BluetoothAdmin
|
|
Dim MAC_IMPRESORA As String
|
|
Public BluetoothState As Boolean
|
|
Public rp As RuntimePermissions
|
|
Public FLP As FusedLocationProvider
|
|
Dim Timer1 As Timer
|
|
Dim Interval As Int = 300
|
|
Private flpStarted As Boolean
|
|
Dim DBReqServer As String = "http://keymon.lat:1782"
|
|
Dim FECHA_HOY As String
|
|
Dim tipov As String = ""
|
|
End Sub
|
|
|
|
Sub Service_Create
|
|
'This is the program entry point.
|
|
'This is a good place to load resources that are not specific to a single activity.
|
|
CallSubDelayed(FirebaseMessaging, "SubscribeToTopics")
|
|
BTAdmin.Initialize("admin")
|
|
' serial.Initialize("serial")
|
|
If BTAdmin.IsEnabled = False Then
|
|
If BTAdmin.Enable = False Then
|
|
ToastMessageShow("Error enabling Bluetooth adapter.", True)
|
|
Else
|
|
ToastMessageShow("Enabling Bluetooth adapter...", False)
|
|
End If
|
|
Else
|
|
BluetoothState = True
|
|
End If
|
|
Timer1.Initialize("Timer1", Interval * 1000)
|
|
Timer1.Enabled = True
|
|
End Sub
|
|
|
|
Sub Service_Start (StartingIntent As Intent)
|
|
Service.StopAutomaticForeground 'Starter service can start in the foreground state in some edge cases.
|
|
If File.Exists(File.DirInternal, "kmt.db") = False Then File.Copy(File.DirAssets, "kmt.db", File.DirInternal, "kmt.db")
|
|
skmt.Initialize(File.DirInternal,"kmt.db", True)
|
|
StartService(Tracker)
|
|
End Sub
|
|
|
|
Private Sub BTAdmin_StateChanged (NewState As Int, OldState As Int)
|
|
If logger Then Log("BT state changed: " & NewState)
|
|
BluetoothState = NewState = BTAdmin.STATE_ON
|
|
' StateChanged
|
|
End Sub
|
|
|
|
Private Sub Timer1_Tick
|
|
' ToastMessageShow("Timer",False)
|
|
If logger Then Log("Siguiente actuaizacion " & DateTime.Time(DateTime.Now + Interval * 1000))
|
|
ENVIA_ULTIMA_GPS
|
|
End Sub
|
|
|
|
Sub Service_TaskRemoved
|
|
'This event will be raised when the user removes the app from the recent apps list.
|
|
End Sub
|
|
|
|
'Return true to allow the OS default exceptions handler to handle the uncaught exception.
|
|
Sub Application_Error (Error As Exception, StackTrace As String) As Boolean
|
|
Return True
|
|
End Sub
|
|
|
|
Sub Service_Destroy
|
|
|
|
End Sub
|
|
|
|
Sub ENVIA_ULTIMA_GPS 'ignore
|
|
Log("Iniciamos ENVIA_ULTIMA_GPS")
|
|
Dim skmt As SQL
|
|
Dim cmd As DBCommand
|
|
Dim reqManager As DBRequestManager
|
|
DateTime.TimeFormat = "HHmmss"
|
|
ultimaActualizacionGPS = DateTime.Time(DateTime.Now)
|
|
reqManager.Initialize(Me, DBReqServer)
|
|
skmt.Initialize(File.DirInternal,"kmt.db", True)
|
|
' cmd.Initialize
|
|
' cmd.Name = "select_fechat"
|
|
' reqManager.ExecuteQuery(cmd , 0, "fechat")
|
|
' Dim cmd As DBCommand
|
|
' cmd.Initialize
|
|
' cmd.Name = "UPDATE_DURK_ACTUAL2_GPS"
|
|
' cmd.Parameters = Array As Object(Main.montoActual,Main.clientestotal, Main.clientesventa,Main.clientesvisitados,lat_gps,lon_gps,Main.batt,0, 0, 0,Main.ALMACEN,Main.rutapreventa)
|
|
' reqManager.ExecuteCommand(cmd,"inst_visitas")
|
|
' skmt.ExecNonQuery2("Update cat_variables set CAT_VA_VALOR = ? WHERE CAT_VA_DESCRIPCION = ?" , Array As String(DateTime.Time(DateTime.Now),"HoraIngreso"))
|
|
|
|
'Reiniciamos el timer para cuando llamamos el Sub desde "seleccion"
|
|
Timer1.Enabled = False
|
|
Timer1.Interval = Interval * 1000
|
|
Timer1.Enabled = True
|
|
End Sub |