@@ -4,13 +4,8 @@ import * as crypto from "crypto";
4
4
const PROTOCOL_VERSION_LENGTH_SIZE = 1 ;
5
5
const PROTOCOL_OPERATION_LENGTH_SIZE = 1 ;
6
6
const SIZE_BYTE_LENGTH = 1 ;
7
- const ERROR_REPORT = 1 ;
8
- const OPERATION_END_REPORT = 2 ;
9
- const OPERATION_END_NO_REFRESH_REPORT_CODE = 3 ;
10
7
const REPORT_LENGTH = 1 ;
11
8
const DO_REFRESH_LENGTH = 1 ;
12
- const DO_REFRESH = 1 ;
13
- const SKIP_REFRESH = 0 ;
14
9
const SYNC_OPERATION_TIMEOUT = 60000 ;
15
10
const TRY_CONNECT_TIMEOUT = 30000 ;
16
11
const DEFAULT_LOCAL_HOST_ADDRESS = "127.0.0.1" ;
@@ -19,6 +14,11 @@ export class AndroidLivesyncTool implements IAndroidLivesyncTool {
19
14
public static DELETE_FILE_OPERATION = 7 ;
20
15
public static CREATE_FILE_OPERATION = 8 ;
21
16
public static DO_SYNC_OPERATION = 9 ;
17
+ public static ERROR_REPORT = 1 ;
18
+ public static OPERATION_END_REPORT = 2 ;
19
+ public static OPERATION_END_NO_REFRESH_REPORT_CODE = 3 ;
20
+ public static DO_REFRESH = 1 ;
21
+ public static SKIP_REFRESH = 0 ;
22
22
public protocolVersion : string ;
23
23
private operationPromises : IDictionary < any > ;
24
24
private socketError : string | Error ;
@@ -50,7 +50,7 @@ export class AndroidLivesyncTool implements IAndroidLivesyncTool {
50
50
}
51
51
52
52
if ( ! configuration . appPlatformsPath ) {
53
- this . $errors . fail ( `You need to provide "baseDir " as a configuration property!` ) ;
53
+ this . $errors . fail ( `You need to provide "appPlatformsPath " as a configuration property!` ) ;
54
54
}
55
55
56
56
if ( this . socketConnection ) {
@@ -140,7 +140,7 @@ export class AndroidLivesyncTool implements IAndroidLivesyncTool {
140
140
const message = `${ AndroidLivesyncTool . DO_SYNC_OPERATION } ${ id } ` ;
141
141
const headerBuffer = Buffer . alloc ( Buffer . byteLength ( message ) + DO_REFRESH_LENGTH ) ;
142
142
const socketId = this . socketConnection . uid ;
143
- const doRefreshCode = doRefresh ? DO_REFRESH : SKIP_REFRESH ;
143
+ const doRefreshCode = doRefresh ? AndroidLivesyncTool . DO_REFRESH : AndroidLivesyncTool . SKIP_REFRESH ;
144
144
const offset = headerBuffer . write ( message ) ;
145
145
146
146
headerBuffer . writeUInt8 ( doRefreshCode , offset ) ;
@@ -374,13 +374,13 @@ export class AndroidLivesyncTool implements IAndroidLivesyncTool {
374
374
const reportType = data . readUInt8 ( ) ;
375
375
const infoBuffer = data . slice ( REPORT_LENGTH , data . length ) ;
376
376
377
- if ( reportType === ERROR_REPORT ) {
377
+ if ( reportType === AndroidLivesyncTool . ERROR_REPORT ) {
378
378
const errorMessage = infoBuffer . toString ( ) ;
379
379
this . handleSocketError ( socketId , errorMessage ) ;
380
- } else if ( reportType === OPERATION_END_REPORT ) {
381
- this . handleSyncEnd ( { data :infoBuffer , didRefresh : true } ) ;
382
- } else if ( reportType === OPERATION_END_NO_REFRESH_REPORT_CODE ) {
383
- this . handleSyncEnd ( { data :infoBuffer , didRefresh : false } ) ;
380
+ } else if ( reportType === AndroidLivesyncTool . OPERATION_END_REPORT ) {
381
+ this . handleSyncEnd ( { data : infoBuffer , didRefresh : true } ) ;
382
+ } else if ( reportType === AndroidLivesyncTool . OPERATION_END_NO_REFRESH_REPORT_CODE ) {
383
+ this . handleSyncEnd ( { data : infoBuffer , didRefresh : false } ) ;
384
384
}
385
385
}
386
386
0 commit comments