[wpinet] Move network portions of wpiutil into new wpinet library (#4077)

This commit is contained in:
Peter Johnson
2022-05-07 10:54:14 -07:00
committed by GitHub
parent b33715db15
commit d673ead481
327 changed files with 1783 additions and 1179 deletions

View File

@@ -0,0 +1,44 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
package edu.wpi.first.net;
/** Class to resolve a service over mDNS. */
public class MulticastServiceResolver implements AutoCloseable {
private final int m_handle;
/**
* Creates a MulticastServiceResolver.
*
* @param serviceType service type to look for
*/
public MulticastServiceResolver(String serviceType) {
m_handle = WPINetJNI.createMulticastServiceResolver(serviceType);
}
@Override
public void close() {
WPINetJNI.freeMulticastServiceResolver(m_handle);
}
public void start() {
WPINetJNI.startMulticastServiceResolver(m_handle);
}
public void stop() {
WPINetJNI.stopMulticastServiceResolver(m_handle);
}
public boolean hasImplementation() {
return WPINetJNI.getMulticastServiceResolverHasImplementation(m_handle);
}
public int getEventHandle() {
return WPINetJNI.getMulticastServiceResolverEventHandle(m_handle);
}
public ServiceData[] getData() {
return WPINetJNI.getMulticastServiceResolverData(m_handle);
}
}