Archivos inneseraios y conflictos

This commit is contained in:
2019-08-16 11:47:37 -07:00
parent cdc09685b7
commit a5a840f799
8 changed files with 1 additions and 473 deletions

1
.gitignore vendored
View File

@@ -259,6 +259,7 @@ paket-files/
# JetBrains Rider
.idea/
*.sln.iml
*.sln.iml
# CodeRush
.cr/

Binary file not shown.

View File

@@ -1,193 +0,0 @@
<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="SigFoxDecodeExample.aspx.vb" Inherits="Ashx_SigFoxDecodeExample" %>
<asp:Content ID="Content1" ContentPlaceHolderID="CP" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Css" Runat="Server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="E" Runat="Server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="HB" Runat="Server">
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="H" Runat="Server">
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="HA" Runat="Server">
</asp:Content>
<asp:Content ID="Content7" ContentPlaceHolderID="C" Runat="Server">
</asp:Content>
<asp:Content ID="Content8" ContentPlaceHolderID="JS" Runat="Server">
<script type="text/javascript">
//e.g. parseSigFox('10b67dcc0006efda3d9816c2')
//In an attempt to make the code clearer, I will not be using ArrayBuffer
function hex2Bytes(val) {
if (!val) {
return [];
}
val = val.trim();
if (val.startsWith('0x')) {
val = val.substring(2); //get rid of starting '0x'
}
var numBytes = val.length / 2;
var bytes = [];
for (var i = 0; i < numBytes; i++) {
bytes.push(parseInt(val.substring(i * 2, (i * 2) + 2), 16));
}
return bytes;
}
function parseLittleEndianInt32(buffer, offset) {
return (buffer[offset + 3] << 24) +
(buffer[offset + 2] << 16) +
(buffer[offset + 1] << 8) +
(buffer[offset]);
}
function parseLittleEndianInt16(buffer, offset) {
return (buffer[offset + 1] << 8) +
(buffer[offset]);
}
function parseLittleEndianInt16Bits(buffer, offset, bitOffset, bitLength) {
var temp = parseLittleEndianInt16(buffer, offset);
temp = temp >> bitOffset;
var mask = 0xffff >> (16 - bitLength);
return temp & mask;
}
//e.g. 10b67dcc0006efda3d9816c2
function parseSigFox(data) {
var buffer = hex2Bytes(data);
if (!buffer) {
return null;
}
var recordType = buffer[0] & 0x0f;
switch (recordType) {
case 0: //positional data
return parsePositionalData(buffer);
case 1: //downlink ACK
return parseDownlinkAck(buffer);
case 2: //device data
return parseDeviceStats(buffer);
case 3: //extended positional data
return parseExtendedData(buffer);
default:
return null;
}
}
function parsePositionalData(buffer) {
var flags = buffer[0] & 0xF0;
var inTrip = (flags & 0x10) > 0;
var lastFixFailed = (flags & 0x20) > 0;
var latitudeRaw = parseLittleEndianInt32(buffer, 1);
var longitudeRaw = parseLittleEndianInt32(buffer, 5);
var headingRaw = buffer[9];
var speedRaw = buffer[10];
var batteryRaw = buffer[11];
return {
MessageType: 0,
InTrip: inTrip,
LastFixFailed: lastFixFailed,
Latitude: latitudeRaw * 1e-7,
Longitude: longitudeRaw * 1e-7,
Heading: headingRaw * 2,
SpeedKmH: speedRaw,
BatteryVoltage: (batteryRaw * 25) / 1000.0
};
}
function parseDownlinkAck(buffer) {
var flags = buffer[0] & 0xF0;
var downlinkAccepted = (flags & 0x10) > 0;
var firmwareMajor = buffer[2];
var firmwareMinor = buffer[3];
var data = [];
for (var i = 0; i < 8; i++) {
data.push(i + 4);
}
return {
MessageType: 1,
DownlinkAccepted: downlinkAccepted,
FirmwareVersion: firmwareMajor + '.' + firmwareMinor,
DownlinkData: data
};
}
function parseDeviceStats(buffer) {
var uptimeWeeks = parseLittleEndianInt16Bits(buffer, 0, 4, 9/*bits*/);
var txCountRaw = parseLittleEndianInt16Bits(buffer, 1, 5, 11 /*bits*/);
var rxCountRaw = buffer[3];
var tripCountRaw = parseLittleEndianInt16Bits(buffer, 4, 0, 13 /*bits*/);
var gpsSuccessRaw = parseLittleEndianInt16Bits(buffer, 5, 5, 10 /*bits*/);
var gpsFailuresRaw = parseLittleEndianInt16Bits(buffer, 6, 7, 8 /*bits*/);
var averageFixTime = parseLittleEndianInt16Bits(buffer, 7, 7, 9/*bits*/);
var averageFailTime = parseLittleEndianInt16Bits(buffer, 9, 0, 9/*bits*/);
var averageFreshenTime = parseLittleEndianInt16Bits(buffer, 10, 1, 8/*bits*/);
var wakeupsPerTrip = buffer[11] >> 1;
return {
MessageType: 2,
UptimeWeeks: uptimeWeeks,
TxCount: txCountRaw * 32,
RxCount: rxCountRaw * 32,
TripCount: tripCountRaw,
GpsSuccessCount: gpsSuccessRaw * 32,
GpsFailureCount: gpsFailuresRaw * 32,
AverageFixTimeSeconds: averageFixTime,
AverageFailTimeSeconds: averageFailTime,
AverageFreshenTimeSeconds: averageFreshenTime,
WakeUpsPerTrip: wakeupsPerTrip
};
}
function parseExtendedData(buffer) {
var headingRaw = buffer[0] >> 4;
var latitudeRaw = buffer[1] + buffer[2] * 256 + buffer[3] * 65536;
if (latitudeRaw >= 0x800000) // 2^23
latitudeRaw -= 0x1000000; // 2^24
var longitudeRaw = buffer[4] + buffer[5] * 256 + buffer[6] * 65536;
if (longitudeRaw >= 0x800000) // 2^23
longitudeRaw -= 0x1000000; // 2^24
var posAccRaw = buffer[7];
var batteryRaw = buffer[8];
var speedRaw = buffer[9] & 0x3F;
var inTrip = (buffer[9] & 0x40) > 0;
var lastFixFailed = (buffer[9] & 0x80) > 0;
return {
MessageType: 3,
Heading: headingRaw * 22.5,
Latitude: (latitudeRaw * 256) / 1e7,
Longitude: (longitudeRaw * 256) / 1e7,
PosAccM: posAccRaw * 1,
BatteryVoltage: (batteryRaw * 25) / 1000.0,
SpeedKmH: speedRaw * 2.5,
InTrip: inTrip,
LastFixFailed: lastFixFailed
};
}
</script>
</asp:Content>

