Geotab Support Forum


Edit device error
Last Post 09 Feb 2012 04:53 PM by Aaron. 10 Replies.
Printer Friendly
Sort:
PrevPrev NextNext
Author Messages
ashort
Posts:155

--
31 Jan 2012 11:14 AM QuoteQuote ReplyReply
Using the API, we have been able to add additional non Geotab devices and integrate the GPS data into Checkmate. The way this was accomplished was to add a device using a device type of DeviceTypes.None. Everything seems to work fairly well, except when editing one of these devices, an error is thrown from the Edit Device screen.

Below is the exception information when editing device info from Checkmate. Is there a way to get around this error, or a better way to add devices into Checkmate? The reason is to be able to track vehicles (Geotab GO4) and personal tracker devices (non-Geotab) as well seamlessly in the same application.



Cause: EX7DF5EECB: DeviceType is not consistent with Device object model



ThrowLevel: 0 >>>>>>

Exception: EX0188513C System.ArgumentException

Message: DeviceType is not consistent with Device object model

StackTrace:

at Geotab.Checkmate.Database.DeviceBridge.ValidateRequiredFields(Device value)

at Geotab.Checkmate.Database.DeviceBridge.Set(Device oldValue, Device newValue)

at Geotab.Checkmate.Database.SqlStore.Set[T](T oldEntity, T newEntity)

at Geotab.Checkmate.Forms.Devices.DeviceEdit.UpdateDatastore()

at Geotab.Checkmate.Forms.Devices.DeviceEdit.okButton_Click(Object sender, EventArgs e)

at System.Windows.Forms.Control.OnClick(EventArgs e)

at System.Windows.Forms.Button.WndProc(Message& m)

at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)

at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

<<<<<<


David Kyes
Administrator
Posts:20

--
31 Jan 2012 01:55 PM QuoteQuote ReplyReply
Are you adding the device as a CustomDevice?
Could you show me the code where you create and add the device to the datastore.
David Kyes
Administrator
Posts:20

--
31 Jan 2012 02:05 PM QuoteQuote ReplyReply
This issue is fixed in our upcoming release of checkmate.
I have also created a fix for 5.5 sp2
You can download the latest builds below. You will need version 21706 or greater.
http://update.geotab.com/builds/5.5.1/auto/
ashort
Posts:155

--
31 Jan 2012 02:45 PM QuoteQuote ReplyReply
Thanks. I will check out that build when it comes out. In the meantime, here is the code I am using to create the device.


device = new Device();
device.AddDefaults(DeviceTypes.None);
device.Name = name;
device.DeviceType = DeviceTypes.None;
device.HardwareId = hardwareId;
dataStore.Add(device);
David Kyes
Administrator
Posts:20

--
31 Jan 2012 02:54 PM QuoteQuote ReplyReply
ok, I see what was happening. The new build should resolve your issue.

The "Device" gets retrieved from the database as a "CustomDevice" (based on productId). When you edit the device if was checking for a specific DeviceType. I have changed it to allow DeviceType.None.
ashort
Posts:155

--
09 Feb 2012 09:20 AM QuoteQuote ReplyReply
I have updated to build 21774 and that build resolved the issue with being able to save changes from Device Admin to a custom device. However, now a different error is being thrown when Trips History is run. In a test environment, I have narrowed it down to iProductID field on the vehicle table. If I change this value to anything but NULL, Trips History executes without error. However, when a device is added with DeviceType of DeviceType.None, the iProductID is NULL by default. I also get a related but different error when the 'Summary' button is clicked. Any suggestions?


Cause: EX23813B3B: Object reference not set to an instance of an object.

ThrowLevel: 0 >>>>>>

Exception: EXDDA95B5D System.NullReferenceException

Message: Object reference not set to an instance of an object.

StackTrace:

at Geotab.Checkmate.Forms.Reports.TripsReport.LoadDetailRows(ReportType theReportType, TripActivityDetailViewingArgument detailViewingArgument, Boolean includeAuxiliary)

at Geotab.Checkmate.Forms.Reports.TripsReport.LoadDetailReport()

at Geotab.Checkmate.Forms.Reports.TripsReport.LoadReport(Object TripsData)

at Geotab.Checkmate.Forms.Reports.TripsReport.OnReportGenerationChanged(ProgressChangedEventArgs e)

<<<<<<



User: ASHORT@ASHORT-HP

Application: Checkmate.exe

Version: VE62100D66 5.5.1.21774

Revision: BU9E50DF2D 5.5.1

Minor: MI60C5807C 5.5

Path: C:\Users\ASHORT\AppData\Local\Apps\2.0\DJG6CX4Y.NOC\L8J9G87N.TRR\mi63..3996_4893c61d6e8984ff_0005.0005_42174585d5171f70\Checkmate.exe

OS: Microsoft Windows NT 6.1.7601 Service Pack 1

