applicationId "com.zhixun.blesdk.app"
minSdk 24
targetSdk 33
- versionCode 1
- versionName "1.1"
-
+ versionCode 2
+ versionName "1.2"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
implementation 'com.google.code.gson:gson:2.10'
// implementation(fileTree("libs/HS-SDK-0.0.6-202407231115.aar"))
- implementation(fileTree("libs/compresslib.aar"))
+// implementation(fileTree("libs/compresslib.aar"))
// implementation "org.java-websocket:Java-WebSocket:1.5.1"
implementation 'com.arthenica:mobile-ffmpeg-full:4.4'
implementation 'org.slf4j:slf4j-api:2.0.7'
"type": "SINGLE",
"filters": [],
"attributes": [],
- "versionCode": 1,
- "versionName": "1.1",
- "outputFile": "Hs-sdk_1.1_release_2024080610.apk"
+ "versionCode": 2,
+ "versionName": "1.2",
+ "outputFile": "Hs-sdk_1.2_release_2024100215.apk"
}
],
"elementType": "File"
}
public void doRegiest(View view) {
- AiManage.getInstance().doRegiest();
+ AiManage.getInstance().doRegiest(false);
}
import android.widget.TextView;
import android.widget.Toast;
-import com.compress.api.PicZipApi;
-import com.compress.nativelib.FileLogger;
import com.google.gson.Gson;
import com.zhixun.blesdk.app.adapter.DeviceAdapter;
import com.zhixun.blesdk.app.utils.ByteTools;
HsAgentSdk.getInstance().init(this, true, true);
HsAgentSdk.getInstance().getAPI().AIinit(this);
- FileLogger.init(this);
- PicZipApi.getInstance().init();
+// FileLogger.init(this);
+// PicZipApi.getInstance().init();
deviceListview = findViewById(R.id.device_list);
tv_connect_state = findViewById(R.id.tv_connect_state);
}
public void goPngConver(View view) {
- startActivity(new Intent(this, PicTestActivity.class));
+// startActivity(new Intent(this, PicTestActivity.class));
}
public void goAIlog(View view) {
startActivity(new Intent(this, AiLogActivity.class));
}
-
public void reconnect(View view) {
HsWearDevice bean = HsAgentSdk.getInstance().getAPI().getLastDevice();
HsAgentSdk.getInstance().getAPI().connect(bean);
+++ /dev/null
-package com.zhixun.blesdk.app;
-
-import androidx.appcompat.app.AppCompatActivity;
-
-import android.content.Context;
-import android.content.res.AssetManager;
-import android.graphics.Bitmap;
-import android.graphics.BitmapFactory;
-import android.graphics.Color;
-import android.os.Bundle;
-import android.util.Log;
-import android.view.View;
-import android.widget.Button;
-import android.widget.ImageView;
-import android.widget.Toast;
-
-import com.compress.api.CompressParam;
-import com.compress.api.DecompressRet;
-import com.compress.api.PicZipApi;
-import com.compress.api.PicZipEventCallback;
-import com.compress.nativelib.FileLogger;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-
-public class PicTestActivity extends AppCompatActivity {
-
- private String TAG = "PicTestActivity";
- private Bitmap bitMapSrc;
- private File compressedFile;
- private ImageView srcPic;
- private ImageView destPic;
- private Button btnCompress;
- private Button btnDecompress;
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_pic_test);
- ImageView srcPic = findViewById(R.id.iv_src);
- destPic = findViewById(R.id.iv_dest);
- btnCompress = findViewById(R.id.btn_compress);
- btnCompress.setOnClickListener(view -> compress());
- btnDecompress = findViewById(R.id.btn_decompress);
- btnDecompress.setOnClickListener(view -> decompress());
-
- bitMapSrc = getImageFromAssetsFile(getApplicationContext(), "DialDog.png");
- srcPic.setImageBitmap(bitMapSrc);
- // 设置压缩和解压的结果回调
- PicZipApi.getInstance().setCallback(new PicZipEventCallback() {
- @Override
- public void compressRets(int id, int state, int tileWidth, byte[] data) {
- int dataLen = data.length;
- Log.i(TAG, "compressRetsFromJNI: id = " + id + " state = " + state + " tileWidth = " + tileWidth + " len = " + dataLen);
- compressedFile = FileLogger.writeBuffer("ComRets" + tileWidth, data, 0, data.length);
- runOnUiThread(new Runnable() {
- @Override
- public void run() {
- btnCompress.setEnabled(true);
- Toast.makeText(PicTestActivity.this, "compress finished", Toast.LENGTH_SHORT).show();
- }
- });
- }
-
- @Override
- public void deCompressRets(int id, int state, DecompressRet ret) {
- int channelIdx = 0;
- Bitmap.Config config = Bitmap.Config.ARGB_8888;
- if (ret.getFormat() == 8) { //
- config = Bitmap.Config.RGB_565;
- }
- Bitmap bitmapDe = Bitmap.createBitmap(ret.getWidth(), ret.getHeight(), config);
- for (int j = 0; j < ret.getHeight(); j++) {
- for (int i = 0; i < ret.getWidth(); i++) {
- channelIdx = j * ret.getWidth() + i;
- int color = 0;
- if (ret.getFormat() == 8) { // RGB565
- color = Color.rgb(ret.getRedChannel()[channelIdx] << 3,
- ret.getGreenChannel()[channelIdx] << 2,
- ret.getBlueChannel()[channelIdx] << 3);
- } else {
- color = ((ret.getAlphaChannel()[channelIdx] & 0xff) << 24) |
- ((ret.getRedChannel()[channelIdx] & 0xff) << 16) |
- ((ret.getGreenChannel()[channelIdx] & 0xff) << 8) |
- ((ret.getBlueChannel()[channelIdx] & 0xff));
- }
- bitmapDe.setPixel(i, j, color);
- }
- }
- runOnUiThread(() -> destPic.setImageBitmap(bitmapDe));
- }
- });
- }
-
- private void compress() {
- btnCompress.setEnabled(false);
- Bitmap.Config config = bitMapSrc.getConfig();
- int width = bitMapSrc.getWidth();
- int height = bitMapSrc.getHeight();
- byte[] redChannel = new byte[width * height];
- byte[] greenChannel = new byte[width * height];
- byte[] blueChannel = new byte[width * height];
- byte[] alphaChannel = new byte[width * height];
- int channelIdx = 0;
- for (int j = 0; j < height; j++) {
- for (int i = 0; i < width; i++) {
- int pixelColor = bitMapSrc.getPixel(i, j);
- channelIdx = j * width + i;
- int alpha = (pixelColor >> 24) & 0xff;
- int red = (pixelColor >> 16) & 0xff;
- int green = (pixelColor >> 8) & 0xff;
- int blue = pixelColor & 0xff;
- if (config == Bitmap.Config.RGB_565) {
- redChannel[channelIdx] = (byte)(red >> 3);
- greenChannel[channelIdx] = (byte)(green >> 2);
- blueChannel[channelIdx] = (byte)(blue >> 3);
- } else {
- redChannel[channelIdx] = (byte)red;
- greenChannel[channelIdx] = (byte)green;
- blueChannel[channelIdx] = (byte)blue;
- }
- alphaChannel[channelIdx] = (byte)alpha;
- }
- }
-
- CompressParam pressParam = new CompressParam();
- pressParam.setWidth(width);
- pressParam.setHeight(height);
- pressParam.setStride(width);
- pressParam.setModeRgb(1);
- pressParam.setModeAlpha(1);
- pressParam.setCmpMode(0);
- /**
- * 设置TileWidth 4 6 8 16
- */
- pressParam.setTileWidth(8);
- pressParam.setAlphaChannel(alphaChannel);
- pressParam.setRedChannel(redChannel);
- pressParam.setGreenChannel(greenChannel);
- pressParam.setBlueChannel(blueChannel);
- if (config == Bitmap.Config.ARGB_8888) {
- pressParam.setPixelFormat(1);
- } else if (config == Bitmap.Config.RGB_565) {
- pressParam.setPixelFormat(2);
- } else {
- pressParam.setPixelFormat(0);
- }
- Log.i(TAG, "compress: " + pressParam.getPixelFormat());
- // 调用压缩接口
- new Thread(() -> PicZipApi.getInstance().compress(pressParam)).start();
- }
-
- private void decompress() {
- if (compressedFile == null) {
- Toast.makeText(this, "Invalid File", Toast.LENGTH_SHORT).show();
- return;
- }
- int dataLen = (int)compressedFile.length();
- byte[] decompressData = new byte[dataLen];
- try {
- FileInputStream fis = new FileInputStream(compressedFile);
- fis.read(decompressData);
- } catch (IOException e) {
- e.printStackTrace();
- Log.i(TAG, "decompress: fileSize = " + compressedFile.length());
- }
- new Thread(() -> PicZipApi.getInstance().decompress(3, decompressData)).start();
- }
-
- private Bitmap getImageFromAssetsFile(Context ctx, String fileName) {
- Bitmap bitmap = null;
- AssetManager assetManager = ctx.getAssets();
- try {
- InputStream is = assetManager.open(fileName);
- bitmap = BitmapFactory.decodeStream(is);
- is.close();
- } catch (IOException e) {
- e.printStackTrace();
- }
- return bitmap;
- }
- private byte[] getBuffer(Context ctx, String fileName) {
- AssetManager assetManager = ctx.getAssets();
- byte[] rets = new byte[1024 * 300];
- int len = 0;
- try {
- InputStream is = assetManager.open(fileName);
- len = is.read(rets);
- is.close();
- } catch (IOException e) {
- e.printStackTrace();
- }
- return rets;
- }
-
- public void back(View view) {
- finish();
- }
-
-}
\ No newline at end of file
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.8.0'
- implementation files('libs\\Poly-SDK-v1.5-240809.jar')
+ implementation files('libs\\Poly-SDK-v1.6-240812.jar')
+// implementation files('libs\\Poly-SDK-v1.5-240809.jar')
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
-keep class com.zhixun.android.sdk.polysdk.entity.*{*;}
-keep class com.zhixun.android.sdk.polysdk.bean.*{*;}
-keep class com.zhixun.android.sdk.polysdk.PolymerizeAgent{*;}
+-keep class com.zhixun.android.sdk.polysdk.callback.*{*;}
+-keep class com.zhixun.android.sdk.polysdk.entity.*{*;}
+-keep class com.zhixun.android.sdk.polysdk.bean.*{*;}
import android.bluetooth.BluetoothGattService;
import android.bluetooth.BluetoothManager;
import android.bluetooth.BluetoothProfile;
+import android.bluetooth.BluetoothSocket;
import android.bluetooth.le.BluetoothLeScanner;
import android.bluetooth.le.ScanCallback;
import android.bluetooth.le.ScanFilter;
import com.zhixun.blesdk.hssdk.data.BleMsgReceiverHandler;
import com.zhixun.blesdk.hssdk.data.BleMsgSendHandler;
import com.zhixun.blesdk.hssdk.data.FileHandler;
+import com.zhixun.blesdk.hssdk.entity.AppTime;
import com.zhixun.blesdk.hssdk.entity.E4MsgBody;
import com.zhixun.blesdk.hssdk.entity.HsWearDevice;
+import com.zhixun.blesdk.hssdk.entity.MsgBody;
import com.zhixun.blesdk.hssdk.entity.MsgResponse;
import com.zhixun.blesdk.hssdk.entity.PhoneInfo;
import com.zhixun.blesdk.hssdk.util.BleDataUtil;
import com.zhixun.blesdk.hssdk.util.SobLog;
import com.zhixun.blesdk.hssdk.util.SpUtils;
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
+import java.util.Calendar;
import java.util.HashMap;
import java.util.List;
+import java.util.Set;
import java.util.UUID;
public class BleHandle {
//64 00 01 00 00 01 28 11 06 AF B0 F7 00 00 05 05 00 01 00 01
updataDevice(data);
- if(checkBluePermission()){
+ if (checkBluePermission()) {
mBleConnectDevice.setName(gatt.getDevice().getName());
}
- SobLog.d(TAG,"mBleConnectDevice--"+new Gson().toJson(mBleConnectDevice));
+ SobLog.d(TAG, "mBleConnectDevice--" + new Gson().toJson(mBleConnectDevice));
//读取成功后 需要下发同步基础信息 才能进行接下来的通信
- sendPhoneInfo();
+ /****Modified By Snicker*****/
+ //正常流程发送手机信息进行配对验证,不考虑配对,则发送sendtime 绕过配对,进行以后的流程
+// sendPhoneInfo();
+ sendTime();
+ /****Modified By Snicker end*****/
+
}
}
}
};
+ private void sendTime() {
+ AppTime appTime = new AppTime();
+ appTime.setTime((System.currentTimeMillis() / 1000));
+ Calendar calendar = Calendar.getInstance();
+ int year = calendar.get(Calendar.YEAR) - 2000; // 年份
+ int month = calendar.get(Calendar.MONTH) + 1; // 月份(注意要加1)
+ int dayOfMonth = calendar.get(Calendar.DAY_OF_MONTH); // 天数
+ appTime.setDay(dayOfMonth);
+ appTime.setHour(calendar.get(Calendar.HOUR_OF_DAY));
+ appTime.setMonth(month);
+ appTime.setYear(year);
+ appTime.setMinute(calendar.get(Calendar.MINUTE));
+ appTime.setSecond(calendar.get(Calendar.SECOND));
+ int calWeek = calendar.get(Calendar.DAY_OF_WEEK);
+ int week = 0;
+ if (calWeek == 1) {
+ week = 7;
+ } else {
+ week = calWeek - 1;
+ }
+ appTime.setWeek(week);
+ SobLog.d(TAG, "sendappTime---" + new Gson().toJson(appTime));
+ E4MsgBody msgBody = new E4MsgBody(MsgBody.TYPE_SET_TIME);
+ msgBody.setData(new Gson().toJson(appTime).getBytes());
+ BleMsgSendHandler.getInstance().sendMsg(msgBody, null);
+ }
private void sendPhoneInfo() {
E4MsgBody msgBody = new E4MsgBody(BleMsgSendHandler.TYPE_SET_PHONEINFO);
PhoneInfo phoneInfo = new PhoneInfo();
phoneInfo.setPn(Build.MANUFACTURER);
phoneInfo.setTp(0);
String mac = SpUtils.getInstance().getStringValue(SpUtils.KEY_MAC);
- SobLog.d(TAG,"sendPhoneInfo--mac-"+mac);
+ SobLog.d(TAG, "sendPhoneInfo--mac-" + mac);
ArrayList<Integer> maclist = new ArrayList<>();
- if(!TextUtils.isEmpty(mac)){
+ if (!TextUtils.isEmpty(mac)) {
maclist = getMac(mac);
}
phoneInfo.setMac(maclist);//2DC4FCCD6F58
- SobLog.d(TAG,"sendPhoneInfo---"+phoneInfo.toString());
+ SobLog.d(TAG, "sendPhoneInfo---" + phoneInfo.toString());
msgBody.setPhoneInfo(phoneInfo);
BleMsgSendHandler.getInstance().sendMsg(msgBody, new OnMsgSendCallBack() {
@Override
public void onResponse(MsgResponse msgResponse) {
int state = (int) msgResponse.getBody();
- if(state==3||state==0){
+ if (state == 3 || state == 0) {
mBleHand.removeMessages(MSG_CONNECT_TIMEOUT);
if (mCalback != null) {
mCalback.onConnectStateChange(BtVtransferCallback.STATE_BLE_ISBINDED, mBleConnectDevice);
}
disconnectDevice();
+ } else {
+
+ /*try {
+ Method createBondMethod = null;
+ createBondMethod = BluetoothDevice.class
+ .getMethod("createBond");
+ Log.d(TAG, "开始配对");
+ boolean returnValue = (Boolean) createBondMethod.invoke(bluetoothDevice);
+ Log.d(TAG, "returnValue--"+returnValue);
+ } catch (Exception e) {
+ Log.e(TAG, "Exception--"+e.getMessage());
+ }*/
+
+
}
}
});
}
+ public void removePairDevice() {
+ if (mBluetoothAdapter != null) {
+ if (ActivityCompat.checkSelfPermission(mContext, Manifest.permission.BLUETOOTH_CONNECT) != PackageManager.PERMISSION_GRANTED) {
+ return;
+ }
+ Set<BluetoothDevice> bondedDevices = mBluetoothAdapter.getBondedDevices();
+ for(BluetoothDevice device : bondedDevices ){
+ Log.d(TAG, "device--"+device.getAddress());
+ if(device.getAddress().equals(mBleConnectDevice.getAddress())){
+ unpairDevice(device);
+ }
+ }
+ Log.d(TAG, "removePairDevice");
+ }
+
+ }
+
+ //反射来调用BluetoothDevice.removeBond取消设备的配对
+ private void unpairDevice(BluetoothDevice device) {
+ try {
+ Method m = device.getClass()
+ .getMethod("removeBond", (Class[]) null);
+ m.invoke(device, (Object[]) null);
+ Log.d(TAG, "unpairDevice");
+ } catch (Exception e) {
+ Log.e(TAG, e.getMessage());
+ }
+ }
+ public void creatBond(){
+
+
+
+ BluetoothDevice bluetoothDevice = mBluetoothAdapter.getRemoteDevice(mBleConnectDevice.getAddress());
+ //得到配对的设备列表,清除已配对的设备
+ removePairDevice();
+ if (ActivityCompat.checkSelfPermission(mContext, Manifest.permission.BLUETOOTH_CONNECT) != PackageManager.PERMISSION_GRANTED) {
+ return;
+ }
+ bluetoothDevice.createBond();
+ Log.d(TAG, "开始配对");
+ }
+
+
private void updataDevice(byte[] data) {
byte elB = data[0];
byte[] plateidB = new byte[2];
byte[] macB = new byte[6];
System.arraycopy(data, 6, macB, 0, macB.length);
- SobLog.d(TAG,"updataDevice--111");
+ SobLog.d(TAG, "updataDevice--111");
byte sendB = data[12];
byte mediaB = data[13];
byte customB = data[14];
byte[] bleversionB = new byte[2];
System.arraycopy(data, 18, bleversionB, 0, bleversionB.length);
- SobLog.d(TAG,"updataDevice--222");
+ SobLog.d(TAG, "updataDevice--222");
mBleConnectDevice.setBatty(ByteTools.byte2Int(elB));
- SobLog.d(TAG,"updataDevice--221");
+ SobLog.d(TAG, "updataDevice--221");
mBleConnectDevice.setDialId(ByteTools.little_bytesToInt(plateidB));
- SobLog.d(TAG,"updataDevice--223");
+ SobLog.d(TAG, "updataDevice--223");
StringBuffer gjversionSb = new StringBuffer();
for (int i = 0; i < versionB.length; i++) {
String vi = ByteTools.byte2Int(versionB[i]) + "";
}
}
- SobLog.d(TAG,"updataDevice--333");
+ SobLog.d(TAG, "updataDevice--333");
mBleConnectDevice.setHardware(hwversionSb.toString());
StringBuffer btversionSb = new StringBuffer();
for (int i = 0; i < bleversionB.length; i++) {
btversionSb.append(".");
}
}
- SobLog.d(TAG,"updataDevice--444");
+ SobLog.d(TAG, "updataDevice--444");
mBleConnectDevice.setBtVersion(btversionSb.toString());
}
- public void setConnectCallBack(BtVtransferCallback callback){
- if (callback!=null)mCalback = callback;
+ public void setConnectCallBack(BtVtransferCallback callback) {
+ if (callback != null) mCalback = callback;
}
+
public void connectDevice(HsWearDevice wearDevice) {
- SobLog.d(TAG, "--connectDevice--"+isConnected+"isConnecting "+isConnecting);
+ SobLog.d(TAG, "--connectDevice--" + isConnected + "isConnecting " + isConnecting);
if (!checkBluePermission() || isConnecting)
return;
- if(wearDevice==null){
+ if (wearDevice == null) {
connectStateChange(BtVtransferCallback.STATE_DEVICE_NULL);
return;
}
- SobLog.d(TAG, "--connectDevice--"+isConnected+"--"+wearDevice.getAddress());
+
+ SobLog.d(TAG, "--connectDevice--" + isConnected + "--" + wearDevice.getAddress());
mBleConnectDevice = wearDevice;
- if(!mBluetoothAdapter.isEnabled()){
+ if (!mBluetoothAdapter.isEnabled()) {
connectStateChange(BtVtransferCallback.STATE_BLE_DISENBLE);
return;
}
mBleHand.removeMessages(MSG_CONNECT_TIMEOUT);
- mBleHand.sendEmptyMessageDelayed(MSG_CONNECT_TIMEOUT,10000);
+ mBleHand.sendEmptyMessageDelayed(MSG_CONNECT_TIMEOUT, 10000);
stopScan();
connectStateChange(BtVtransferCallback.STATE_CONNECTING);
isConnecting = true;
BluetoothDevice btDevice = mBluetoothAdapter.getRemoteDevice(mBleConnectDevice.getAddress());
+
//mBluetoothGatt = btDevice.connectGatt(mContext, false, gattCallback);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
mBluetoothGatt = btDevice.connectGatt(mContext, false, gattCallback, BluetoothDevice.TRANSPORT_LE);
mBluetoothGatt.disconnect();
}
+
+
+
public void connectStateChange(int state){
isConnecting = false;
mBleHand.removeMessages(MSG_CONNECT_TIMEOUT);
package com.zhixun.blesdk.hssdk.callback;
import android.content.Context;
+import android.graphics.Bitmap;
+import com.zhixun.android.sdk.polysdk.callback.IPicCompressCallback;
import com.zhixun.blesdk.hssdk.entity.OTAInfo;
import com.zhixun.blesdk.hssdk.entity.file.HsEpoInfo;
import com.zhixun.blesdk.hssdk.entity.HsNotifyParams;
void deleteDial(int uid, OnMsgSendCallBack callBack);
+ void picCompress(Bitmap bitmap, IPicCompressCallback picCompressCallback);
+
void getDeviceLog(IFileReceiverCallback iFileReceiverCallback);
void release();
}
}
}else {
if(!TextUtils.isEmpty(text)){
- E4MsgBody msgBody = new E4MsgBody(TYPE_SEND_AI_RESULT);
- msgBody.setAiValue(E4MsgBody.TYPE_AI_REQ_CHAT,text);
- BleMsgSendHandler.getInstance().sendMsg(msgBody,null);
+ if(text.startsWith("failed:")){
+ E4MsgBody msgBody = new E4MsgBody(TYPE_SEND_AI_RESULT);
+ msgBody.setData(ByteTools.little_intToByte(3,1));
+ BleMsgSendHandler.getInstance().sendMsg(msgBody,null);
+ }else {
+ E4MsgBody msgBody = new E4MsgBody(TYPE_SEND_AI_RESULT);
+ msgBody.setAiValue(E4MsgBody.TYPE_AI_REQ_CHAT,text);
+ BleMsgSendHandler.getInstance().sendMsg(msgBody,null);
+ }
+
}
if(onAiLogListener!=null){
onAiLogListener.onLogChange("回复中&&"+text);
}
-// chatReq.append(text);
+// chatReq.append(text);m
}
}
});
public void doLogin(){
String pwd = SpUtils.getInstance().getStringValue(SpUtils.KEY_AI_PWD);
if(TextUtils.isEmpty(pwd)){
- pwd = "aWGKrBWaijsKD5eEsVVU5rjWPI1sVy";
+ pwd = "CVOachlw1DO1Ei5uabOkHd1wRYoMQA";
}
PolymerizeAgent.getInstance().getAuthenAPI().authentication("281106AFB0F7"
, pwd, "HHosiYUNdG42t1cTgKOzIUPOvAVMI2QT", new AuthCallback() {
if(onAiLogListener!=null){
onAiLogListener.onLogChange("鉴权结果-onFail-"+msg);
}
+ if(code==50021){
+ if(onAiLogListener!=null){
+ onAiLogListener.onLogChange("-密码错误,准备重新注册-");
+ }
+ doRegiest(true);
+ }
}
});
}
- public void doRegiest(){
+ public void doRegiest(boolean isPwdFile){
PolymerizeAgent.getInstance().getAuthenAPI().regiest("HHosiYUNdG42t1cTgKOzIUPOvAVMI2QT"
, "281106AFB0F7", "pafOCKLiUbeVHbdZlddH", new AuthCallback() {
@Override
if(onAiLogListener!=null){
onAiLogListener.onLogChange("注册结果-onSuccess-"+result);
}
+ if(isPwdFile){
+ if(onAiLogListener!=null){
+ onAiLogListener.onLogChange("-注册成功,准备登录-");
+ }
+ doLogin();
+ }
}
@Override
package com.zhixun.blesdk.hssdk.data;
import android.content.Context;
+import android.graphics.Bitmap;
import android.text.TextUtils;
import android.util.Log;
import com.google.gson.Gson;
import com.zhixun.android.sdk.polysdk.PolymerizeAgent;
import com.zhixun.android.sdk.polysdk.callback.AuthCallback;
+import com.zhixun.android.sdk.polysdk.callback.IPicCompressCallback;
import com.zhixun.blesdk.hssdk.HsAgentSdk;
import com.zhixun.blesdk.hssdk.bttools.BleHandle;
import com.zhixun.blesdk.hssdk.callback.BtVtransferCallback;
sendMessage(msgBody,callBack);
}
+ @Override
+ public void picCompress(Bitmap bitmap, IPicCompressCallback picCompressCallback) {
+ PolymerizeAgent.getInstance().getAiAPI().picCompress(bitmap,picCompressCallback);
+ }
+
@Override
public void getDeviceLog(IFileReceiverCallback iFileReceiverCallback) {
if(FileHandler.getInstance().isFileSendStart||FileHandler.getInstance().isReceiverStart){
if (pairState == 2) {
//拒绝配对
BleHandle.getInstance().connectStateChange(BtVtransferCallback.STATE_CONNECTFAIL);
- } else {
+ } else if (pairState == 1){
// BleHandle.getInstance().sure_peidui();
+ BleHandle.getInstance().creatBond();
}
break;
case MsgBody.TYPE_SET_TIME:
PolymerizeAgent.getInstance().getAuthenAPI().setAIChannelKey("moonshot", "", callback);
}else if(checkChannel==3){
PolymerizeAgent.getInstance().getAuthenAPI().setAIChannelKey("huoshan", "", callback);
+ }else if(checkChannel==4){
+ PolymerizeAgent.getInstance().getAuthenAPI().setAIChannelKey("aliyun", "", callback);
+ }else if(checkChannel==5){
+ PolymerizeAgent.getInstance().getAuthenAPI().setAIChannelKey("xunfei", "", callback);
}
break;