bandwidthinstance.java
来自「270的linux说明」· Java 代码 · 共 682 行 · 第 1/2 页
JAVA
682 行
/*
Copyright (c) 2008, Intel Corporation.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
* Neither the name of Intel Corporation nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
OF SUCH DAMAGE.
*/package com.intel.mobile.context;import java.net.*;import com.intel.mobile.base.*;import com.intel.mobile.base.IntelMobileException;/** * The instance object for bandwidth. */public class BandwidthInstance extends ContextInstance{ public static final int INVALID_GET_DATA = -1; public final FloatProperty TheoreticalSystemRateTx = null; public final FloatProperty TheoreticalSystemRateRx = null; public final FloatProperty SystemRateTx = null; public final FloatProperty SystemRateRx = null; public final StringProperty FastestProtocol = null; public final FloatProperty LimitTx = null; public final FloatProperty LimitRx = null; public final FloatProperty PercentTx = null; public final FloatProperty PercentRx = null; public final FloatProperty RateTx = null; public final FloatProperty RateRx = null; public final UInt64Property TotalBytesTx = null; public final UInt64Property TotalBytesRx = null; public final BoolProperty LimitedTx = null; public final BoolProperty LimitedRx = null; public final BoolProperty Adaptive = null; public final BoolProperty AdaptivelyLimitable = null; public EventProperty BandwidthChanged; // Constructor private BandwidthInstance(long objRef) throws IntelMobileException { super(objRef); init(objRef); } /** * (Kbps) Sets the maximum bits per second the socket can transmit on network devices. * @param socket * @param maxKBitsPerSec * @return * @throws IntelMobileException */ public boolean SetSessionLimitTx(Socket socket, float maxKBitsPerSec) throws IntelMobileException { long socketId = getSocketId(socket); return SetSessionLimitTxNative(socketId, maxKBitsPerSec); } /** * For DatagramSocket * @param socket * @param maxKBitsPerSec * @return * @throws IntelMobileException */ public boolean SetSessionLimitTx(DatagramSocket socket, float maxKBitsPerSec) throws IntelMobileException { long socketId = getSocketId(socket); return SetSessionLimitTxNative(socketId, maxKBitsPerSec); } /** * (Kbps) Sets the maximum bits per second the socket can receive on network devices. * @param socket * @param maxKBitsPerSec * @return * @throws IntelMobileException */ public boolean SetSessionLimitRx(Socket socket, float maxKBitsPerSec) throws IntelMobileException { long socketId = getSocketId(socket); return SetSessionLimitRxNative(socketId, maxKBitsPerSec); } /** * For DatagramSocket * @param socket * @param maxKBitsPerSec * @return * @throws IntelMobileException */ public boolean SetSessionLimitRx(DatagramSocket socket, float maxKBitsPerSec) throws IntelMobileException { long socketId = getSocketId(socket); return SetSessionLimitRxNative(socketId, maxKBitsPerSec); } /** * Sets the maximum percentage of bandwidth the socket can transmit on network devices. * Example: maxPercentage = 90.0; (not 0.9) * @param socket * @param maxPercentage the scope is from 0 to 100 * @return * @throws IntelMobileException */ public boolean SetSessionPercentTx(Socket socket, float maxPercentage) throws IntelMobileException { long socketId = getSocketId(socket); return SetSessionPercentTxNative(socketId, maxPercentage); } /** * For DatagramSocket * @param socket * @param maxPercentage * @return * @throws IntelMobileException */ public boolean SetSessionPercentTx(DatagramSocket socket, float maxPercentage) throws IntelMobileException { long socketId = getSocketId(socket); return SetSessionPercentTxNative(socketId, maxPercentage); } /** * Sets the percentage of bandwidth the socket can receive on network devices. * Example: maxPercentage = 90.0; (not 0.9) * @param socket * @param maxPercentage the scope is from 0 to 100 * @return * @throws IntelMobileException */ public boolean SetSessionPercentRx(Socket socket, float maxPercentage) throws IntelMobileException { long socketId = getSocketId(socket); return SetSessionPercentRxNative(socketId, maxPercentage); } /** * For DatagramSocket * @param socket * @param maxPercentage * @return * @throws IntelMobileException */ public boolean SetSessionPercentRx(DatagramSocket socket, float maxPercentage) throws IntelMobileException { long socketId = getSocketId(socket); return SetSessionPercentRxNative(socketId, maxPercentage); } /** * (Kbps) Gets the maximum bits per second the given socket can transmit over network devices. * This function returns the ?effective limit?, which is the lower of the application execution policy or the process policy. * @param socket * @return * @throws IntelMobileException */ public float GetSessionLimitTx(Socket socket) throws IntelMobileException { long socketId = getSocketId(socket); return GetSessionLimitTxNative(socketId); } /** * For DatagramSocket * @param socket * @return * @throws IntelMobileException */ public float GetSessionLimitTx(DatagramSocket socket) throws IntelMobileException { long socketId = getSocketId(socket); return GetSessionLimitTxNative(socketId); } /** * (Kbps) Gets the maximum bits per second the socket can receive over network devices. * This function returns the ?effective limit?, which is the lower of the application execution policy or the process policy. * @param socket * @return * @throws IntelMobileException */ public float GetSessionLimitRx(Socket socket) throws IntelMobileException { long socketId = getSocketId(socket); return GetSessionLimitRxNative(socketId); } /** * For DatagramSocket * @param socket * @return * @throws IntelMobileException */ public float GetSessionLimitRx(DatagramSocket socket) throws IntelMobileException { long socketId = getSocketId(socket); return GetSessionLimitRxNative(socketId); } /** * (Kbps) Gets the measured transfer rate the connection has transmitted over network devices. * This function returns a sampled average which is updated periodically. * @param socket * @return * @throws IntelMobileException */ public float GetSessionRateTx(Socket socket) throws IntelMobileException { long socketId = getSocketId(socket); return GetSessionRateTxNative(socketId); } /** * For DatagramSocket * @param socket * @return * @throws IntelMobileException */ public float GetSessionRateTx(DatagramSocket socket) throws IntelMobileException { long socketId = getSocketId(socket); return GetSessionRateTxNative(socketId); } /** * (Kbps) Gets the bits per second the socket has received over network devices. * This function returns a sampled average which is updated periodically. * @param socket * @return * @throws IntelMobileException */ public float GetSessionRateRx(Socket socket) throws IntelMobileException { long socketId = getSocketId(socket); return GetSessionRateRxNative(socketId); } /** * For DatagramSocket * @param socket * @return * @throws IntelMobileException */ public float GetSessionRateRx(DatagramSocket socket) throws IntelMobileException { long socketId = getSocketId(socket); return GetSessionRateRxNative(socketId); } /** * (Bytes) Gets the total bytes which have been transmitted over network devices. * @param socket * @return * @throws IntelMobileException */ public long GetSessionTotalBytesTx(Socket socket) throws IntelMobileException { long socketId = getSocketId(socket); return GetSessionTotalBytesTxNative(socketId); } /** * For DatagramSocket * @param socket * @return * @throws IntelMobileException */ public long GetSessionTotalBytesTx(DatagramSocket socket) throws IntelMobileException { long socketId = getSocketId(socket); return GetSessionTotalBytesTxNative(socketId); } /** * (Bytes) Gets the total bytes which have been received over network devices. * @param socket * @return * @throws IntelMobileException */ public long GetSessionTotalBytesRx(Socket socket) throws IntelMobileException { long socketId = getSocketId(socket); return GetSessionTotalBytesRxNative(socketId); } /** * For DatagramSocket * @param socket * @return * @throws IntelMobileException */ public long GetSessionTotalBytesRx(DatagramSocket socket) throws IntelMobileException { long socketId = getSocketId(socket); return GetSessionTotalBytesRxNative(socketId); } /** * Gets the maximum percentage of bandwidth the socket can transmit on network devices. * @param socket * @return * @throws IntelMobileException */ public float GetSessionPercentTx(Socket socket) throws IntelMobileException
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?