IE Version: 9.0.8112.16440

Region: United States

CultureName: English (United States) LCID1033

Database: SQL Server; DB Version: 88.53; Path:





-----------------------------------------------------------------------------
After clicking Summary:

Cause: EX56A0DED8: Specified cast is not valid.



ThrowLevel: 0 >>>>>>

Exception: EXBEDF8552 System.InvalidCastException

Message: Specified cast is not valid.

StackTrace:

at Geotab.Checkmate.Database.TripBridge.LookupDevice(IDataReader reader, Int32 deviceId, IEnumerable`1 devices)

at Geotab.Checkmate.Database.TripBridge.GetTripSummary(ICollection`1 trips, ICollection`1 nodes, ICollection`1 devices, ICollection`1 drivers, DateTime fromDate, DateTime toDate, Boolean lastOnly, Boolean includeExceptions, Boolean includeEarthPoints, Boolean includeOverlappedTrips, Boolean includeExceptionInstances)

at Geotab.Checkmate.Database.SqlStore.GetTripsSummary(ICollection`1 trips, ICollection`1 nodes, ICollection`1 devices, DateTime fromDate, DateTime toDate, Boolean includeExceptions, Boolean includeEarthPoints, Boolean includeOverlappedTrips, Boolean includeExceptionInstances)

at Geotab.Checkmate.Activity.ActivityCalculator.TripActivityCalculator.GetDeviceDriverActivity(ICollection`1 trips)

at Geotab.Checkmate.Activity.ActivityCalculator.TripActivityCalculator.GetSummaryDrafts(ICollection`1 drafts)

at Geotab.Checkmate.Activity.ActivityCalculator.TripActivityCalculator.GetSummary(ICollection`1 results, TripActivityArgument activityArgument)

at Geotab.Checkmate.Activity.Reporting.TripsReportExecutor.GetActivitySummary(List`1 activitySummaries, TripActivityArgument tripActivityArgument)

at Geotab.Checkmate.Activity.ReportExecutor.GetReportImpl(Object argument, MapEngineFactory mapEngineFactory, ReportTemplate template, IDateConverter dateConverter, Boolean isMetric, String& excelPath, Boolean& sendReport)

at Geotab.Checkmate.Forms.Reports.TripsReport.TripsReportGenerationWithWorker.GetActivity(DataStore dataStore, TripActivityReportingArgument activityArgument)

at Geotab.Checkmate.Forms.Reports.TripsReport.OnReportGenerationDoWork(BackgroundWorker worker, DoWorkEventArgs e)

at Geotab.Checkmate.Forms.Reports.ReportForm.reportGenerationWorker_DoWork(Object sender, DoWorkEventArgs e)

at System.ComponentModel.BackgroundWorker.WorkerThreadStart(Object argument)

<<<<<<

Aaron
Moderator
Posts:29

--
09 Feb 2012 10:24 AM QuoteQuote ReplyReply
Does the trips summary error also happen when the productId is null, or is it populated?
ashort
Posts:155

--
09 Feb 2012 11:17 AM QuoteQuote ReplyReply
Both errors only happen when the iProductID is NULL. When it is any value but NULL, neither error occurs.
Aaron
Moderator
Posts:29

--
09 Feb 2012 02:36 PM QuoteQuote ReplyReply
I tried this on some sample data with a custom device set up much like above, and can't seem to reproduce this even with trips associated with a custom device I made.

In fact, the only way that the second error would happen is if the device is not returned when calling the database for all devices. So there may be something different between your devices and mine.

In other words, the productId should be irrelevant to displaying the report as long as the device is in the database, but for some reason it isn't.

If you can, send some more details of the device. If not, have a look at some samples I made in a test database, and see if anything is different with respect to NULLs:


iID     sSerialNo       iHardwareID     sDescription    iVehicleCategoryID      iProductID
1       990000007B     123                 Hwllo             NULL                          NULL
3       8A00000064     100                 Hello2            NULL                          NULL
4       95000001B2     434                 Hello43           NULL                          NULL
ASHORT
Posts:155

--
09 Feb 2012 03:29 PM QuoteQuote ReplyReply
I just realized that at some point recently I had checked 'Include Auxilaries' in the Trips Detail Options. When this option is unchecked, there are no errors retrieving data from custom devices. However, with this option checked, it causes issues when retrieving trip history for devices where iProductID is NULL. I double checked the data in the Vehicle table, and it resembles what you have posted.
Aaron
Moderator
Posts:29

--
09 Feb 2012 04:53 PM QuoteQuote ReplyReply
Thanks for the info, I was able to reproduce what you were experiencing.

I'm made a fix to this, and it should be up on the builds page soon. Look for something with a revision number 21814 or greater.

http://update.geotab.com/builds/5.5.1/auto/

Let me know if this fixes the issue.


Quick Reply
toggle
  Username:
Subject:
Body:

Submit
Active Forums 4.2