mirror of
https://github.com/KeymonSoft/Durakelo_Reparto.git
synced 2026-04-17 19:37:04 +00:00
93 lines
3.2 KiB
QBasic
93 lines
3.2 KiB
QBasic
B4A=true
|
|
Group=Default Group
|
|
ModulesStructureVersion=1
|
|
Type=Service
|
|
Version=10.2
|
|
@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.
|
|
Public rp As RuntimePermissions
|
|
Public FLP As FusedLocationProvider
|
|
Dim pe As PhoneEvents
|
|
Dim Timer1 As Timer
|
|
Dim Interval As Int = 300
|
|
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.
|
|
pe.Initialize("pe") 'Para obtener la bateria
|
|
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.
|
|
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 pe_BatteryChanged (Level As Int, Scale As Int, Plugged As Boolean, Intent As Intent)
|
|
Main.batt=Level
|
|
|
|
' Log(Main.batt)
|
|
' Log(main.batt)
|
|
|
|
End Sub
|
|
|
|
Private Sub Timer1_Tick
|
|
' ToastMessageShow("Timer",False)
|
|
If Main.logger Then Log("Siguiente actuaizacion " & DateTime.Time(DateTime.Now + Interval * 1000))
|
|
ENVIA_ULTIMA_GPS
|
|
End Sub
|
|
|
|
Sub ENVIA_ULTIMA_GPS
|
|
Log("Iniciamos ENVIA_ULTIMA_GPS")
|
|
Dim cmd As DBCommand
|
|
Dim reqManager As DBRequestManager
|
|
DateTime.TimeFormat = "HHmmss"
|
|
Main.ultimaActualizacionGPS = DateTime.Time(DateTime.Now)
|
|
|
|
reqManager.Initialize(Me, Main.server)
|
|
Main.skmt.Initialize(Main.ruta,"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,Main.lat_gps,Main.lon_gps,Main.batt,0, 0, 0,Main.ALMACEN,Main.rutapreventa)
|
|
'
|
|
cmd.Name = "UPDATE_DUR_ACTUALR2_GPS"
|
|
cmd.Parameters = Array As Object(Main.montoActual,Main.montorechazo,Main.clientestotal ,Main.clientesventa ,Main.lat_gps, Main.lon_gps, Main.batt,Main.clientesvisitados ,Main.Montosalida,Main.ALMACEN,Main.rutapreventa )
|
|
' ToastMessageShow(Main.montoActual & Main.clientestotal & Main.clientesventa & Main.clientesvisitados & Main.lat_gps & Main.lon_gps & Main.batt & Main.ALMACEN & Main.rutapreventa, True)
|
|
reqManager.ExecuteCommand(cmd,"inst_visitas")
|
|
|
|
Main.skmt.ExecNonQuery2("Update cat_variables set CAT_VA_VALOR = ? WHERE CAT_VA_DESCRIPCION = ?" , Array As String(DateTime.Time(DateTime.Now),"HoraIngreso"))
|
|
Log("Data="&Main.montoActual&"|"&Main.clientestotal&"|"&Main.clientesventa&"|"&Main.clientesvisitados&"|"&Main.lat_gps&"|"&Main.lon_gps&"|"&Main.batt&"|"&0&"|"&0&"|"&0&"|"&Main.ALMACEN&"|"&Main.rutapreventa&"|")
|
|
|
|
'Reiniciamos el timer para cuando llamamos el Sub desde "seleccion"
|
|
Timer1.Enabled = False
|
|
Timer1.Interval = Interval * 1000
|
|
Timer1.Enabled = True
|
|
ToastMessageShow("T",False)
|
|
End Sub |