public static InetAddress determineBindAddressBasedOnWifiP2pSubnet( ArrayList<InetAddress> localIpAddresses, InetAddress destAddress) { int byteArrayToInt = TypeConversion.byteArrayToInt(destAddress.getAddress()); for (InetAddress inetAddress : localIpAddresses) { if ((TypeConversion.byteArrayToInt(inetAddress.getAddress()) & WIFI_P2P_SUBNET_MASK) == (byteArrayToInt & WIFI_P2P_SUBNET_MASK)) { return inetAddress; } } return Network.getLoopbackAddress(); }
public static InetAddress determineBindAddressBasedOnWifiP2pSubnet( ArrayList<InetAddress> localIpAddresses, InetAddress destAddress) { int byteArrayToInt = TypeConversion.byteArrayToInt(destAddress.getAddress()); Iterator it = localIpAddresses.iterator(); while (it.hasNext()) { InetAddress inetAddress = (InetAddress) it.next(); if ((TypeConversion.byteArrayToInt(inetAddress.getAddress()) & WIFI_P2P_SUBNET_MASK) == (byteArrayToInt & WIFI_P2P_SUBNET_MASK)) { return inetAddress; } } return Network.getLoopbackAddress(); }
public double getVoltage() { return (((double) ((TypeConversion.byteArrayToShort(read(ADDRESS_BATTERY_VOLTAGE, MAX_MOTOR)) >> 6) & BATTERY_MAX_MEASURABLE_VOLTAGE_INT)) / 1023.0d) * BATTERY_MAX_MEASURABLE_VOLTAGE; }
public int getMotorCurrentPosition(int motor) { m57a(motor); return TypeConversion.byteArrayToInt( read(ADDRESS_MOTOR_CURRENT_ENCODER_VALUE_MAP[motor], CHANNEL_MODE_MASK_LOCK)); }
public void setMotorTargetPosition(int motor, int position) { m57a(motor); Range.throwIfRangeIsInvalid((double) position, -2.147483648E9d, 2.147483647E9d); write(ADDRESS_MOTOR_TARGET_ENCODER_VALUE_MAP[motor], TypeConversion.intToByteArray(position)); }
int readLH(int ireg) { byte[] bytes = this.i2cDeviceClient.read(ireg, 2); return TypeConversion.byteArrayToInt(bytes, ByteOrder.LITTLE_ENDIAN); }
int read8(int ireg) { byte b = this.i2cDeviceClient.read8(ireg); return TypeConversion.unsignedByteToInt(b); }