|
@@ -96,6 +96,7 @@
|
|
|
fileLengthNum = data[@"fileLength"];
|
|
|
}
|
|
|
|
|
|
+ self.curBackupsPostion = [fileLengthNum longValue];
|
|
|
|
|
|
if(self.curPhotosBackupsTaskMod.curUploadFileType == uploadFileTypeImage){
|
|
|
|
|
@@ -302,6 +303,7 @@
|
|
|
fileLengthNum = data[@"fileLenth"];
|
|
|
}
|
|
|
|
|
|
+ self.curBackupsPostion = [fileLengthNum longValue];
|
|
|
[self handleBackupsingFun:fileLengthNum];
|
|
|
}
|
|
|
}
|
|
@@ -321,6 +323,13 @@
|
|
|
#pragma mark 处理上传过程
|
|
|
- (void)handleBackupsingFun:(NSNumber*)fileLengthNum
|
|
|
{
|
|
|
+ //异常处理
|
|
|
+ if(fileLengthNum.longValue < 0)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
BOOL isCanUseCellular = [HWDataManager getBoolWithKey:stringKeyAddSn(Const_file_backups_canUse_Cellular)];
|
|
|
|
|
|
if(!isCanUseCellular){//不允许流量备份
|
|
@@ -451,6 +460,24 @@
|
|
|
return [NSData dataWithBytes:result length:sizeof(result)];
|
|
|
}
|
|
|
|
|
|
+// long转NSData
|
|
|
+- (NSData *)long2Data:(long)i{
|
|
|
+ Byte b0 = i & 0xff;
|
|
|
+ Byte b1 = i >> 8 & 0xff;
|
|
|
+ Byte b2 = i >> 16 & 0xff;
|
|
|
+ Byte b3 = i >> 24 & 0xff;
|
|
|
+ Byte b4 = i >> 32 & 0xff;
|
|
|
+ Byte b5 = i >> 40 & 0xff;
|
|
|
+ Byte b6 = i >> 48 & 0xff;
|
|
|
+ Byte b7 = i >> 56 & 0xff;
|
|
|
+
|
|
|
+ // 有大小端模式问题?
|
|
|
+ //Byte result[] = {b0, b1, b2, b3};
|
|
|
+ //Byte result[] = {b3, b2, b1, b0};
|
|
|
+ Byte result[] = {b7, b6, b5,b4,b3, b2, b1, b0};
|
|
|
+ return [NSData dataWithBytes:result length:sizeof(result)];
|
|
|
+}
|
|
|
+
|
|
|
// short转NSData
|
|
|
- (NSData *)short2Data:(short)i{
|
|
|
Byte b0 = i & 0xff;
|
|
@@ -491,7 +518,8 @@
|
|
|
//msgType
|
|
|
//unsigned char msgType = 12;
|
|
|
//unsigned char msgType = 15;
|
|
|
- unsigned char msgType = 16;
|
|
|
+ //unsigned char msgType = 16;
|
|
|
+ unsigned char msgType = 21;
|
|
|
NSData *msgTypeData = [NSMutableData dataWithBytes:&msgType length:sizeof(msgType)];
|
|
|
//HLog(@"msgTypeData:%@",msgTypeData);
|
|
|
|
|
@@ -508,7 +536,7 @@
|
|
|
|
|
|
|
|
|
//curNum
|
|
|
- int curNum = (int)self.backupsIndexOfUploadFlie;
|
|
|
+ int curNum = (int)self.backupsIndexOfUploadFlie + 1;
|
|
|
//NSData *curNumData = [NSData dataWithBytes:&curNum length:sizeof(curNum)];
|
|
|
NSData * curNumData = [self int2Data:curNum];
|
|
|
//HLog(@"curNumData:%@",curNumData);
|
|
@@ -519,6 +547,9 @@
|
|
|
NSData * totalNumData = [self int2Data:totalNum];
|
|
|
//HLog(@"totalNumData:%@",totalNumData);
|
|
|
|
|
|
+ long Postion = self.curBackupsPostion;
|
|
|
+ NSData * PostionData = [self long2Data:Postion];
|
|
|
+ HLog(@"PostionData:%@",PostionData);
|
|
|
|
|
|
NSMutableData *checkBCCData = [NSMutableData new];
|
|
|
[checkBCCData appendData:msgTypeData];
|
|
@@ -526,6 +557,7 @@
|
|
|
[checkBCCData appendData:datalenData];
|
|
|
[checkBCCData appendData:curNumData];
|
|
|
[checkBCCData appendData:totalNumData];
|
|
|
+ [checkBCCData appendData:PostionData];
|
|
|
[checkBCCData appendData:curData];
|
|
|
|
|
|
long length = [curData length];
|