View File

@@ -1,11 +0,0 @@
Imports System.Collections
Partial Class Ashx_SigFoxDecodeExample
Inherits System.Web.UI.Page
Public Sub Page_Load() Handles Me.Load
Dim ObjNotificaciones As New ClsSisNotificaciones
ObjNotificaciones.ObtenerNotificaciones()
ObjNotificaciones.Dispose()
End Sub
End Class

View File

@@ -1,155 +0,0 @@
Imports Microsoft.VisualBasic
Imports System.Collections.Generic
Imports System.Linq
Imports System.Web
Imports System.Data
Imports System.Text
Imports Extensiones
Public Class ClsTSoft
Inherits ClsClaseBase
Public Sub New()'(Optional adsObj As ClsClaseBase = Nothing)
'MyBase.New(adsObj)
End Sub
#Region "CRUD_Remisiones"
Public Function AddRemisiones(FolioRemision As String, NoEconomico As String, CveEstatus As Integer, GeoInicio As String, GeoFin As String, Fecha As Date) As Boolean
Dim Retorno As Boolean = False
SqlDataAdapter("PA_GPS_RemisionesAdd")
With SqlAdapter.SelectCommand.Parameters
.Add("@FolioRemision", SqlDbType.VarChar).Value = FolioRemision
.Add("@NoEconomico", SqlDbType.VarChar).Value = NoEconomico
.Add("@CveEstatus", SqlDbType.Int).Value = CveEstatus
.Add("@GeoInicio", SqlDbType.VarChar).Value = GeoInicio
.Add("@GeoFin", SqlDbType.VarChar).Value = GeoFin
.Add("@Fecha", SqlDbType.Date).Value = Fecha
End With
Try
SqlAdapter.Fill(Data)
Retorno = True
Catch ex As Exception
OnError("Ocurrió un Error al agregar la Remision.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
End Try
Return Retorno
End Function
Public Function UpdateEstatusRemisiones(CveRemision As Integer, CveEstatus As Integer) As Boolean
Dim Retorno As Boolean = False
SqlDataAdapter("PA_GPS_RemisionesEstatusUpdate")
With SqlAdapter.SelectCommand.Parameters
.Add("@CveRemision", SqlDbType.Int).Value = CveRemision
.Add("@CveEstatus", SqlDbType.Int).Value = CveEstatus
End With
Try
SqlAdapter.Fill(Data)
Retorno = True
Catch ex As Exception
OnError("Ocurrió un Error al agregar la Remision.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
End Try
Return Retorno
End Function
Public Function GetRemisiones(CveCliente As Integer) As Boolean
Dim Retorno As Boolean = False
SqlDataAdapter("PA_GPS_RemisionesGet")
With SqlAdapter.SelectCommand.Parameters
.Add("@CveCliente", SqlDbType.Int).Value = CveCliente
End With
Try
SqlAdapter.Fill(Data)
Retorno = True
Catch ex As Exception
OnError("Ocurrió un Error al agregar la Remision.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
End Try
Return Retorno
End Function
'Public Function UpRemisiones(CveRemision As Integer, FolioRemision As String, CveDispositivo As Integer, CveEstatus As Integer, GeoInicio As String, GeoFin As String,
' Lat As String, Lon As String) As Boolean
' Dim strSQL As New StringBuilder()
' Dim retorno As Boolean = False
' strSQL.Append(" UPDATE TSoft_Remisiones Set ")
' strSQL.Append(" FolioRemision=@FolioRemision")
' strSQL.Append(", CveDispositivo =@CveDispositivo")
' strSQL.Append(", CveEstatus =@CveEstatus")
' strSQL.Append(", GeoInicio =@GeoInicio")
' strSQL.Append(", GeoFin =@GeoFin")
' strSQL.Append(", Lat =@Lat")
' strSQL.Append(", Lon =@Lon")
' strSQL.Append(" WHERE [CveRemision]=@CveRemision ")
' DataAdapter(strSQL.ToString())
' addParameters("@CveRemision", SqlDbType.Int, CveRemision)
' addParameters("@FolioRemision", SqlDbType.VarChar, FolioRemision)
' addParameters("@CveDispositivo", SqlDbType.Int, CveDispositivo)
' addParameters("@CveEstatus", SqlDbType.Int, CveEstatus)
' addParameters("@GeoInicio", SqlDbType.VarChar, GeoInicio)
' addParameters("@GeoFin", SqlDbType.VarChar, GeoFin)
' addParameters("@Lat", SqlDbType.VarChar, Lat)
' addParameters("@Lon", SqlDbType.VarChar, Lon)
' retorno = RunQuery("Ocurrió un error al actualizar el Remisiones.")
' strSQL.Clear()
' Return retorno
'End Function
Public Function RemoveRemisiones(CveRemision As Integer) As Boolean
Dim strSQL As New StringBuilder()
Dim retorno As Boolean = False
strSQL.Append(" DELETE FROM TSoft_Remisiones ")
strSQL.Append(" WHERE [CveRemision]=@CveRemision ")
DataAdapter(strSQL.ToString())
addParameters("@CveRemision", SqlDbType.Int, CveRemision)
retorno = RunQuery("Ocurrió un error al eliminar el Remisiones.")
strSQL.Clear()
Return retorno
End Function
#End Region
#Region "Otros"
Public Function UpEstatusRemision(FolioRemision As String, CveEstatus As Integer) As Boolean
Dim strSQL As New StringBuilder()
Dim retorno As Boolean = False
strSQL.AppendLine(" BEGIN")
strSQL.AppendLine(" DECLARE @Lat AS VARCHAR(20)=''")
strSQL.AppendLine(" DECLARE @Lon AS VARCHAR(20)=''")
strSQL.AppendLine(" DECLARE @CveRemision AS INT =(SELECT TOP 1 REM.CveRemision FROM TSoft_Remisiones REM WHERE FolioRemision= @FolioRemision)")
strSQL.AppendLine(" Declare @CveDispositivo AS INT=( SELECT TOP 1 REM.CveDispositivo FROM TSoft_Remisiones REM WHERE CveRemision=@CveRemision)")
strSQL.AppendLine(" SELECT Top 1 @Lat= Geom.Lat ,@Lon=Geom.Long FROM GPS_Posiciones WHERE CveDispositivo=@CveDispositivo ORDER BY FechaTrama")
strSQL.AppendLine(" UPDATE TSoft_Remisiones SET CveEstatus=@CveEstatus WHERE CveRemision=@CveRemision")
strSQL.AppendLine(" INSERT INTO [TSoft_RemisionesHistorial] ([CveRemisison], [CveEstatus], [Lat], [Lon]) VALUES (@CveRemision, @CveEstatus, @Lat, @Lon)")
strSQL.AppendLine(" END")
DataAdapter(strSQL.ToString())
addParameters("@FolioRemision", SqlDbType.VarChar, FolioRemision)
addParameters("@CveEstatus", SqlDbType.Int, CveEstatus)
retorno = RunQuery("Ocurrió un error al agregar el Remisiones.")
strSQL.Clear()
Return retorno
End Function
Public Function GETRemisionesHistorial(FolioRemision As String, NoEconomico As String) As Boolean
Dim strSQL As New StringBuilder()
Dim retorno As Boolean = False
strSQL.AppendLine(" Declare @CveDispositivo AS INT=(SELECT S_Di.CveDispositivo FROM GPS_Dispositivos AS S_Di WHERE NoEconomico=@NoEconomico AND CveCliente=183798)")
strSQL.AppendLine(" SELECT @NoEconomico AS NoEconomico, REMHIST.Fecha,REMHIST.Lat,REMHIST.Lon,REM.FolioRemision,REMHIST.CveEstatus FROM TSoft_Remisiones REM")
strSQL.AppendLine(" INNER JOIN TSoft_RemisionesHistorial REMHIST ON REMHIST.CveRemisison=REM.CveRemision")
strSQL.AppendLine(" WHERE CveDispositivo=@CveDispositivo AND FolioRemision= @FolioRemision ORDER BY REMHIST.Fecha DESC")
DataAdapter(strSQL.ToString())
addParameters("@FolioRemision", SqlDbType.VarChar, FolioRemision)
addParameters("@NoEconomico", SqlDbType.VarChar, NoEconomico)
retorno = RunQuery("Ocurrió un error al agregar el Remisiones.")
strSQL.Clear()
Return retorno
End Function
#End Region
End Class

View File

@@ -1,26 +0,0 @@
<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="Rene.aspx.vb" Inherits="Rene" %>
<asp:Content ID="Content1" ContentPlaceHolderID="CP" Runat="Server">
CP
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Css" Runat="Server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="E" Runat="Server">
E
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="HB" Runat="Server">
HB
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="H" Runat="Server">
H
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="HA" Runat="Server">
HA
</asp:Content>
<asp:Content ID="Content7" ContentPlaceHolderID="C" Runat="Server">
C
<asp:TextBox ID="Txt" runat="server" TextMode="MultiLine" Height="200px" Width="500px"></asp:TextBox>
</asp:Content>
<asp:Content ID="Content8" ContentPlaceHolderID="JS" Runat="Server">
</asp:Content>

View File

@@ -1,88 +0,0 @@

Imports System.Net
Imports System.Net.NetworkInformation
Partial Class Rene
Inherits System.Web.UI.Page
Private Sub Rene_Load(sender As Object, e As EventArgs) Handles Me.Load
'Dim Correo As New ClsSisMail
If Not IsPostBack Then
IpAddress()
End If
'Correo.SendMail(Nothing, "rene.molina@adsistemas.mx", "asunto", "Body", CCP:="rene.molina@adsistemas.mx;julian@adsistemas.mx;rene.molina@adsistemas.mx;julian@adsistemas.mx;paola@adsistemas.mx;")
End Sub
Private Sub IpAddress()
Dim ClientIP As String = String.Empty
Dim Tipo As String = String.Empty
Dim HTML As String = String.Empty
Dim IP As String = String.Empty
IP = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
If Not String.IsNullOrEmpty(IP) Then
Dim ipRange As String() = IP.Trim().Split(","c)
Dim le As Integer = ipRange.Length - 1
ClientIP = ipRange(le)
Tipo = "1: "
End If
HTML &= (ClientIP)
HTML &= ("<br>")
HTML &= (Tipo)
IP = Request.ServerVariables("HTTP_X_CLUSTER_CLIENT_IP")
If Not String.IsNullOrEmpty(IP) Then
ClientIP = IP
Tipo = "2: "
End If
HTML &= (ClientIP)
HTML &= ("<br>")
HTML &= (Tipo)
If IP = Request.ServerVariables("REMOTE_ADDR") Then
ClientIP = Request.ServerVariables("REMOTE_ADDR")
Tipo = "3: "
End If
HTML &= (ClientIP)
HTML &= ("<br>")
HTML &= (Tipo)
HTML &= ("<br>Tipo 4: ")
HTML &= (System.Net.Dns.GetHostEntry(System.Net.Dns.GetHostName()).AddressList.GetValue(0).ToString())
HTML &= ("<br>Tipo 5: ")
HTML &= (HttpContext.Current.Request.Params("HTTP_CLIENT_IP"))
HTML &= ("<br>Tipo 6: ")
HTML &= (HttpContext.Current.Request.UserHostAddress)
Dim nics As NetworkInterface() = NetworkInterface.GetAllNetworkInterfaces()
Dim sMacAddress As String = String.Empty
Dim ipv4 As String = String.Empty
For Each adapter As NetworkInterface In nics
If sMacAddress = String.Empty Then
' only return MAC Address from first card
Dim properties As IPInterfaceProperties = adapter.GetIPProperties()
sMacAddress = adapter.GetPhysicalAddress().ToString()
ipv4 = adapter.GetIPv4Statistics().ToString
HTML &= ("<br>Tipo 7: " & sMacAddress & " - " & ipv4)
End If
Next
' To Get IP Address
HTML &= ("<br>Tipo 8: ")
Dim IPHost As String = Dns.GetHostName()
Dim IP2 As String = Dns.GetHostByName(IPHost).AddressList(0).ToString()
HTML &= IPHost & " - " & IP2
Txt.Text = HTML
End Sub
End Class

Binary file not shown.

Before

Width:  |  Height:  |  Size: 69 KiB