@@ -4,13 +4,8 @@ import * as crypto from "crypto";
44const PROTOCOL_VERSION_LENGTH_SIZE = 1 ;
55const PROTOCOL_OPERATION_LENGTH_SIZE = 1 ;
66const SIZE_BYTE_LENGTH = 1 ;
7- const ERROR_REPORT = 1 ;
8- const OPERATION_END_REPORT = 2 ;
9- const OPERATION_END_NO_REFRESH_REPORT_CODE = 3 ;
107const REPORT_LENGTH = 1 ;
118const DO_REFRESH_LENGTH = 1 ;
12- const DO_REFRESH = 1 ;
13- const SKIP_REFRESH = 0 ;
149const SYNC_OPERATION_TIMEOUT = 60000 ;
1510const TRY_CONNECT_TIMEOUT = 30000 ;
1611const DEFAULT_LOCAL_HOST_ADDRESS = "127.0.0.1" ;
@@ -19,6 +14,11 @@ export class AndroidLivesyncTool implements IAndroidLivesyncTool {
1914 public static DELETE_FILE_OPERATION = 7 ;
2015 public static CREATE_FILE_OPERATION = 8 ;
2116 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 ;
2222 public protocolVersion : string ;
2323 private operationPromises : IDictionary < any > ;
2424 private socketError : string | Error ;
@@ -50,7 +50,7 @@ export class AndroidLivesyncTool implements IAndroidLivesyncTool {
5050 }
5151
5252 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!` ) ;
5454 }
5555
5656 if ( this . socketConnection ) {
@@ -140,7 +140,7 @@ export class AndroidLivesyncTool implements IAndroidLivesyncTool {
140140 const message = `${ AndroidLivesyncTool . DO_SYNC_OPERATION } ${ id } ` ;
141141 const headerBuffer = Buffer . alloc ( Buffer . byteLength ( message ) + DO_REFRESH_LENGTH ) ;
142142 const socketId = this . socketConnection . uid ;
143- const doRefreshCode = doRefresh ? DO_REFRESH : SKIP_REFRESH ;
143+ const doRefreshCode = doRefresh ? AndroidLivesyncTool . DO_REFRESH : AndroidLivesyncTool . SKIP_REFRESH ;
144144 const offset = headerBuffer . write ( message ) ;
145145
146146 headerBuffer . writeUInt8 ( doRefreshCode , offset ) ;
@@ -374,13 +374,13 @@ export class AndroidLivesyncTool implements IAndroidLivesyncTool {
374374 const reportType = data . readUInt8 ( ) ;
375375 const infoBuffer = data . slice ( REPORT_LENGTH , data . length ) ;
376376
377- if ( reportType === ERROR_REPORT ) {
377+ if ( reportType === AndroidLivesyncTool . ERROR_REPORT ) {
378378 const errorMessage = infoBuffer . toString ( ) ;
379379 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 } ) ;
384384 }
385385 }
386386
0 commit comments