I'm trying to write a program which creates hotspot. I'm using WlanHostedNetworkStartUsing but it returns ERROR_INVALID_STATE. And yet when I call WlanHostedNetworkInitSettings it returns succsess. According to documemtation (last paragraph in Remarks section) it should to create a virtual wireless connection under Control Panel\Network and Internet\Network and Sharing Center but it doesn't.
I've searching a bit and found this:
When I run netsh wlan show drivers it puts:
Driver : Intel(R) Dual Band Wireless-AC 3165
Vendor : Intel Corporation
Provider : Intel
Date : 07-Sep-16
Version : 19.20.0.6
INF file : ????
Type : Native Wi-Fi Driver
Radio types supported : 802.11b 802.11g 802.11n 802.11a 802.11ac
/ ...
Hosted network supported : No <--- Here
/ ...
So it says my wifi adapter doesn't wifi sharing at all (I have last drivers from HP site).
BUT when I try to create hotspot with Windows 10 builtin' tool it works.
The question: How could windows tool do it and how can I use this mechanism in my app?
Original 06/06/2018 comments here (see updates below):
Microsoft deprecated the WLAN HostedNetwork capability and it is NOT
available for Win10 drivers. To use the old model in Win10 you must
find and install drivers from 2015 (8.1 or possibly earlier depending
on vendor).
The Win10 driver model changed the mechanism of HostedNetwork to be
based on WiFi Direct, and took control away from app-developers and
moved this feature to the kernel. There are some samples available if
you dig around, that show how to use the modern-com (RT) UWP app
libraries to configure a WiFi Direct HostedNetwork. It is a PITA,
which was not explained by Microsoft, is not understood by most people
commenting on this in the web, and which mostly looks like a two-step
microsoft failure where product features were cut to make ship
schedule and re-orgs among teams changed the ownership and plan for
WiFi and hotspots. WiFi direct enables - theoretically - a simpler
pairing and authentication model between devices. But the currently
implementation involves bluetooth and therefore it is questionable
other than support a limited mobile device WiFi 2.0 scenario. If you
are working with headless devices or IoT device scenarios this is
broken.
I've had to do a lot of work in this area. If you have a choice in
WiFi hardware, I strongly recommend a hardware chipset that uses the
Intel drivers (they are solid).
You may find this App store app helpful if your scenario allows for UX
interaction.
http://www.topuwp.com/windowsapps/wifi-direct-access-point/598084.html
====================
02/27/2020 Update to that story...
When Hosted network supported : No then legacy hosted network support is not available on your adapter because you have WiFi Direct in Windows 10 etc. In which case you'll want to know and use this very sparsely commented on supported portion of WiFi Direct:
https://learn.microsoft.com/en-us/uwp/api/windows.networking.networkoperators.networkoperatortetheringmanager.createfromconnectionprofile
Command Line to HotSpot settings: start ms-settings:network-mobilehotspot
Article that talks about PowerShell programmatic access to the WinRT HotSpot APIs
enable Win10 inbuild hotspot by cmd/batch/powershell
KEYWORDS: "Virtual Wi-Fi", SoftAP, AdHoc IBSS, MobileHotSpot, netsh wlan HostedNetwork
====================
Which would not be complete without a working C++/WinRT code sample as follows:
#include <winrt/Windows.Networking.Connectivity.h>
#include <winrt/Windows.Networking.NetworkOperators.h>
#include <winrt/Windows.Devices.WiFiDirect.h>
#include <winrt/Windows.Security.Credentials.h>
namespace winrt { // /ZW embed in :<winrt> when `Windows` is ambiguously defined
static void af_winrt_wifi_hotspot_test() {
// start ms-settings:network-mobilehotspot
init_apartment(); // apartment_type::multi_threaded
if (false /* play as you wish to test this all in simple c++ console app, I used clang */) {
auto publisher = Windows::Devices::WiFiDirect::WiFiDirectAdvertisementPublisher();
auto advertisement = publisher.Advertisement();
advertisement.ListenStateDiscoverability(Windows::Devices::WiFiDirect::WiFiDirectAdvertisementListenStateDiscoverability::Intensive);
advertisement.IsAutonomousGroupOwnerEnabled(true);
auto legacySettings = advertisement.LegacySettings();
legacySettings.IsEnabled(true);
legacySettings.Ssid(L"your-hotspot-name");
auto credential = Windows::Security::Credentials::PasswordCredential(); credential.Password(L"the-password!");
legacySettings.Passphrase(credential);
publisher.Start();
}
else {
auto connectionProfile{ Windows::Networking::Connectivity::NetworkInformation::GetInternetConnectionProfile() };
auto tetheringManager = Windows::Networking::NetworkOperators::NetworkOperatorTetheringManager::CreateFromConnectionProfile(connectionProfile);
auto credential = Windows::Security::Credentials::PasswordCredential(); credential.Password(L"the-password!");
auto conf = Windows::Networking::NetworkOperators::NetworkOperatorTetheringAccessPointConfiguration();
conf.Ssid(L"I-Own-You"); conf.Passphrase(credential.Password());
auto oldConf = tetheringManager.GetCurrentAccessPointConfiguration();
auto oldSsid = oldConf.Ssid(); auto oldPwd = oldConf.Passphrase();
tetheringManager.ConfigureAccessPointAsync(conf); // Sets new ssid/pwd here
switch (tetheringManager.TetheringOperationalState()) {
case Windows::Networking::NetworkOperators::TetheringOperationalState::Off: {
auto ioAsync = tetheringManager.StartTetheringAsync();
auto fResult = ioAsync.get();
}
break;
case Windows::Networking::NetworkOperators::TetheringOperationalState::On: {
// auto ioAsync = tetheringManager.StopTetheringAsync();
// auto fResult = ioAsync.get();
}
break;
case Windows::Networking::NetworkOperators::TetheringOperationalState::InTransition:
default:
break;
}
}
clear_factory_cache();
uninit_apartment();
}
}
Look here for older Microsoft Samples relating to WiFiDirectAdvertisementPublisher:
C++ WiFiDirectLegacyAPDemo_v1.0.zip on Microsoft Page
C# Microsoft IoT Sample OnboardingAccessPoint.cs on GitHub Page
mobile broadband networks, use IMbnConnectionProfileManager::CreateConnectionProfile
Wi-Fi networks, use WlanSetProfile function
Mobile Hotspot XML WFD_GROUP_OWNER_PROFILE profile is in this dir-path: C:\ProgramData\Microsoft\Wlansvc\Profiles\Interfaces\
So many articles on the web, so much confusion created by WiFi-Direct.
I've spent two whole days figuring it all out. Which, for my time, is a lot.
No excuse for Microsoft (where I use to work as an Architect) not having created a Blog about this very popular topic. Let alone simply having made netsh and Ad Hoc Wifi compat support, instead of leaving it so cryptic and confusing for devops, end-users, and developers.
-- enjoy David
The above is pretty concise, and exposes working c++/WinRT code for all scenarios.
[I now have this bundled in EdgeS: EdgeShell/EdgeScript/afm-scm toolset]
[]5
Your computer does not support hosted network.
Because of that, this won't work.
Open command prompt as admin and try these commands:
netsh wlan set hostednetwork mode=allow ssid=“OSToto Hotspot” key=“12345678”
The ssid is the name of your network and the key is the password. You can name them like the above command.
Then run:
netsh wlan start hostednetwork
Rest before saying anything else, I would like to got through your source code.
Related
I'm currently developing a simple application for querying/retrieving data on a PACS. I use DCMTK for this purpose, and a DCM4CHEE PACS as test server.
My goal is to implement simple C-FIND queries, and a C-MOVE retrieving system (coupled with a custom SCP to actually download the data).
To do so, I've created a CustomSCU class, that inherits the DCMTK DcmSCU class.
I first implemented a C-ECHO message, that worked great.
Then, I tried to implement C-FIND requesting, but I got the error "DIMSE No valid Presentation Context ID" (more on that in the next paragraph) from my application, but no other log from DCM4CHEE. I've then used the command tool findscu (from dcmtk) to see if there was some configuration issue but the tool just worked fine. So in order to implement my C-FIND request, I've read the source of findscu (here) and adapted it in my code (meaning that i'm not using DcmSCU::sendCFindRequest but the class DcmFindSU).
But now, i'm facing the same problem with C-MOVE request. My code is pretty straight-forward :
//transfer syntaxes
OFList<OFString> ts;
ts.push_back(UID_LittleEndianExplicitTransferSyntax);
ts.push_back(UID_BigEndianExplicitTransferSyntax);
ts.push_back(UID_LittleEndianImplicitTransferSyntax);
//sop class
OFString pc = UID_MOVEPatientRootQueryRetrieveInformationModel;
addPresentationContext(pc, ts);
DcmDataset query;
query.putAndInsertOFStringArray(DCM_QueryRetrieveLevel, "PATIENT");
query.putAndInsertOFStringArray(DCM_PatientID, <ThePatientId>);
OFCondition condition = sendMOVERequest(findPresentationContextID(pc, ""), getAETitle(), &query, nullptr);
return condition.good();
I've also tried using UID_MOVEStudyRootQueryRetrieveInformationModel instead of UID_MOVEPatientRootQueryRetrieveInformationModel, with the same result : my application shows the error
DIMSE No valid Presentation Context ID
As I understand, a presentation context is concatenation of one or more transfer syntax and one SOP class. I read that the problem could come from the PACS that won't accept my presentation contexts. To be sure, I used the movescu tool (from DCMTK). It worked, and I saw this in the logs from de server DCM4CHEE :
received AAssociatedRQ
pc-1 : as=<numbers>/Patient Root Q/R InfoModel = FIND
ts=<numbers>/Explicit VR Little Endian
ts=<numbers>/Explicit VR Big Endian
ts=<numbers>/Implicit VR Little Endian
That means that the movescu tool does a find before attempting an actual move ?
Therefore, I changed my application context creation with :
OFList<OFString> ts;
ts.push_back(UID_LittleEndianExplicitTransferSyntax);
ts.push_back(UID_BigEndianExplicitTransferSyntax);
ts.push_back(UID_LittleEndianImplicitTransferSyntax);
OFString pc1 = UID_FINDPatientRootQueryRetrieveInformationModel;
OFString pc = UID_MOVEPatientRootQueryRetrieveInformationModel;
addPresentationContext(pc1, ts);
addPresentationContext(pc, ts);
(also tried study root)
But this didn't do the trick.
The problem seems to lie on the client side, as findPresentationContextID(pc, ""); alwasy return 0, no matter what.
I don't feel like it's possible to adapt the code of the movescu tool, as it appears to be very complex and not adequat for simple retrieve operations.
I don't know what to try. I hope someone can help me understand what's going on. That's the last part of my application, as the storage SCP already works.
Regards
It looks like you are not negotiating the association with the PACS.
After adding the presentation contexts and before sending any command, the SCU must connect to the PACS and negotiate the PresentationContexts with DcmSCU::initNetwork and then DcmSCU::negotiateAssociation.
I wrote C++ program running on 2 cluster nodes which should add \ remove a virtual IP from the network card on each node (following some logic I've wrote..).
For that, I use EnableStatic method of the Win32_NetworkAdapterConfiguration class (https://msdn.microsoft.com/en-us/library/aa390383(v=vs.85).aspx).
On that program I have 2 buttons, "Release VIP" and "Acquire VIP".
I use RDP to connect these nodes (using the permanent IP, not the VIP).
For Release VIP I call: EnableStatic({ "1.1.1.5" }, { "255.255.0.0" });
For Acquire VIP I call: EnableStatic({ "1.1.1.5", "1.1.1.80" }, { "255.255.0.0", "255.255.0.0" });
(For this example 1.1.1.80 is the VIP)
When I did it on Windows 2012 everything worked fine and I was able to add \ remove the virtual IP.
Now, on Windows 2016, my RDP is losing connection for 2-3 seconds as a result of the change in the VIP on the network card (both add and remove..).
I know that in this API documentation Microsoft wrote that RDP should lose connection but I wonder:
Why it didn't happened in Windows 2012?
Did they made any change?
Maybe I do something wrong?
And more important:
Does it have other effect except the RDP losing connection that I should know of??
Is there a better API to use?
Thanks a lot!
I am writing a bluetooth driver for Intel Edison. Board software is latest available, and I am developing using the Eclipse based IDE.
Bluez version number in this edison release is 5.37.
I am designing a system which has to meet the following requirements:
Scan for bluetooth devices nearby. [X]
Detect sensor devices based on name and MAC address. [X]
Pair and connect sensor devices automatically. []
Last item is the problem since I can detect sensor devices but I am not able to pair them using the bluez5 interface. So far I have tried to use the D-BUS interface but it is not working since I keep getting the following error message:
Method "FindAdapter" with signature "s" on interface "org.bluez.Manager" doesn't exist
Code is presented here. Please note:
DBusConnection *conn -> DBUS_BUS_SYSTEM
const char *adapter -> "hci0".
Code:
DBusMessage *msg, *reply;
DBusError err;
const char *reply_path;
char *path;
msg = dbus_message_new_method_call("org.bluez", "/","org.bluez.Manager", "FindAdapter");
dbus_message_append_args(msg, DBUS_TYPE_STRING, &adapter,DBUS_TYPE_INVALID);
dbus_error_init(&err);
reply = dbus_connection_send_with_reply_and_block(conn, msg, -1, &err);
dbus_message_unref(msg);
Any ideas?
To give you an anwser, Pair and Connect are associated with the device-api.txt. To call these methods you can send dbus messages (like you did in the code presented above) or build a Proxy object with the following parameters (found in the documentation) :
name : "org.bluez"
interface "org.bluez.Device1"
path : "/org/bluez/dev_AA_BB_CC_DD_EE" where AA_BB_CC_DD_EE is your device mac address.
If you choose to build a proxy object, you can call methods like Pair or Connect through the proxy.
Could you explain what you are trying to achieve in the code above ? I understand that you want to find which adapter to use (I see the "FindAdapter" method) however it seems you already knows that your adapter name is "hci0".
I have been working with the DBus API exposed by Bluez recently and I was unfamiliar with the interface "org.bluez.Manager".
After a quick search in the official documentation (https://git.kernel.org/cgit/bluetooth/bluez.git/tree/doc) I was able to find the following commit which specifies that the interface was dropped in 2012 :
https://git.kernel.org/cgit/bluetooth/bluez.git/commit/doc?id=86a7b07c22f3a595ba3c48092359287905bf0878
I also noticed you were using the DBus low-level API, as advised by freedesktop themselves (read at the bottom of the page here : https://dbus.freedesktop.org/doc/api/html/group__DBus.html ), this is very complex API useful to create bindings in other languages. If you can, switch to GLib GDBus for a much simpler API.
Background
I am currently working on a Clojure wrapper of Sony Remote Camera Control API Beta.
API : https://developer.sony.com/develop/cameras/
Wrapper: https://github.com/hammartap/facet
Symptom
Some functions, which getAvailableApiList function says "available" looks unavailable.
(Returns IllegalArgumentException No matching field found error.)
Question
Am I missing API documentation?
If so, someone could guide me to the corresponding section of the document?
If not, I would like to know in which version these functions will be implimented.
Especially, I am interested in "(get|set)BeepMode", "(get|set)StillSize", setExposureMode, and so on.
I attached complete list of functions which looks unavailable for reference.[1]
Best.
Development environment
OS
Mac OSX 10.7.5
Language
Clojure 1.4.0 with Leiningen2
Java
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609) Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode)
Editor
Emacs 23.3
[1] Functions which seems to be unavailable
"getMethodTypes",
"setSelfTimer",
"getSelfTimer",
"getSupportedSelfTimer",
"getAvailableSelfTimer",
"setPostviewImageSize",
"getPostviewImageSize",
"getSupportedPostviewImageSize",
"getAvailablePostviewImageSize",
"setExposureMode",
"getExposureMode",
"getSupportedExposureMode",
"getAvailableExposureMode",
"setBeepMode",
"getBeepMode",
"getSupportedBeepMode",
"getAvailableBeepMode",
"setCameraFunction",
"getCameraFunction",
"getSupportedCameraFunction",
"getAvailableCameraFunction",
"setStillSize",
"getStillSize",
"getSupportedStillSize",
"getAvailableStillSize",
"actFormatStorage",
"getStorageInformation",
"setTouchAFPosition",
"cancelTouchAFPosition",
"getTouchAFPosition",
"getSupportedExposureCompensation",
"getSupportedWhiteBalance",
"getVersions",
Some undocumented API becomes avaliable after auth. You can see how it is done on QX100 here from line 144 to 151: https://github.com/Tsar/sony_qx_controller/blob/master/sony_qx_controller.py#L144
You may not be using a camera that supports those features. Here is Sony's capability chart
Using custom C++ OCI wrappers, I can successful register a CQN C++ callback-based registration, but it appears that somehow the subscription is dropped right away, behind my back. I get no call back on simple DMLs. If I try to unregister that subscription, for which register() worked just fine, I get ORA-29970: Specified registration id does not exist.
I'm running this test on a Win7 (64-bit) box, running a local 11.2.0.1.0 Oracle Server, and I connect with a C++ client app built against instantclient-11.2.0.2.0 that runs on that same machine.
I tried setting OCI_ATTR_SUBSCR_TIMEOUT explicitly to 0, to no avail.
I checked the job_queue_processes instance param to make sure it's not 0 (it's 1000).
Of course, the user/schema I'm connecting with has been granted CHANGE NOTIFICATION
I'm running out of ideas on this issue, and I would appreciate some insights on what else I could try or check.
I'm starting to wonder if CQN needs to be activated somehow. My DBA skills are close to nonexistent, this is a stock install of 11gR1 on Windows using the installer, with no special configurations or customization done at all.
Thanks, --DD
Update #1
A colleague successfully ran that same test, and he ran it using the server-provided oci.dll. I tried that (I build using instantclient, but forced the PATH at runtime: Path=D:\oracle\product\11.2.0\dbhome_1\BIN;$(Path) in VS Property Page> Debugging> Environment), and indeed the CQN test works! We still haven't figured out whether the slight version difference between client and server, or using instantclient (the Light variant by the way) vs a full client vs a server install is the real culprit.
But it is bad news that a newer instantclient does not support CQN...
Update #2
I've tried all 6 combinations of instantclient Light (65 MB) or Normal (150 MB) in versions 12.2.0.(1|2|3).0 on Win64, and none of them worked. Haven't tested the Full Client yet, nor have we tested on Linux just yet.
Environment_var cqn_env = Environment::create(OCI_EVENTS + OCI_OBJECT);
Connection_var cqn_conn = Connection::logon2(...);
Subscription sub(cqn_conn, "cqn_test", OCI_SUBSCR_NAMESPACE_DBCHANGE);
sub.set<attr::SUBSCR_CALLBACK>( &cqn_callback_func );
sub.set<attr::SUBSCR_CQ_QOSFLAGS>( OCI_SUBSCR_CQ_QOS_QUERY );
try {
sub.register_self();
} catch (const OracleException& ex) {
BOOST_REQUIRE(ex.error_code && *ex.error_code == 29972);
cerr << "\nSKIPPED: test requires CHANGE NOTIFICATION privilege" << endl;
return;
}