using System; using System.Collections; using System.Windows.Forms; using System.Resources; using System.Collections.Generic; using SafeMobileLib; namespace ReportsLibrary { public class Vehicle { 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 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 Vehicle(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(); 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 /// /// public void SetLastAddress(string addressParam) { lastAddress = addressParam; lastLNGAddr = lastLocLNG; lastLATAddr = lastLocLAT; } public void SetIdxGoogle(string idxParam) { idxGoogle = idxParam; } public string GetIdxGoogle() { return idxGoogle; } /// /// Sets the vehicle speed /// /// public void SetSpeed(byte speedParam) { vehicleSpeed = speedParam; } /// /// Gets the vehicle speed /// /// public byte GetSpeed() { if (StaticMembers.isInMile) return (byte)(vehicleSpeed * 0.621371192); else return vehicleSpeed; } /// /// Sets the time of the last transmission /// /// public void SetTimeFrist(Int32 timeParam) { lastTime = timeParam; } /// /// Sets the vehicle DI /// /// public void SetDI(byte diParam) { DI = diParam; } /// /// Gets the vehicle DI /// /// public byte GetDI() { return DI; } /// /// Sets the vehicle DO /// /// public void SetDO(byte doParam) { DO = doParam; } /// /// Gets the vehicle DO /// /// 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; } } /// /// Gets the vehicle DO /// /// public Double GetLat() { return LAT; } /// /// Gets the vehicle DO /// /// public Double GetLng() { return LNG; } /// /// Gets new engine status for vehicle /// /// the true if status change public Boolean GetNewEngine() { if (enginelast != engine) { engine = enginelast; return true; } else return false; } /// /// Gets new engine status for vehicle MOTOTURBO /// /// the true if status change public Boolean GetNewEngine(Int32 newstatus) { engine = (byte)newstatus; if (enginelast != newstatus) { enginelast = (byte)newstatus; return true; } else { enginelast = (byte)newstatus; return false; } } } }