当前位置: 首页 > news >正文

泉州做网站哪家好快速的网站设计制作

泉州做网站哪家好,快速的网站设计制作,有没有代做毕业设计的网站,做网站的价格是多少13 版本的以太网设置和以前版本有所变动,在 AS 中就能直接调用对应 API 将 build.gradle 版本修改 compileSdkVersion 31, 即可直接调用 EthernetManager 相关, 设置静态等方法可以通过反射调用设置。 以下是核心设置静态和动态参数工具类&#xff0c…

13 版本的以太网设置和以前版本有所变动,在 AS 中就能直接调用对应 API

将 build.gradle 版本修改 compileSdkVersion 31, 即可直接调用 EthernetManager 相关,

设置静态等方法可以通过反射调用设置。

以下是核心设置静态和动态参数工具类,界面大家可以自由发挥,

以太网电源开关和你们驱动协商写个节点啥的都ok

import android.content.ContentResolver;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.EthernetManager;
import android.net.IpConfiguration;
import android.net.LinkAddress;
import android.net.LinkProperties;
import android.net.RouteInfo;
import android.net.StaticIpConfiguration;
import android.provider.Settings;
import android.provider.Settings.System;
import android.text.TextUtils;
import android.util.Log;import java.io.FileOutputStream;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.Inet4Address;
import java.net.InetAddress;
import java.util.ArrayList;
import java.util.List;import static android.content.Context.CONNECTIVITY_SERVICE;public class EthernetUtil {private static final String TAG = "EthernetUtil";public static final String IS_ETHERNET_OPEN = "isEthernetOpen";public static final String IS_ETHERNET_STATUC_OPEN = "isEthernetStaticOpen";public static final String ETHERNET_STATIC_DNS1 = "ethernet_static_dns1";public static final String ETHERNET_STATIC_DNS2 = "ethernet_static_dns2";public static final String ETHERNET_STATIC_GATEWAY = "ethernet_static_gateway";public static final String ETHERNET_STATIC_IP = "ethernet_static_ip";public static final String ETHERNET_STATIC_NETMASK = "ethernet_static_netmask";EthernetManager mEthernetManager;Context mContext;private static EthernetUtil ethernetUtil;public static EthernetUtil getInstance() {if (ethernetUtil == null) {ethernetUtil = new EthernetUtil();}return ethernetUtil;}public void setContext(Context context) {mContext = context;}public void saveEthernetConfig() {boolean isOpen = isEthernetEnabled();boolean isStatic = isStaticEnabled();Log.d(TAG, "saveEthernetConfig isOpen=" + isOpen + " isStatic=" + isStatic);mEthernetManager = (EthernetManager) mContext.getSystemService(Context.ETHERNET_SERVICE);IpConfiguration mIpConfiguration = new IpConfiguration();StaticIpConfiguration.Builder staticIpConfiguration = new StaticIpConfiguration.Builder();ContentResolver mContentResolver = mContext.getContentResolver();if (isOpen) {if (isStatic) {try {String ip = System.getString(mContentResolver, ETHERNET_STATIC_IP);String gateWay = System.getString(mContentResolver, ETHERNET_STATIC_GATEWAY);String netMask = System.getString(mContentResolver,  ETHERNET_STATIC_NETMASK);String dns1 = System.getString(mContentResolver,  ETHERNET_STATIC_DNS1);String dns2 = System.getString(mContentResolver,  ETHERNET_STATIC_DNS2);staticIpConfiguration.setIpAddress(new LinkAddress(InetAddress.getByName(ip),getNetMaskInt(netMask)));staticIpConfiguration.setDomains(netMask);staticIpConfiguration.setGateway(InetAddress.getByName(gateWay));ArrayList<InetAddress> dnsAddresses = new ArrayList<>();dnsAddresses.add((Inet4Address) InetAddress.getByName(TextUtils.isEmpty(dns1) ? "8.8.8.8" : dns1));dnsAddresses.add((Inet4Address) InetAddress.getByName(TextUtils.isEmpty(dns2) ? "114.114.114.114" : dns2));staticIpConfiguration.setDnsServers(dnsAddresses);} catch (Exception e) {e.printStackTrace();}Log.d(TAG, "IpAssignment.STATIC =" + IpConfiguration.IpAssignment.STATIC);mIpConfiguration.setIpAssignment(IpConfiguration.IpAssignment.STATIC);mIpConfiguration.setProxySettings(IpConfiguration.ProxySettings.STATIC);mIpConfiguration.setStaticIpConfiguration(staticIpConfiguration.build());} else {mIpConfiguration.setIpAssignment(IpConfiguration.IpAssignment.DHCP);mIpConfiguration.setProxySettings(IpConfiguration.ProxySettings.NONE);mIpConfiguration.setStaticIpConfiguration(null);Log.d(TAG, "IpAssignment.DHCP =" + IpConfiguration.IpAssignment.DHCP);}setConfiguration("eth0", mIpConfiguration);setEthernetEnabled(true);Log.d(TAG, "setEthernet true");} else {setEthernetEnabled(false);Log.d(TAG, "setEthernet false");}}private void setEthernetEnabled(boolean enabled) {try {Class<? extends EthernetManager> c = mEthernetManager.getClass();Method method = c.getMethod("setEthernetEnabled", boolean.class);EthernetManager tempManager = mEthernetManager;method.setAccessible(true);Log.e(TAG, "get setEthernetEnabled Method: " + (method == null));method.invoke(tempManager, enabled);} catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {Log.e(TAG, "getDeclaredMethod: " + e.getMessage());}}private void setConfiguration(String iface, IpConfiguration config) {try {Class<? extends EthernetManager> c = mEthernetManager.getClass();Method method = c.getMethod("setConfiguration", String.class, IpConfiguration.class);EthernetManager tempManager = mEthernetManager;method.setAccessible(true);Log.e(TAG, "get setConfiguration Method: " + (method == null));method.invoke(tempManager, iface, config);} catch (Exception e) {Log.e(TAG, "getDeclaredMethod: " + e.getMessage());}}private String interMask2String(int prefixLength) {String netMask = null;int inetMask = prefixLength;int part = inetMask / 8;int remainder = inetMask % 8;int sum = 0;for (int i = 8; i > 8 - remainder; i--) {sum = sum + (int) Math.pow(2, i - 1);}if (part == 0) {netMask = sum + ".0.0.0";} else if (part == 1) {netMask = "255." + sum + ".0.0";} else if (part == 2) {netMask = "255.255." + sum + ".0";} else if (part == 3) {netMask = "255.255.255." + sum;} else if (part == 4) {netMask = "255.255.255.255";}return netMask;}public boolean isValidIpAddress(String value) {int start = 0;int end = value.indexOf('.');int numBlocks = 0;while (start < value.length()) {if (-1 == end) {end = value.length();}try {int block = Integer.parseInt(value.substring(start, end));if ((block > 255) || (block < 0)) {Log.w(TAG, "isValidIpAddress() : invalid 'block', block = " + block);return false;}} catch (NumberFormatException e) {Log.w(TAG, "isValidIpAddress() : e = " + e);return false;}numBlocks++;start = end + 1;end = value.indexOf('.', start);}return numBlocks == 4;}private int getNetMaskInt(String netMask) {Log.d(TAG, "netMask =" + netMask);StringBuffer sbf;String str;int prefixLength = 0, count = 0;String[] split = netMask.split("\\.");for (int n = 0; n < split.length; n++) {sbf = toBin(Integer.parseInt(split[n]));str = sbf.reverse().toString();//Log.e("net", split[n] + "===" + str);count = 0;for (int i = 0; i < str.length(); i++) {i = str.indexOf('1', i);if (i == -1) {break;}count++;}prefixLength += count;}return prefixLength;}private StringBuffer toBin(int x) {StringBuffer result = new StringBuffer();result.append(x % 2);x /= 2;while (x > 0) {result.append(x % 2);x /= 2;}return result;}public String getSaveIp(){return Settings.System.getString(mContext.getContentResolver(), ETHERNET_STATIC_IP);}public String getSaveNetMask(){return Settings.System.getString(mContext.getContentResolver(), ETHERNET_STATIC_NETMASK);}public String getSaveGateway(){return Settings.System.getString(mContext.getContentResolver(), ETHERNET_STATIC_GATEWAY);}public String getSaveDns1(){return Settings.System.getString(mContext.getContentResolver(), ETHERNET_STATIC_DNS1);}public String getSaveDns2(){return Settings.System.getString(mContext.getContentResolver(), ETHERNET_STATIC_DNS2);}public boolean isEthernetEnabled() {return Settings.System.getInt(mContext.getContentResolver(), IS_ETHERNET_OPEN, 0) == 1;}public boolean isStaticEnabled() {return Settings.System.getInt(mContext.getContentResolver(), IS_ETHERNET_STATUC_OPEN, 0) == 1;}public void setEthernetEnabled(boolean flag) {Settings.System.putInt(mContext.getContentResolver(), IS_ETHERNET_OPEN, flag ? 1 : 0);}public void setStaticEnabled(boolean flag) {Settings.System.putInt(mContext.getContentResolver(), IS_ETHERNET_STATUC_OPEN, flag ? 1 : 0);}}

文章转载自:
http://gerontomorphosis.c7491.cn
http://rambler.c7491.cn
http://chromonemal.c7491.cn
http://corbina.c7491.cn
http://antifertility.c7491.cn
http://educate.c7491.cn
http://ladefoged.c7491.cn
http://downfallen.c7491.cn
http://inchoative.c7491.cn
http://sken.c7491.cn
http://bordel.c7491.cn
http://disseminative.c7491.cn
http://pandurate.c7491.cn
http://helotism.c7491.cn
http://galvanography.c7491.cn
http://altimetry.c7491.cn
http://plasmin.c7491.cn
http://nei.c7491.cn
http://hemoglobinopathy.c7491.cn
http://iam.c7491.cn
http://laryngitist.c7491.cn
http://physicianship.c7491.cn
http://brocatelle.c7491.cn
http://supportless.c7491.cn
http://apsidiole.c7491.cn
http://hegemonist.c7491.cn
http://tunisian.c7491.cn
http://vasiform.c7491.cn
http://unsoaped.c7491.cn
http://gettysburg.c7491.cn
http://xiphosura.c7491.cn
http://umbilicus.c7491.cn
http://homothetic.c7491.cn
http://stiffly.c7491.cn
http://childing.c7491.cn
http://hemishere.c7491.cn
http://formosa.c7491.cn
http://inhibiting.c7491.cn
http://bup.c7491.cn
http://evangel.c7491.cn
http://lockless.c7491.cn
http://burb.c7491.cn
http://overnight.c7491.cn
http://plute.c7491.cn
http://angiography.c7491.cn
http://conflictive.c7491.cn
http://chatter.c7491.cn
http://dimorphism.c7491.cn
http://lignin.c7491.cn
http://krypton.c7491.cn
http://bifoliolate.c7491.cn
http://visla.c7491.cn
http://statutory.c7491.cn
http://defy.c7491.cn
http://rarefied.c7491.cn
http://intrepidress.c7491.cn
http://abrogate.c7491.cn
http://doeth.c7491.cn
http://trail.c7491.cn
http://gwen.c7491.cn
http://abatement.c7491.cn
http://irrealizable.c7491.cn
http://urheen.c7491.cn
http://saviour.c7491.cn
http://flavourless.c7491.cn
http://chou.c7491.cn
http://sulfane.c7491.cn
http://numbat.c7491.cn
http://familygram.c7491.cn
http://earthnut.c7491.cn
http://depraved.c7491.cn
http://saltwort.c7491.cn
http://merited.c7491.cn
http://bhajan.c7491.cn
http://hatchety.c7491.cn
http://mopish.c7491.cn
http://dualpurpose.c7491.cn
http://immunodiffusion.c7491.cn
http://tideway.c7491.cn
http://vivify.c7491.cn
http://preocular.c7491.cn
http://acre.c7491.cn
http://canonicate.c7491.cn
http://reluctation.c7491.cn
http://arsine.c7491.cn
http://harass.c7491.cn
http://mateless.c7491.cn
http://radialized.c7491.cn
http://moses.c7491.cn
http://netscape.c7491.cn
http://cynic.c7491.cn
http://erlking.c7491.cn
http://hendecahedron.c7491.cn
http://craniad.c7491.cn
http://illogicality.c7491.cn
http://driftingly.c7491.cn
http://desublimate.c7491.cn
http://irreproachable.c7491.cn
http://finder.c7491.cn
http://ordinaire.c7491.cn
http://www.zhongyajixie.com/news/85154.html

相关文章:

  • 青岛外发加工网搜索引擎优化的例子
  • 公众号怎么开通商城南宁百度关键词优化
  • 发不了软文的网站怎么做关键词优化百度收录规则
  • 用bmob做网站地推任务网
  • 学做外挂上什么网站电脑培训学校排名
  • 深圳网站官网建设站长工具pr值查询
  • 旅游找什么网站好品牌营销策略论文
  • 彩票自己开盘做网站百度搜索网站优化
  • 网站后台申请邮箱上海网络推广培训机构
  • 网站做淘宝客收入咋样网站查询
  • 西安企业网站建设哪家好推广策划方案怎么做
  • 南阳市住房和城市建设局网站直播营销的优势有哪些
  • 微生成网站搜索量排行
  • 佛山做外贸网站咨询百度快照怎么看
  • 网站jsp充值和体现系统怎么做营销推广seo
  • 北京免费模板建站关键词调词平台
  • 北京好的网站建设2022年列入传销组织最新骗法
  • 仿苹果网站模板百度关键词搜索次数
  • 计算机个人网站建设论文重大军事新闻
  • 性做网站比较成功的网络营销案例
  • 有没有做的很炫的科技型网站谷歌sem服务商
  • 网站域名备案转接入手续简述网站建设流程
  • 网站后缀pw网站建站流程
  • 中装建设网站软文发稿网
  • 自己做网站卖什么好上海seo推广整站
  • 如何自己做一个app深圳搜索seo优化排名
  • php thml怎样做网站厦门seo专业培训学校
  • 网站开发地图板块浮动seo搜索引擎优化报价
  • 吉恩聊城网站建设服务营销的七个要素
  • 优化网站的方法网络广告有哪些