Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug of update of database to version 5 #49

Merged
merged 2 commits into from
Apr 14, 2015
Merged

Conversation

anhr
Copy link
Contributor

@anhr anhr commented Apr 13, 2015

No description provided.

@dexterbg
Copy link
Member

Hi Andrej,

your pull request seems to lack some change, it only contains a new exception thrown (?)

Instead of throwing an exception at that point, which crashes the App just the same way as without that check, there should be a better way. Also, I don't get how db==null could happen there, can you elaborate a bit on this?

Thanks!
Michael

@anhr
Copy link
Contributor Author

anhr commented Apr 14, 2015

Hi Michael,

Thanks for responce. I am beginner in GitHub and this is my first pull. Now I see, someone read my pull and I can continue my researching of your code if you interested.
About one year ago I have downloaded a ZIP of Open-Vehicle-Android project into my local machine I have begun my work for it. Now I want make my contribute into Open-Vehicle-Android project. I have made a clone in desktop of your last version. Now I want merge my work with your last version, but your last version is failed to run on my Android device. I have detected, your version is crashed on my device because db == null. Your version was lauched successfuly on my Android device after my changes. I don't get how db==null could happen there also. Currently my database was updated to version 5 and I can not repeat this problem. I can investigate it if you want. I will glad, if you explain me how to return to database verion 1 for continuing of my researching.

About my work. I have added the 24 hour logged path of the vehicle into Google map. User can see a track of his vehicle for last 24 hours. Also he can see the speed and other values for each location of the car for last 24 hours. Are you interested in my work?

Many bugs was fixed also.

Thanks!
Andrej

I have excluded db==null exception during updating database to version
5. Before  db==null, because database not yet opened during updating
database to version 5. See call stack:

Thread [<1> main] (Suspended (breakpoint at line 540 in Database))
<VM does not provide monitor information>
Database.addNotificationInt(NotificationData) line: 540
Database.onUpgrade(SQLiteDatabase, int, int) line: 172
Database(SQLiteOpenHelper).getDatabaseLocked(boolean) line: 257
Database(SQLiteOpenHelper).getWritableDatabase() line: 164
Database.open() line: 37
Database.getlatlngdetail(int, int) line: 285
MainActivity.updatelocation() line: 423
MainActivity.onCreate(Bundle) line: 65
MainActivity(Activity).performCreate(Bundle) line: 5231
Instrumentation.callActivityOnCreate(Activity, Bundle) line: 1087

ActivityThread.performLaunchActivity(ActivityThread$ActivityClientRecord,
Intent) line: 2159
ActivityThread.handleLaunchActivity(ActivityThread$ActivityClientRecord,
Intent) line: 2245
ActivityThread.access$800(ActivityThread,
ActivityThread$ActivityClientRecord, Intent) line: 135
ActivityThread$H.handleMessage(Message) line: 1196
ActivityThread$H(Handler).dispatchMessage(Message) line: 102
Looper.loop() line: 136
ActivityThread.main(String[]) line: 5017
Method.invokeNative(Object, Object[], Class, Class[], Class, int,
boolean) line: not available [native method]
Method.invoke(Object, Object...) line: 515
ZygoteInit$MethodAndArgsCaller.run() line: 779
ZygoteInit.main(String[]) line: 595
NativeStart.main(String[]) line: not available [native method]

Instead I am updating another instance of database, opened in the
Database(SQLiteOpenHelper).getDatabaseLocked(boolean) function.
@anhr
Copy link
Contributor Author

anhr commented Apr 14, 2015

See my new "bug of update of database to version 5" Commit on Apr 14, 2015

@dexterbg
Copy link
Member

Hi Andrej,

bug and solution are now clear, thanks! Your solution of an add...() with explicit db parameter is good. A writable db is delivered to onUpdate() and needs to be used within the update procedure. Another solution would be to do "this.db = db;" in onUpdate(), but your solution is better, I'll merge that later on.

For your GPS track display, that would be really neat and has already been asked for by other users. Did you base your work on my GPSLogData storage class? That would be perfect as that's intended to be shared between the power history display and the track display. The track display also can use the power/energy info to create a nice energy heatmap like explained in the GPS visualization howto, and the GPSLogData class already contains load/save functions to be able to store some tracks for later comparisons.

Thanks & regards,
Michael

@dexterbg
Copy link
Member

