com.gizwits.gizwifisdk.api.GizWifiDevice Java Examples
The following examples show how to use
com.gizwits.gizwifisdk.api.GizWifiDevice.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GosDeviceListActivity.java From GOpenSource_AppKit_Android_AS with MIT License | 6 votes |
@Override protected void didSetSubscribe(GizWifiErrorCode result, GizWifiDevice device, boolean isSubscribed) { // TODO 控制页面跳转 progressDialog.cancel(); Message msg = new Message(); if (GizWifiErrorCode.GIZ_SDK_SUCCESS == result) { msg.what = TOCONTROL; msg.obj = device; } else { if (device.isBind()) { msg.what = TOAST; // String setSubscribeFail = (String) // getText(R.string.setsubscribe_failed); msg.obj = toastError(result);// setSubscribeFail + "\n" + arg0; } } handler.sendMessage(msg); }
Example #2
Source File: GosDeviceListActivity.java From gokit-android with MIT License | 6 votes |
@Override protected void didSetSubscribe(GizWifiErrorCode result, GizWifiDevice device, boolean isSubscribed) { // TODO 控制页面跳转 progressDialog.cancel(); Message msg = new Message(); if (GizWifiErrorCode.GIZ_SDK_SUCCESS == result) { msg.what = TOCONTROL; msg.obj = device; } else { if (device.isBind()) { msg.what = TOAST; // String setSubscribeFail = (String) // getText(R.string.setsubscribe_failed); msg.obj = toastError(result);// setSubscribeFail + "\n" + arg0; } } handler.sendMessage(msg); }
Example #3
Source File: GosDeviceListActivity.java From Gizwits-SmartBuld_Android with MIT License | 6 votes |
@Override protected void didSetSubscribe(GizWifiErrorCode result, GizWifiDevice device, boolean isSubscribed) { // TODO 控制页面跳转 progressDialog.cancel(); Message msg = new Message(); if (GizWifiErrorCode.GIZ_SDK_SUCCESS == result) { msg.what = TOCONTROL; msg.obj = device; } else { if (device.isBind()) { msg.what = TOAST; // String setSubscribeFail = (String) // getText(R.string.setsubscribe_failed); msg.obj = toastError(result);// setSubscribeFail + "\n" + arg0; } } handler.sendMessage(msg); }
Example #4
Source File: GosDeviceControlActivity.java From gokit-android with MIT License | 5 votes |
protected void didUpdateNetStatus(GizWifiDevice device, GizWifiDeviceNetStatus netStatus) { if (device == mDevice) { if (GizWifiDeviceNetStatus.GizDeviceUnavailable == netStatus || GizWifiDeviceNetStatus.GizDeviceOffline == netStatus) { handler.sendEmptyMessage(DISCONNECT); } else { handler.removeCallbacks(mRunnable); progressDialog.cancel(); mDevice.getDeviceStatus(); } } }
Example #5
Source File: GosDeviceMoreActivity.java From Gizwits-SmartBuld_Android with MIT License | 5 votes |
@Override protected void didReceiveData(GizWifiErrorCode result, GizWifiDevice device, ConcurrentHashMap<String, Object> dataMap, int sn) { super.didReceiveData(result, device, dataMap, sn); if (result == GizWifiErrorCode.GIZ_SDK_SUCCESS) { deviceDataMap = dataMap; getDataFromDateMap(); updateUI(); } }
Example #6
Source File: GosEditDeviceAliasActivity.java From Gizwits-SmartBuld_Android with MIT License | 5 votes |
@Override protected void didSetCustomInfo(GizWifiErrorCode result, GizWifiDevice device2) { super.didSetCustomInfo(result, device2); if (result == GizWifiErrorCode.GIZ_SDK_SUCCESS) { myToast(R.string.modify_succeed); progressDialog.cancel(); backToDeviceList(); } else { progressDialog.cancel(); // 修改失败 myToast(R.string.updata_fail); } }
Example #7
Source File: GosEditDeviceDelayActivity.java From Gizwits-SmartBuld_Android with MIT License | 5 votes |
@Override protected void didReceiveData(GizWifiErrorCode result, GizWifiDevice device, ConcurrentHashMap<String, Object> dataMap, int sn) { super.didReceiveData(result, device, dataMap, sn); if (result == GizWifiErrorCode.GIZ_SDK_SUCCESS) { deviceDataMap = dataMap; getDataFromDateMap(); } }
Example #8
Source File: GosDeviceControlActivity.java From Gizwits-SmartBuld_Android with MIT License | 5 votes |
private void initDevice() { Intent intent = getIntent(); GizWifiDevice dev = (GizWifiDevice) intent.getParcelableExtra("GizWifiDevice"); if (dev != null) { device = dev; device.setListener(gizWifiDeviceListener); } else { toastDeviceNoReadyAndExit(); } }
Example #9
Source File: GosDeviceControlActivity.java From Gizwits-SmartBuld_Android with MIT License | 5 votes |
public void cColor(GizWifiDevice device, int color){ sendMoreCommand("Color_R", Color.red(color), "Color_G", Color.green(color), "Color_B", Color.blue(color)); color_num_r = Color.red(color); color_num_g = Color.green(color); color_num_b = Color.blue(color); }
Example #10
Source File: GosDeviceControlActivity.java From Gizwits-SmartBuld_Android with MIT License | 5 votes |
public void cColorTemp(GizWifiDevice device, int color_num){ sendMoreCommand("Temperature_R", Color.red(color_num), "Temperature_G", Color.green(color_num), "Temperature_B", Color.blue(color_num)); color_num_temp_r = Color.red(color_num); color_num_temp_g = Color.green(color_num); color_num_temp_b = Color.blue(color_num); }
Example #11
Source File: GosDeviceListActivity.java From gokit-android with MIT License | 5 votes |
protected void didDiscovered(GizWifiErrorCode result, java.util.List<GizWifiDevice> deviceList) { GosDeviceModuleBaseActivity.deviceslist.clear(); for (GizWifiDevice gizWifiDevice : deviceList) { GosDeviceModuleBaseActivity.deviceslist.add(gizWifiDevice); } handler.sendEmptyMessage(UPDATALIST); }
Example #12
Source File: GosDeviceControlActivity.java From Gizwits-SmartBuld_Android with MIT License | 5 votes |
@Override protected void didUpdateNetStatus(GizWifiDevice device, GizWifiDeviceNetStatus netStatus) { super.didUpdateNetStatus(device, netStatus); if (device.isSubscribed()) { if (netStatus == GizWifiDeviceNetStatus.GizDeviceControlled) { handler.removeCallbacks(mRunnable); progressDialog.cancel(); // 后面操作是等待sdk下发查询设备状态命令,收到设备状态后再更新界面 } else { myToast(R.string.device_dropped); finish(); } } }
Example #13
Source File: GosScheduleSiteTool.java From Gizwits-SmartBuld_Android with MIT License | 5 votes |
/** * @param context */ public GosScheduleSiteTool(Context context, GizWifiDevice device, String token) { super(); this.device = device; this.token = token; mRequestQueue = Volley.newRequestQueue(context.getApplicationContext()); APPID = GosDeploy.setAppID(); }
Example #14
Source File: GosDeviceListActivity.java From Gizwits-SmartBuld_Android with MIT License | 5 votes |
protected void didDiscovered(GizWifiErrorCode result, java.util.List<GizWifiDevice> deviceList) { GosDeviceModuleBaseActivity.deviceslist.clear(); for (GizWifiDevice gizWifiDevice : deviceList) { GosDeviceModuleBaseActivity.deviceslist.add(gizWifiDevice); } handler.sendEmptyMessage(UPDATALIST); }
Example #15
Source File: GosDeviceListActivity.java From GOpenSource_AppKit_Android_AS with MIT License | 5 votes |
protected void didDiscovered(GizWifiErrorCode result, java.util.List<GizWifiDevice> deviceList) { GosDeviceModuleBaseActivity.deviceslist.clear(); for (GizWifiDevice gizWifiDevice : deviceList) { GosDeviceModuleBaseActivity.deviceslist.add(gizWifiDevice); } handler.sendEmptyMessage(UPDATALIST); }
Example #16
Source File: GosDeviceControlActivity.java From Gizwits-SmartBuld_Android with MIT License | 5 votes |
@Override protected void didReceiveData(GizWifiErrorCode result, GizWifiDevice device, ConcurrentHashMap<String, Object> dataMap, int sn) { super.didReceiveData(result, device, dataMap, sn); if (result == GizWifiErrorCode.GIZ_SDK_SUCCESS) { deviceDataMap = dataMap; handler.sendEmptyMessage(handler_key.RECEIVED.ordinal()); } }
Example #17
Source File: GosDeviceControlActivity.java From gokit-android with MIT License | 5 votes |
private void initDevice() { Intent intent = getIntent(); mDevice = (GizWifiDevice) intent.getParcelableExtra("GizWifiDevice"); deviceStatu = new ConcurrentHashMap<String, Object>(); if (TextUtils.isEmpty(mDevice.getAlias())) { title = mDevice.getProductName(); } else { title = mDevice.getAlias(); } }
Example #18
Source File: GosDeviceControlActivity.java From gokit-android with MIT License | 5 votes |
protected void didGetHardwareInfo(GizWifiErrorCode result, GizWifiDevice device, java.util.concurrent.ConcurrentHashMap<String, String> hardwareInfo) { Log.i("Apptest", hardwareInfo.toString()); StringBuffer sb = new StringBuffer(); Message msg = new Message(); if (GizWifiErrorCode.GIZ_SDK_SUCCESS != result) { msg.what = TOAST; msg.obj = toastError(result); } else { sb.append("Wifi Hardware Version:" + hardwareInfo.get(wifiHardVerKey) + "\r\n"); sb.append("Wifi Software Version:" + hardwareInfo.get(wifiSoftVerKey) + "\r\n"); sb.append("MCU Hardware Version:" + hardwareInfo.get(mcuHardVerKey) + "\r\n"); sb.append("MCU Software Version:" + hardwareInfo.get(mcuSoftVerKey) + "\r\n"); sb.append("Wifi Firmware Id:" + hardwareInfo.get(FirmwareIdKey) + "\r\n"); sb.append("Wifi Firmware Version:" + hardwareInfo.get(FirmwareVerKey) + "\r\n"); sb.append("Product Key:" + "\r\n" + hardwareInfo.get(productKey) + "\r\n"); // 设备属性 sb.append("Device ID:" + "\r\n" + mDevice.getDid() + "\r\n"); sb.append("Device IP:" + mDevice.getIPAddress() + "\r\n"); sb.append("Device MAC:" + mDevice.getMacAddress() + "\r\n"); msg.what = HARDWARE; msg.obj = sb.toString(); } handler.sendMessage(msg); }
Example #19
Source File: GosDeviceControlActivity.java From gokit-android with MIT License | 5 votes |
protected void didSetCustomInfo(GizWifiErrorCode result, GizWifiDevice device) { progressDialog.cancel(); Message msg = new Message(); msg.what = TOAST; String toastText; if (GizWifiErrorCode.GIZ_SDK_SUCCESS == result) { toastText = (String) getText(R.string.set_info_successful); } else { toastText = toastError(result); } msg.obj = toastText; handler.sendMessage(msg); }
Example #20
Source File: GosDeviceListAdapter.java From gokit-android with MIT License | 4 votes |
public GosDeviceListAdapter(Context context, List<GizWifiDevice> deviceList) { super(); this.context = context; this.deviceList = deviceList; }
Example #21
Source File: GosDeviceControlActivity.java From Gizwits-SmartBuld_Android with MIT License | 4 votes |
private void initDevice() { Intent intent = getIntent(); device = (GizWifiDevice) intent.getParcelableExtra("GizWifiDevice"); Log.i("Apptest", device.getDid()); }
Example #22
Source File: GosDeviceListAdapter.java From gokit-android with MIT License | 4 votes |
@Override public View getView(int position, View convertView, ViewGroup parent) { View view = convertView; Holder holder; if (view == null) { view = LayoutInflater.from(context).inflate(R.layout.item_gos_device_list, null); holder = new Holder(view); view.setTag(holder); } else { holder = (Holder) view.getTag(); } final GizWifiDevice device = deviceList.get(position); String LAN, noLAN, unbind; LAN = (String) context.getText(R.string.lan); noLAN = (String) context.getText(R.string.no_lan); unbind = (String) context.getText(R.string.unbind); String deviceAlias = device.getAlias(); String devicePN = device.getProductName(); if (device.getNetStatus() == GizWifiDeviceNetStatus.GizDeviceOnline || device.getNetStatus() == GizWifiDeviceNetStatus.GizDeviceControlled) { if (device.isBind()) {// 已绑定设备 holder.getTvDeviceMac().setText(device.getMacAddress()); if (device.isLAN()) { holder.getTvDeviceStatus().setText(LAN); } else { holder.getTvDeviceStatus().setText(noLAN); } if (TextUtils.isEmpty(deviceAlias)) { holder.getTvDeviceName().setText(devicePN); } else { holder.getTvDeviceName().setText(deviceAlias); } } else {// 未绑定设备 holder.getTvDeviceMac().setText(device.getMacAddress()); holder.getTvDeviceStatus().setText(unbind); if (TextUtils.isEmpty(deviceAlias)) { holder.getTvDeviceName().setText(devicePN); } else { holder.getTvDeviceName().setText(deviceAlias); } } } else {// 设备不在线 holder.getTvDeviceMac().setText(device.getMacAddress()); holder.getTvDeviceMac().setTextColor(context.getResources().getColor(R.color.gray)); holder.getTvDeviceStatus().setText(""); holder.getTvDeviceStatus().setTextColor(context.getResources().getColor(R.color.gray)); holder.getImgRight().setVisibility(View.GONE); holder.getLlLeft().setBackgroundResource(R.drawable.btn_getcode_shape_gray); if (TextUtils.isEmpty(deviceAlias)) { holder.getTvDeviceName().setText(devicePN); } else { holder.getTvDeviceName().setText(deviceAlias); } holder.getTvDeviceName().setTextColor(context.getResources().getColor(R.color.gray)); } holder.getDelete2().setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Message message = new Message(); message.what = UNBOUND; message.obj = device.getDid().toString(); handler.sendMessage(message); } }); return view; }
Example #23
Source File: GosControlModuleBaseActivity.java From gokit-android with MIT License | 4 votes |
/** 用于设备订阅 */ public void didSetSubscribe(GizWifiErrorCode result, GizWifiDevice device, boolean isSubscribed) { GosControlModuleBaseActivity.this.didSetSubscribe(result, device, isSubscribed); }
Example #24
Source File: GosControlModuleBaseActivity.java From gokit-android with MIT License | 4 votes |
/** 用于设备状态 */ public void didReceiveData(GizWifiErrorCode result, GizWifiDevice device, java.util.concurrent.ConcurrentHashMap<String, Object> dataMap, int sn) { GosControlModuleBaseActivity.this.didReceiveData(result, device, dataMap, sn); }
Example #25
Source File: GosControlModuleBaseActivity.java From gokit-android with MIT License | 4 votes |
/** 用于设备硬件信息 */ public void didGetHardwareInfo(GizWifiErrorCode result, GizWifiDevice device, java.util.concurrent.ConcurrentHashMap<String, String> hardwareInfo) { GosControlModuleBaseActivity.this.didGetHardwareInfo(result, device, hardwareInfo); }
Example #26
Source File: GosControlModuleBaseActivity.java From gokit-android with MIT License | 4 votes |
/** 用于修改设备信息 */ public void didSetCustomInfo(GizWifiErrorCode result, GizWifiDevice device) { GosControlModuleBaseActivity.this.didSetCustomInfo(result, device); }
Example #27
Source File: GosControlModuleBaseActivity.java From gokit-android with MIT License | 4 votes |
/** 用于设备状态变化 */ public void didUpdateNetStatus(GizWifiDevice device, GizWifiDeviceNetStatus netStatus) { GosControlModuleBaseActivity.this.didUpdateNetStatus(device, netStatus); }
Example #28
Source File: GosDeviceListActivity.java From gokit-android with MIT License | 4 votes |
private void UpdateUI() { if (GosDeviceModuleBaseActivity.deviceslist.isEmpty()) { svListGroup.setVisibility(View.GONE); llNoDevice.setVisibility(View.VISIBLE); return; } else { llNoDevice.setVisibility(View.GONE); svListGroup.setVisibility(View.VISIBLE); } boundDevicesList = new ArrayList<GizWifiDevice>(); foundDevicesList = new ArrayList<GizWifiDevice>(); offlineDevicesList = new ArrayList<GizWifiDevice>(); for (GizWifiDevice gizWifiDevice : GosDeviceModuleBaseActivity.deviceslist) { if (GizWifiDeviceNetStatus.GizDeviceOnline == gizWifiDevice.getNetStatus() || GizWifiDeviceNetStatus.GizDeviceControlled == gizWifiDevice.getNetStatus()) { if (gizWifiDevice.isBind()) { boundDevicesList.add(gizWifiDevice); } else { foundDevicesList.add(gizWifiDevice); } } else { offlineDevicesList.add(gizWifiDevice); } } if (boundDevicesList.isEmpty()) { slvBoundDevices.setVisibility(View.GONE); llNoBoundDevices.setVisibility(View.VISIBLE); } else { myadapter = new GosDeviceListAdapter(this, boundDevicesList); myadapter.setHandler(handler); slvBoundDevices.setAdapter(myadapter); llNoBoundDevices.setVisibility(View.GONE); slvBoundDevices.setVisibility(View.VISIBLE); } if (foundDevicesList.isEmpty()) { slvFoundDevices.setVisibility(View.GONE); llNoFoundDevices.setVisibility(View.VISIBLE); } else { myadapter = new GosDeviceListAdapter(this, foundDevicesList); slvFoundDevices.setAdapter(myadapter); llNoFoundDevices.setVisibility(View.GONE); slvFoundDevices.setVisibility(View.VISIBLE); } if (offlineDevicesList.isEmpty()) { slvOfflineDevices.setVisibility(View.GONE); llNoOfflineDevices.setVisibility(View.VISIBLE); } else { myadapter = new GosDeviceListAdapter(this, offlineDevicesList); myadapter.setHandler(handler); slvOfflineDevices.setAdapter(myadapter); llNoOfflineDevices.setVisibility(View.GONE); slvOfflineDevices.setVisibility(View.VISIBLE); } }
Example #29
Source File: GosDeviceModuleBaseActivity.java From Gizwits-SmartBuld_Android with MIT License | 4 votes |
public void didSetSubscribe(GizWifiErrorCode result, GizWifiDevice device, boolean isSubscribed) { GosDeviceModuleBaseActivity.this.didSetSubscribe(result, device, isSubscribed); }
Example #30
Source File: GosDeviceListAdapter.java From Gizwits-SmartBuld_Android with MIT License | 4 votes |
@Override public View getView(int position, View convertView, ViewGroup parent) { View view = convertView; Holder holder; if (view == null) { view = LayoutInflater.from(context).inflate(R.layout.item_gos_device_list, null); holder = new Holder(view); view.setTag(holder); } else { holder = (Holder) view.getTag(); } final GizWifiDevice device = deviceList.get(position); String LAN, noLAN, unbind; LAN = (String) context.getText(R.string.lan); noLAN = (String) context.getText(R.string.no_lan); unbind = (String) context.getText(R.string.unbind); String deviceAlias = device.getAlias(); String devicePN = device.getProductName(); if (device.getNetStatus() == GizWifiDeviceNetStatus.GizDeviceOnline || device.getNetStatus() == GizWifiDeviceNetStatus.GizDeviceControlled) { if (device.isBind()) {// 已绑定设备 holder.getTvDeviceMac().setText(device.getMacAddress()); if (device.isLAN()) { holder.getTvDeviceStatus().setText(LAN); } else { holder.getTvDeviceStatus().setText(noLAN); } if (TextUtils.isEmpty(deviceAlias)) { holder.getTvDeviceName().setText(devicePN); } else { holder.getTvDeviceName().setText(deviceAlias); } } else {// 未绑定设备 holder.getTvDeviceMac().setText(device.getMacAddress()); holder.getTvDeviceStatus().setText(unbind); if (TextUtils.isEmpty(deviceAlias)) { holder.getTvDeviceName().setText(devicePN); } else { holder.getTvDeviceName().setText(deviceAlias); } } } else {// 设备不在线 holder.getTvDeviceMac().setText(device.getMacAddress()); holder.getTvDeviceMac().setTextColor(context.getResources().getColor(R.color.gray)); holder.getTvDeviceStatus().setText(""); holder.getTvDeviceStatus().setTextColor(context.getResources().getColor(R.color.gray)); holder.getImgRight().setVisibility(View.GONE); holder.getLlLeft().setBackgroundResource(R.drawable.btn_getcode_shape_gray); if (TextUtils.isEmpty(deviceAlias)) { holder.getTvDeviceName().setText(devicePN); } else { holder.getTvDeviceName().setText(deviceAlias); } holder.getTvDeviceName().setTextColor(context.getResources().getColor(R.color.gray)); } holder.getDelete2().setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Message message = new Message(); message.what = UNBOUND; message.obj = device.getDid().toString(); handler.sendMessage(message); } }); return view; }