@@ -969,6 +969,22 @@ protected virtual void SaveBinFileToDB()
969969 //
970970 }
971971
972+ /// <summary>
973+ /// Get Sensor ID
974+ /// </summary>
975+ /// <returns></returns>
976+ public virtual string GetSensorID ( )
977+ {
978+ if ( ProdConfig != null )
979+ {
980+ if ( ! String . IsNullOrEmpty ( ProdConfig . ASMID ) )
981+ {
982+ return ProdConfig . ASMID ;
983+ }
984+ }
985+ throw new Exception ( "ID unknown, please read production config first" ) ;
986+ }
987+
972988 /// <summary>
973989 /// For more advance API/App which associate sensors to participants
974990 /// </summary>
@@ -1531,7 +1547,16 @@ protected virtual void createBinFile(bool crcError)
15311547 //var trialSettings = RealmService.LoadTrialSettings();
15321548
15331549 //var participantID = asm.ParticipantID;
1534- binFileFolderDir = string . Format ( "{0}/{1}/{2}/BinaryFiles" , GetTrialName ( ) , GetParticipantID ( ) , Asm_uuid . ToString ( ) ) ;
1550+ String sensorID = Asm_uuid . ToString ( ) ;
1551+ try
1552+ {
1553+ sensorID = GetSensorID ( ) ;
1554+ } catch ( Exception ex ) // if production config wasnt read default to the UUID
1555+ {
1556+ sensorID = Asm_uuid . ToString ( ) ;
1557+ AdvanceLog ( ex . Message , "Defaulting to UUID" , dataFileName , ASMName ) ;
1558+ }
1559+ binFileFolderDir = string . Format ( "{0}/{1}/{2}/BinaryFiles" , GetTrialName ( ) , GetParticipantID ( ) , sensorID ) ;
15351560 var folder = Path . Combine ( DependencyService . Get < ILocalFolderService > ( ) . GetAppLocalFolder ( ) , binFileFolderDir ) ;
15361561
15371562 if ( ! Directory . Exists ( folder ) )
0 commit comments