Forgot: there is no real db downgrade procedure, you can only set the version tag to let the onUpgrade() be run again. To do so, set the SCHEMA_VERSION to the lower version, launch once, then raise the version again and launch again. The onUpgrade() should be called again and needs to be able to handle already existing upgrade structs.

dexterbg added a commit that referenced this pull request Apr 14, 2015
bug of update of database to version 5
@dexterbg dexterbg merged commit 05289c2 into openvehicles:master Apr 14, 2015
@dexterbg
Copy link
Member

Andrej, would you mind joining the OVMS developer mailing list?
http://lists.teslaclub.hk/mailman/listinfo/ovmsdev
No noise there, just developers ;)

@anhr
Copy link
Contributor Author

anhr commented Apr 15, 2015

I have joined. Thanks.

Вторник, 14 апреля 2015, 10:14 -07:00 от Michael Balzer [email protected]:

Andrej, would you mind joining the OVMS developer mailing list?
http://lists.teslaclub.hk/mailman/listinfo/ovmsdev
No noise there, just developers ;)

Reply to this email directly or view it on GitHub .

@anhr
Copy link
Contributor Author

anhr commented Apr 15, 2015

I did not develop the server side of the OVMS project. Another guy - Lee Howard [email protected] wrote it. Attached is the patch for the perl code which is made to the server to support the logged path.

We have added new command:
Please refer to pages 24 through 30 of OVMS_Protocol.pdf where it discusses
"Commands and Expected Responses". To retrieve 24-hour log data for a
vehicle it is similar to "32 - Request historical data records". The

documentation for "Retrieve 24-hour log data" should read:

33 -­ Retrieve 24-hour log data
Command parameters are:

  • code (the record type to retrieve)
    Response is a sequence of individual messages with each message containing
    the following parameters:
  • response record number
  • maximum number of response records
  • data code type
  • data record timestamp

* data record value

The "code" can be any of those described on pages 10 through 23,
however, for GPS location you will want to use code "L" as described on
page 21.
On the OVMS "Location" screen I would like there to be an option appear
under "Options" that says "Turn Logged Path ON". When it is pressed it
should change to "Turn Logged Path OFF". By default, the logged path is
not displayed until the user presses "Turn Logged Path ON". If the user
then presses "Turn Logged Path OFF" it should return to the default of
only displaying the current location.
Понедельник, 13 апреля 2015, 23:54 -07:00 от Michael Balzer [email protected]:

Hi Andrej,
bug and solution are now clear, thanks! Your solution of an add...() with explicit db parameter is good. A writable db is delivered to onUpdate() and needs to be used within the update procedure. Another solution would be to do "this.db = db;" in onUpdate(), but your solution is better, I'll merge that later on.
For your GPS track display, that would be really neat and has already been asked for by other users. Did you base your work on my GPSLogData storage class? That would be perfect as that's intended to be shared between the power history display and the track display. The track display also can use the power/energy info to create a nice energy heatmap like explained in the GPS visualization howto, and the GPSLogData class already contains load/save functions to be able to store some tracks for later comparisons.
Thanks & regards,
Michael

Reply to this email directly or view it on GitHub .

@markwj
Copy link
Member

markwj commented Apr 15, 2015

If someone wants to set this patch up as a pull request for the main ovms_server.pl, I'd be happy to bring it in.

@dexterbg
Copy link
Member

That's a useful server extension. I'll have a look if we can extend the L records by the power data, so we can produce some heatmap from those records as well.

For the options menu, please have a look at my latest changes -- I replaced those text switching menus by standard checkbox items.

@anhr
Copy link
Contributor Author

anhr commented Apr 25, 2015

Hello,

Do you saw:
I have removed some strings from resources #54
#54 My location button
anhr@6a99d3f

Can you comment this?

Andrej

Понедельник, 13 апреля 2015, 23:54 -07:00 от Michael Balzer [email protected]:

Hi Andrej,
bug and solution are now clear, thanks! Your solution of an add...() with explicit db parameter is good. A writable db is delivered to onUpdate() and needs to be used within the update procedure. Another solution would be to do "this.db = db;" in onUpdate(), but your solution is better, I'll merge that later on.
For your GPS track display, that would be really neat and has already been asked for by other users. Did you base your work on my GPSLogData storage class? That would be perfect as that's intended to be shared between the power history display and the track display. The track display also can use the power/energy info to create a nice energy heatmap like explained in the GPS visualization howto, and the GPSLogData class already contains load/save functions to be able to store some tracks for later comparisons.
Thanks & regards,
Michael

Reply to this email directly or view it on GitHub .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants