-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Add WlanApi module #1697
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
base: master
Are you sure you want to change the base?
Add WlanApi module #1697
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, I made a first pass. Please have a look at the inline comments.
| } | ||
|
|
||
| int WlanOpenHandle(int dwClientVersion, Pointer pReserved, IntByReference pdwNegotiatedVersion, | ||
| PointerByReference phClientHandle); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| PointerByReference phClientHandle); | |
| HANDLEByReference phClientHandle); |
| @Override | ||
| protected List<String> getFieldOrder() { | ||
| return Arrays.asList("dwNumberOfItems", "dwIndex", "InterfaceInfo"); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use @FieldOrder annotation. See https://github.com/eranl/jna/blob/4073685fec63fb1418ed42d5c0cf4037251f96aa/contrib/platform/src/com/sun/jna/platform/win32/WinCrypt.java#L51-L104 for an example. Applies to all structures.
| @@ -0,0 +1,188 @@ | |||
| package com.sun.jna.platform.win32; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The license header is missing (see for example
jna/contrib/platform/src/com/sun/jna/platform/win32/Crypt32.java
Lines 1 to 23 in dc44b98
| /* Copyright (c) 2010 Daniel Doubrovkine, All Rights Reserved | |
| * | |
| * The contents of this file is dual-licensed under 2 | |
| * alternative Open Source/Free licenses: LGPL 2.1 or later and | |
| * Apache License 2.0. (starting with JNA version 4.0.0). | |
| * | |
| * You can freely decide which license you want to apply to | |
| * the project. | |
| * | |
| * You may obtain a copy of the LGPL License at: | |
| * | |
| * http://www.gnu.org/licenses/licenses.html | |
| * | |
| * A copy is also included in the downloadable source code package | |
| * containing JNA, in file "LGPL2.1". | |
| * | |
| * You may obtain a copy of the Apache License at: | |
| * | |
| * http://www.apache.org/licenses/ | |
| * | |
| * A copy is also included in the downloadable source code package | |
| * containing JNA, in file "AL2.0". | |
| */ |
| class WLAN_INTERFACE_INFO extends Structure { | ||
| public GUID InterfaceGuid; | ||
| public char[] strInterfaceDescription = new char[WLAN_MAX_NAME_LENGTH]; | ||
| public int isState; // WLAN_INTERFACE_STATE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please make this javadoc, then people might see this in IDE help. I.e.:
/**
* See {@link WLAN_INTERFACE_STATE} for possible values
*/
public int isState;This applies to other similar constructs in here.
| return Arrays.asList("dwNumberOfItems", "dwIndex", "InterfaceInfo"); | ||
| } | ||
|
|
||
| public void read() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing @Override
| public int wlanConnectionMode; // WLAN_CONNECTION_MODE | ||
| public char[] strProfileName = new char[WLAN_MAX_NAME_LENGTH]; | ||
| public WLAN_ASSOCIATION_ATTRIBUTES wlanAssociationAttributes; | ||
| // Other fields omitted |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will break hard, if there is ever a use in an array or embedded inside another structure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it acceptable to just add a warning about this in the doc, or should I complete these structures?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If necessary I can live with a warning, on the other hand here is a single field missing which is admittedly a structure itself, but that is also not that big.
| class HANDLE extends WinNT.HANDLE { | ||
| public HANDLE() { | ||
| } | ||
|
|
||
| public HANDLE(Pointer p) { | ||
| super(p); | ||
| } | ||
| } | ||
|
|
||
| class GUID extends Guid.GUID {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These redefinitions are not necessary and should not be here.
This is a partial mapping of
WlanApi.h.