| | |
| | | tv.setText("开始申请设备密钥..."); |
| | | responseTv.setText(""); |
| | | |
| | | String supplier = "JINMAOYUN";//厂商 |
| | | // String mac = "AA00000000000100";//设备唯一MAC地址 |
| | | String mac = editText.getText().toString(); |
| | | String supplier = "HIK KNX";//厂商 |
| | | String mac = "FQ4895630";//设备唯一MAC地址 |
| | | // String mac = editText.getText().toString(); |
| | | String spk = "screen.touch";//产品spk |
| | | |
| | | if (TextUtils.isEmpty(mac)) { |
| | |
| | | responseTv.setText(info.toString()); |
| | | if (info != null) { |
| | | HDLLinkConfig.getInstance().setGatewayId(info.getGatewayId()); |
| | | //HDLLinkConfig.getInstance().setIpAddress(info.ip); |
| | | } |
| | | } |
| | | |
| | |
| | | public void onMessage(Object msg) { |
| | | LinkResponse response = (LinkResponse) msg; |
| | | Log.i("onMessage", "response.getTopic():" + response.getTopic()); |
| | | String topic = String.format(TopicConstant.GATEWAY_LOGIN, |
| | | HDLLinkConfig.getInstance().getGatewayId())+ "_reply";; |
| | | |
| | | if ("/user/all/custom/gateway/broadcast_reply".equals(response.getTopic())) { |
| | | localSecret.setText("密钥:" + HDLLinkConfig.getInstance().getLocalSecret()); |
| | | |
| | | }else if (topic.equals(response.getTopic())){ |
| | | //tcp连接成功,处理业务逻辑 |
| | | } |
| | | } |
| | | }; |
| | |
| | | void searchGatewayBroadcast() { |
| | | tv.setText("搜索网关中..."); |
| | | responseTv.setText(""); |
| | | HDLLinkConfig.getInstance().getGatewayId(); |
| | | |
| | | String gatewayId = HDLLinkConfig.getInstance().getGatewayId(); |
| | | Log.d("panlili", "MainActivity.java:searchGatewayBroadcast----->gatewayId= " + gatewayId); |
| | | HDLLink.getInstance().searchGatewayBroadcast(new HDLAuthSocket.SearchGatewayCallBack() { |
| | | @Override |
| | | public void onError(HDLLinkException e) { |