Android auto getting RPM data - java

Ive looked everywhere for a solution to read RPM data on Android Auto with Android studio. Found no solution. I was hoping someone has more experience in this field and could point me in the right direction.
I tried to use CarHardwareManager and looked into CarPropertyManager but I cannot find any proper documentation on how to implement an RPM listener of some sort.
My end goal is to have a listener that will receive the current RPM the vehicle is at.
Please help! Thank you!

There is this function that you can use to get properties.
CarPropertyManager.getProperty()
You need to use constants defined in VehiclePropertyIds. Here goes the one that could do the trick:
VehiclePropertyIds.ENGINE_RPM. Note that this requires certains permissions.
Also the function seems to take a areaId argument. It's a little confusing but using CarPropertyManager.getAreaId(ENGINE_RPM, VEHICLE_AREA_TYPE_WHEEL) may yield the required value. Please double-check it as I cannot test it myself.
CarPropertyManager.getProperty(propertyId, areaId). This should return a CarPropertyValue. Then you can use getValue().
As for the listener, you may implemented this interface to listen for changes in such properties.
CarPropertyManager.CarPropertyEventCallback
CarPropertyManager.registerCallback(callback, propertyId, refreshRate)
I'll link to registerCallback documentation https://developer.android.com/reference/android/car/hardware/property/CarPropertyManager#registerCallback(android.car.hardware.property.CarPropertyManager.CarPropertyEventCallback,%20int,%20float)

Related

Is it possible to create a custom screen GUI in Bukkit?

I'm wondering if it's possible to add some custom screen GUI's to my Bukkit server. So I can display a lot of text on someone's screen. Or do I need to find another option to do this?
Thanks!
The only practical way is to use an Inventory using blocks with name and lore for users to click on as can be seen here
As Cole Nelson mentioned, a custom inventory with lore displayed might work. A good guide for that can be found on the bukkit forums, and although it's a bit outdated it should still provide useful information.
Another possibility would be to utilize title screens; obviously those can't hold a ton of information, but the player is pretty much guaranteed to notice them immediatly.
I recommend using Title Api, as it's a bit tedious to directly work with packets.
Once you added the jar to your project and set the dependency, simply use:
TitleAPI.sendTitle(player,fadeIn,stay,fadeOut,"Title","Subtitle");
to send a title with all corresponding attributes.
Example result:

Trasparent intro overlay to introduce user the app

I was wondering to create something like a setup wizard for when the user first starts my app. This is needed due to the complexity of the app to help the user. Searching for something like this I found a library that isn't a setup wizard, but lets you point an element on the screen and give some info about it.
The library is this link. (Showcase View Library by Espin)
I'm able to show one indication using this, but I can't concatenate more than one indication, you know, the first is shown, you pulse next and goes to the nex indication, this way until you arrive to the end and pulse finish.
Looking for any tutorial or step-by-step guide that could help me doing this, I found one, but it was done with old code, and the newest version of the library has some changes that doesn't fit the example. I've tried modifiying the code of this example to match with the new version of the library, but I don't get to view the indication one by one, I just get all them overlapped.
This is the link to the library's ShowcaseView class where all this logic is defined: ShowcaseView.java
And this is how the doc says to implement it ot your app:
new ShowcaseView.Builder(this)
.setTarget(new ActionViewTarget(this, ActionViewTarget.Type.HOME))
.setContentTitle("ShowcaseView")
.setContentText("This is highlighting the Home button")
.hideOnTouchOutside()
.build();
Has someone worked with this library and knows how could I concatenate few indications?
What's missing in v5
ShowcaseViews: the class which queues up ShowcaseViews in a
tutorial-type method. I never really liked this class (generally, you
should use SCV sparingly); I'll add it back in based on the Builder
class when I can.
So either:
implement it by yourself and submit a pull request.
Or wait for the next release.
Or use v4
Or submit an issue on github to directly ask the author when this will be released.

How to use "Simple Validation API" to validate Java Swing forms in Netbeans

