Search in sources :

Example 1 with WirelessStation

use of org.netxms.client.topology.WirelessStation in project netxms by netxms.

the class NXCSession method getWirelessStations.

/**
 * Get list of wireless stations registered at given wireless controller.
 *
 * @param nodeId controller node ID
 * @return list of wireless stations
 * @throws IOException  if socket or file I/O error occurs
 * @throws NXCException if NetXMS server returns an error or operation was timed out
 */
public List<WirelessStation> getWirelessStations(long nodeId) throws IOException, NXCException {
    final NXCPMessage msg = newMessage(NXCPCodes.CMD_GET_WIRELESS_STATIONS);
    msg.setFieldInt32(NXCPCodes.VID_OBJECT_ID, (int) nodeId);
    sendMessage(msg);
    final NXCPMessage response = waitForRCC(msg.getMessageId());
    int count = response.getFieldAsInt32(NXCPCodes.VID_NUM_ELEMENTS);
    List<WirelessStation> stations = new ArrayList<WirelessStation>(count);
    long varId = NXCPCodes.VID_ELEMENT_LIST_BASE;
    for (int i = 0; i < count; i++) {
        stations.add(new WirelessStation(response, varId));
        varId += 10;
    }
    return stations;
}
Also used : WirelessStation(org.netxms.client.topology.WirelessStation) NXCPMessage(org.netxms.base.NXCPMessage) ArrayList(java.util.ArrayList) ConnectionPoint(org.netxms.client.topology.ConnectionPoint) AccessPoint(org.netxms.client.objects.AccessPoint)

Example 2 with WirelessStation

use of org.netxms.client.topology.WirelessStation in project netxms by netxms.

the class WirelessStationComparator method compare.

/* (non-Javadoc)
	 * @see org.eclipse.jface.viewers.ViewerComparator#compare(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
	 */
@Override
public int compare(Viewer viewer, Object e1, Object e2) {
    WirelessStation ws1 = (WirelessStation) e1;
    WirelessStation ws2 = (WirelessStation) e2;
    int result;
    switch(// $NON-NLS-1$
    (Integer) ((SortableTableViewer) viewer).getTable().getSortColumn().getData("ID")) {
        case WirelessStations.COLUMN_MAC_ADDRESS:
            result = ws1.getMacAddress().compareTo(ws2.getMacAddress());
            break;
        case WirelessStations.COLUMN_IP_ADDRESS:
            result = ComparatorHelper.compareInetAddresses(ws1.getIpAddress(), ws2.getIpAddress());
            break;
        case WirelessStations.COLUMN_NODE_NAME:
            result = session.getObjectName(ws1.getNodeObjectId()).compareToIgnoreCase(session.getObjectName(ws2.getNodeObjectId()));
            break;
        case WirelessStations.COLUMN_ACCESS_POINT:
            result = session.getObjectName(ws1.getAccessPointId()).compareToIgnoreCase(session.getObjectName(ws2.getAccessPointId()));
            break;
        case WirelessStations.COLUMN_SSID:
            result = ws1.getSsid().compareToIgnoreCase(ws2.getSsid());
            break;
        case WirelessStations.COLUMN_RADIO:
            result = ws1.getRadioInterface().compareToIgnoreCase(ws2.getRadioInterface());
            break;
        default:
            result = 0;
            break;
    }
    return (((SortableTableViewer) viewer).getTable().getSortDirection() == SWT.UP) ? result : -result;
}
Also used : WirelessStation(org.netxms.client.topology.WirelessStation) SortableTableViewer(org.netxms.ui.eclipse.widgets.SortableTableViewer)

Aggregations

WirelessStation (org.netxms.client.topology.WirelessStation)2 ArrayList (java.util.ArrayList)1 NXCPMessage (org.netxms.base.NXCPMessage)1 AccessPoint (org.netxms.client.objects.AccessPoint)1 ConnectionPoint (org.netxms.client.topology.ConnectionPoint)1 SortableTableViewer (org.netxms.ui.eclipse.widgets.SortableTableViewer)1