diff --git a/NetworkManager.json b/NetworkManager.json index 06842f8..bbd67fb 100644 --- a/NetworkManager.json +++ b/NetworkManager.json @@ -196,8 +196,8 @@ "result": { "type": "object", "properties": { - "Interfaces": { - "summary": "An interface", + "interfaces": { + "summary": "An interface details", "type":"array", "items": { "type":"object", @@ -372,7 +372,9 @@ "ipversion": { "$ref": "#/definitions/ipversion" } - } + }, + "required": [ + ] }, "result": { "type": "object", @@ -910,7 +912,9 @@ "example": "Xfinity Mobile" } } - } + }, + "required": [ + ] }, "result": { "type": "object", diff --git a/NetworkManagerJsonRpc.cpp b/NetworkManagerJsonRpc.cpp index 3c35db2..1963a70 100644 --- a/NetworkManagerJsonRpc.cpp +++ b/NetworkManagerJsonRpc.cpp @@ -303,13 +303,16 @@ namespace WPEFramework response["interface"] = interface; response["ipversion"] = address.ipversion; response["autoconfig"] = address.autoconfig; - response["ipaddress"] = address.ipaddress; - response["prefix"] = address.prefix; - response["ula"] = address.ula; - response["dhcpserver"] = address.dhcpserver; - response["gateway"] = address.gateway; - response["primarydns"] = address.primarydns; - response["secondarydns"] = address.secondarydns; + if (!address.ipaddress.empty()) + { + response["ipaddress"] = address.ipaddress; + response["prefix"] = address.prefix; + response["ula"] = address.ula; + response["dhcpserver"] = address.dhcpserver; + response["gateway"] = address.gateway; + response["primarydns"] = address.primarydns; + response["secondarydns"] = address.secondarydns; + } } returnJson(rc); } diff --git a/NetworkManagerRDKProxy.cpp b/NetworkManagerRDKProxy.cpp index 77588a8..8f83df9 100644 --- a/NetworkManagerRDKProxy.cpp +++ b/NetworkManagerRDKProxy.cpp @@ -837,12 +837,12 @@ namespace WPEFramework if (IARM_RESULT_SUCCESS == IARM_Bus_Call (IARM_BUS_NM_SRV_MGR_NAME, IARM_BUS_NETSRVMGR_API_getIPSettings, (void *)&iarmData, sizeof(iarmData))) { address.autoconfig = iarmData.autoconfig; - address.dhcpserver = string(iarmData.dhcpserver,MAX_IP_ADDRESS_LEN - 1); + address.dhcpserver = string(iarmData.dhcpserver); address.ula = string(""); - address.ipaddress = string(iarmData.ipaddress,MAX_IP_ADDRESS_LEN - 1); - address.gateway = string(iarmData.gateway,MAX_IP_ADDRESS_LEN - 1); - address.primarydns = string(iarmData.primarydns,MAX_IP_ADDRESS_LEN - 1); - address.secondarydns = string(iarmData.secondarydns,MAX_IP_ADDRESS_LEN - 1); + address.ipaddress = string(iarmData.ipaddress); + address.gateway = string(iarmData.gateway); + address.primarydns = string(iarmData.primarydns); + address.secondarydns = string(iarmData.secondarydns); if (0 == strcasecmp("ipv4", iarmData.ipversion)) { address.ipversion = string ("IPv4"); diff --git a/docs/NetworkManagerPlugin.md b/docs/NetworkManagerPlugin.md index 53529ae..7dcb805 100644 --- a/docs/NetworkManagerPlugin.md +++ b/docs/NetworkManagerPlugin.md @@ -214,13 +214,13 @@ This method takes no parameters. | Name | Type | Description | | :-------- | :-------- | :-------- | | result | object | | -| result?.Interfaces | array | *(optional)* An interface | -| result?.Interfaces[#] | object | *(optional)* | -| result?.Interfaces[#].type | string | Interface Type | -| result?.Interfaces[#].name | string | Interface Name. ex: eth0 or wlan0 | -| result?.Interfaces[#].mac | string | Interface MAC address | -| result?.Interfaces[#].enabled | boolean | Whether the interface is currently enabled | -| result?.Interfaces[#].connected | boolean | Whether the interface is currently connected | +| result.interfaces | array | An interface details | +| result.interfaces[#] | object | | +| result.interfaces[#].type | string | Interface Type | +| result.interfaces[#].name | string | Interface Name. ex: eth0 or wlan0 | +| result.interfaces[#].mac | string | Interface MAC address | +| result.interfaces[#].enabled | boolean | Whether the interface is currently enabled | +| result.interfaces[#].connected | boolean | Whether the interface is currently connected | | result.success | boolean | Whether the request succeeded | ### Example @@ -242,7 +242,7 @@ This method takes no parameters. "jsonrpc": "2.0", "id": 42, "result": { - "Interfaces": [ + "interfaces": [ { "type": "ETHERNET", "name": "eth0",