I have downloaded and installed the "Simple Validation" NetBeans Plug-in, but do not know how to use it, because I cannot find where is it present (in toolbox).
Can anyone kindly help me by telling how where can I find it and what are the steps to apply the validation on my form fields.
I also saw there was a Validation API JAR file and I downloaded and included it in my project. It provided 3 controls (or whatever I should say); "ValidationPanel", "ValidationUtils" and "Problems". I saw an example at a website & followed it. I dragged-and-dropped the "ValidationPanel" and wrote the code as shown in following code
final ValidationGroup group = validationPanel1.getValidationGroup();
group.add(txtUserName, Validators.REQUIRE_NON_EMPTY_STRING,
Validators.NO_WHITESPACE,
Validators.REQUIRE_VALID_INTEGER);
But it seems JAR file contains incomplete files or there may be other problem, because it gives error: cannot find symbol: variable "Validators"
I am sorry I think these are 2 questions, but kindly help me how to solve it.
Thanks in advance
You just want the "ValidationPanel".
It seems to be called "org.netbeans.validation.api.builtin.stringvalidation.StringValidators" now.
final ValidationGroup group = validationPanel1.getValidationGroup();
group.add(txtUserName, StringValidators.REQUIRE_NON_EMPTY_STRING,
StringValidators.NO_WHITESPACE,
StringValidators.REQUIRE_VALID_INTEGER);
What you're doing with those lines is creating a validation group and adding a field with 3 validation rules but you still need a way to show that on screen.
Simple validation API provides 2 built-in UI helpers that I'm aware of, you can either use the org.netbeans.validation.api.ui.swing.ValidationPanel or the org.netbeans.validation.api.ui.swing.SwingValidationGroup.createProblemLabel(), otherwise you'll have to implement your own UI widget with the org.netbeans.validation.api.ui.ValidationUI interface.
ValidationPanel creates a JPanel to hold your input controls plus ok and cancel buttons plus the label to show the error messages.
On the other hand you have the ProblemLabel which is the easiest implementation and for me it works in most common cases, here's a little example:
SwingValidationGroup group = SwingValidationGroup.create();;
group.add(txtUserName, Validators.REQUIRE_NON_EMPTY_STRING,
Validators.NO_WHITESPACE,
Validators.REQUIRE_VALID_INTEGER);
JComponent validationLabel = group.createProblemLabel();
contentPanel.add(validationLabel);
That way you have the validationLabel that you can add to any other container like a JPanel or to the form itself, in this case I have a panel named contentPanel that I attach the problem label to.
Hope this clarifies it a little bit as this is an awesome API with poor documentation.
Did you import the required package?

Find lldp informations using snmpwalk or another method

I want to build a java tool that extracts lldp informations of some devices (switches, routers, etc) to make a 'topology map'.
Trying snmpwalk, i found only useless informations (for this case).
I think lldp mib is 1.0.8802.1.1.2, but i'm not sure.
Anyone knows how to extract this, using snmpwalk or another method?
Thanks in advance.
According to IEEE 802 MIB document, what append when you try to walk on this OID :
1.0.8802.1.1.2.1
I stands for :
iso std(0) iso8802(8802) ieee802dot1(1) ieee802dot1mibs(1) lldpMIB(2) lldpObjects(1)
This can be done via SNMPWALK. IF-MIB/IP-MIB are the generic MIBs that will provide you with good enough data to build something like that. If its just for Cisco than CDP-MIB will give you everything that you would need. Let me know if you are trying to make something vendor neutral.

SVNClient.logMessages never returns a result

I'm using JavaHL to connect to a 1.6 svn repos. While I managed to list the contents of the repository, I'm not able to get the item history (the comments made on the check ins as well as the dates and the authors).
As far as I see, SVNClient.logMessages is the right method, but the callback method is never been executed. I used Revision.HEAD for the path revision and a revision range object holding Revision.START and Revision.HEAD; the limit is set to 0 (which is no limit according to the documentation). I'm trying to fetch the revision, the date, the author and the comment.
If someone knows about example code on using JavaHL I'm maybe able to find my fault by comparing that code to mine.
BTW: I know about SVNKit, but the management decided not to buy it. Thus I have to use JavaHL, where next-to-no sample programs exist (and the doc will merely list the classes and interfaces without a very detailed description). So, please point me in that direction of SVNKit as this is impossible for me.
Any pointers appreciated.
Gnarf
The issue has been solved. The problem was the call to SVNClient.logMessages(), especially the revision range used.
The start revision had been Revision.START that, according to the documentation, is used to describe the "first existing revision".
The problem disappeared when I used Revision.getInstance(1) instead. As it is reasonable that any item has at least one revision (the initial one) with that number, it should be save to use that.
Hopefully this will save anyone else from spending another two-and-a-half days to figure it out!
Gnarf

Categories

Resources