wifidirectplugin 1.1.5 → 1.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -36,13 +36,6 @@ public class WifiDirectPlugin extends Plugin {
36
36
  NetworkInfo networkInfo = intent.getParcelableExtra(WifiP2pManager.EXTRA_NETWORK_INFO);
37
37
  if (networkInfo != null && networkInfo.isConnected()) {
38
38
  Log.d(TAG, "Wi-Fi Direct connected");
39
- manager.requestConnectionInfo(channel, wifiP2pInfo -> {
40
- if(wifiP2pInfo.groupFormed && wifiP2pInfo.isGroupOwner) {
41
- Log.d(TAG, "Group Owner IP: " + wifiP2pInfo.groupOwnerAddress.getHostAddress());
42
- } else if (wifiP2pInfo.groupFormed) {
43
- Log.d(TAG, "Client connected, Group Owner IP: " + wifiP2pInfo.groupOwnerAddress.getHostAddress());
44
- }
45
- });
46
39
  // 필요한 경우 연결된 상태를 Flutter/Ionic에 전달하는 코드를 여기서 실행
47
40
  // 예: call JavaScript 이벤트 전송 또는 콜백 호출
48
41
  } else {
@@ -73,6 +66,7 @@ public class WifiDirectPlugin extends Plugin {
73
66
  }
74
67
  @PluginMethod
75
68
  public void scanWifiPeers(PluginCall call) {
69
+ String targetDeviceName = call.getString("deviceName"); // 앱에서 입력 받은 장치 이름
76
70
  if(manager == null || channel == null) {
77
71
  Log.e(TAG, "WifiP2pManager or Channel is null");
78
72
  call.reject("WifiP2pManager or Channel not initialized");
@@ -89,7 +83,7 @@ public class WifiDirectPlugin extends Plugin {
89
83
  JSONArray devicesJson = new JSONArray();
90
84
  for(WifiP2pDevice device: peerWifiDirDevices) {
91
85
  try {
92
- if(!device.deviceName.toUpperCase().contains("LINKVUE")) continue;
86
+ if(!device.deviceName.contains(targetDeviceName)) continue;
93
87
 
94
88
  JSONObject deviceJson = new JSONObject();
95
89
  deviceJson.put("deviceName", device.deviceName);
@@ -169,5 +163,18 @@ public class WifiDirectPlugin extends Plugin {
169
163
 
170
164
  }
171
165
 
166
+ @PluginMethod
167
+ public void getGroupOwnerAddress(PluginCall call) {
168
+ manager.requestConnectionInfo(channel, wifiP2pInfo -> {
169
+ if (wifiP2pInfo.groupFormed) {
170
+ String ip = wifiP2pInfo.groupOwnerAddress.getHostAddress();
171
+ JSObject ret = new JSObject();
172
+ ret.put("Ip", ip);
173
+ call.resolve(ret);
174
+ } else {
175
+ call.reject("No Wi-Fi P2P group formed");
176
+ }
177
+ });
178
+ }
172
179
 
173
180
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wifidirectplugin",
3
- "version": "1.1.5",
3
+ "version": "1.1.7",
4
4
  "description": "HT-Installer Wifi Direct Plugin",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",