SafeDispatch/SafeMobileLIB_DLL/VehicleForReports.cs

271 lines
7.5 KiB
C#

using System;
using System.Collections;
using System.Windows.Forms;
using System.Resources;
using System.Collections.Generic;
namespace SafeMobileLib
{
public class VehicleForReports
{
public double lastLocLNG, lastLocLAT;
public double LNG,LAT;
public double prevLocLNG, prevLocLAT;
public ArrayList schRunIcons = null;
public ArrayList actRun = null;
public String busName = null;
public String IMEI = null;
public List<TelemetryObj> telemList = null;
public TelemetryPOS telemPos = null;
public byte vehicleSpeed;
private byte DI;
private byte DO;
public Int32 heading;
public Int32 lastTime;
public bool majorAlarm, minorAlarm;
public String driverPictureLocation = null;
public String lastAddress;
public String idxGoogle="0";
public byte status;
public byte alarm;
public byte engine;
public byte enginelast;
public bool selectCenter;
public double lastLATAddr=0;
public double lastLNGAddr=0;
public bool newStatus=false;
public bool newStatusGPS = false;
public byte Color = 0; //0 - green; 1 - yellow; 2- red;
public Int32 IconID = 0;
public Int32 sc_id=0;
public Int32 veh_id = 0;
public Int32 veh_hist_color = 0;
public Int32 gps_interval = 0;
public System.Drawing.Color histcolor = System.Drawing.Color.Cyan;
public Int32 act_instance = 0;
public Boolean RadioEnabled = true;
public ArrayList EventLists = new ArrayList();
public String GwandRadioID = "0.0";
private System.Threading.Timer timerGPS = null;
private Int32 GPSSteps = 0;
public Boolean needAddress = false;
public Hashtable MapsHT = null;
public Boolean is_stolen = false;
public Boolean is_emergency = false;
public Boolean is_disabled = false;
public Boolean first_live_gps = false;
public VehicleForReports(String busNameParam, String driverPictureLocationParam, Int32 Color_param, Int32 IconID_param, String Imei_param, Int32 sc_id_param, Int32 veh_id_param, Int32 report_int_param,Boolean is_stolenParam)
{
lastLocLNG = lastLocLAT = 0;
LNG = LAT = 0;
prevLocLNG = prevLocLAT = 0;
busName = busNameParam;
driverPictureLocation = driverPictureLocationParam;
schRunIcons = new ArrayList();
status = 2; // red ligth
alarm = 2; // red alarms
engine = 2; // red ligth
enginelast = 2; // green ligth
sc_id = sc_id_param;
IMEI = Imei_param;
veh_id = veh_id_param;
selectCenter = false;
lastAddress = "";
newStatus = false;
newStatusGPS = false;
Color = (Byte)Color_param;
IconID = IconID_param;
MapsHT = new Hashtable();
veh_hist_color = 0;
act_instance = 0;
gps_interval = report_int_param;
telemList = new List<TelemetryObj>();
needAddress = false;
is_stolen = is_stolenParam;
is_emergency = false;
is_disabled = false;
}
public delegate void UpdateStatusLiveCallBack(String busname);
public delegate void ChangeIconStatusForArrowTypeCallBack(String busname);
public delegate void RemoveIconsFromMapCallBack();
public Boolean RemoveFromMap = false;
/// Sets the address corresponding to the vehicle's last location
/// </summary>
/// <param name="addressParam"></param>
public void SetLastAddress(string addressParam)
{
lastAddress = addressParam;
lastLNGAddr = lastLocLNG;
lastLATAddr = lastLocLAT;
}
public void SetIdxGoogle(string idxParam)
{
idxGoogle = idxParam;
}
public string GetIdxGoogle()
{
return idxGoogle;
}
/// <summary>
/// Sets the vehicle speed
/// </summary>
/// <param name="speedParam"></param>
public void SetSpeed(byte speedParam)
{
vehicleSpeed = speedParam;
}
/// <summary>
/// Sets the time of the last transmission
/// </summary>
/// <param name="timeParam"></param>
public void SetTimeFrist(Int32 timeParam)
{
lastTime = timeParam;
}
/// <summary>
/// Sets the vehicle DI
/// </summary>
/// <param name="diParam"></param>
public void SetDI(byte diParam)
{
DI = diParam;
}
/// <summary>
/// Gets the vehicle DI
/// </summary>
/// <returns></returns>
public byte GetDI()
{
return DI;
}
/// <summary>
/// Sets the vehicle DO
/// </summary>
/// <param name="diParam"></param>
public void SetDO(byte doParam)
{
DO = doParam;
}
/// <summary>
/// Gets the vehicle DO
/// </summary>
/// <returns></returns>
public byte GetDO()
{
return DO;
}
public Int32 GetHeading()
{
return heading;
}
public void SetLAT(double param1)
{
LAT = param1;
}
public void SetLNG(double param1)
{
LNG = param1;
}
public void SetLATandLast(double param1)
{
LAT = param1;
lastLocLAT = param1;
}
public void SetLNGandLast(double param1)
{
LNG = param1;
lastLocLNG = param1;
}
public Boolean GetNewAlarm(Int32 alarmParam)
{
if (alarm != alarmParam)
{
alarm = (byte)alarmParam;
return true;
}
else
{
alarm = (byte)alarmParam;
return false;
}
}
/// <summary>
/// Gets the vehicle DO
/// </summary>
/// <returns></returns>
public Double GetLat()
{
return LAT;
}
/// <summary>
/// Gets the vehicle DO
/// </summary>
/// <returns></returns>
public Double GetLng()
{
return LNG;
}
/// <summary>
/// Gets new engine status for vehicle
/// </summary>
/// <returns>the true if status change</returns>
public Boolean GetNewEngine()
{
if (enginelast != engine)
{
engine = enginelast;
return true;
}
else return false;
}
/// <summary>
/// Gets new engine status for vehicle MOTOTURBO
/// </summary>
/// <returns>the true if status change</returns>
public Boolean GetNewEngine(Int32 newstatus)
{
engine = (byte)newstatus;
if (enginelast != newstatus)
{
enginelast = (byte)newstatus;
return true;
}
else
{
enginelast = (byte)newstatus;
return false;
}
}
}
}