@@ -1007,12 +1007,12 @@ EipStatus CipFilePostCreateCallback(CipInstance *RESTRICT const new_instance,
1007
1007
file_instance -> file_name .number_of_strings = 0 ; //empty file name
1008
1008
file_instance -> invocation_method = kCipFileInvocationMethodNotApplicable ;
1009
1009
1010
- EipStatus internal_state = CreateFileObject (new_instance -> instance_number ,
1011
- file_instance , false);
1010
+ EipStatus internal_state = CreateFileObject (new_instance -> instance_number ,
1011
+ file_instance , false);
1012
1012
1013
- new_instance -> data = file_instance ;
1014
- CipFileSetDownloadAndClearSupported (file_instance );
1015
- file_instance -> delete_instance_data = & CipFileDeleteInstanceData ;
1013
+ new_instance -> data = file_instance ;
1014
+ CipFileSetDownloadAndClearSupported (file_instance );
1015
+ file_instance -> delete_instance_data = & CipFileDeleteInstanceData ;
1016
1016
1017
1017
AddIntToMessage (new_instance -> instance_number ,
1018
1018
& (message_router_response -> message ));
@@ -1170,6 +1170,37 @@ EipStatus CipFileCreateEDSAndIconFileInstance() {
1170
1170
return kEipStatusOk ;
1171
1171
}
1172
1172
1173
+ /** @brief creates empty file object instance
1174
+ *
1175
+ * @param instance_name_string name of the created file object instance
1176
+ */
1177
+ CipInstance CipFileCreateInstance (char * instance_name_string ) {
1178
+ CipInstance * new_instance = AddCipInstances (file_object_class , 1 );
1179
+
1180
+ // create new file object struct
1181
+ CipFileObjectValues * file_instance =
1182
+ CipCalloc (1 , sizeof (CipFileObjectValues ));
1183
+
1184
+ CipFileSetInstanceName (file_instance , instance_name_string ,
1185
+ strlen (instance_name_string ) + 1 );
1186
+
1187
+ // default values
1188
+ file_instance -> state = kCipFileObjectStateFileEmpty ;
1189
+ file_instance -> file_revision .major_revision = 0 ;
1190
+ file_instance -> file_revision .minor_revision = 0 ;
1191
+ file_instance -> file_name .number_of_strings = 0 ; // empty file name
1192
+ file_instance -> invocation_method = kCipFileInvocationMethodNotApplicable ;
1193
+ file_instance -> file_encoding_format = kCipFileObjectFileEncodingFormatBinary ;
1194
+
1195
+ CreateFileObject (new_instance -> instance_number , file_instance , false);
1196
+
1197
+ new_instance -> data = file_instance ;
1198
+ CipFileSetDownloadAndClearSupported (file_instance );
1199
+ file_instance -> delete_instance_data = & CipFileDeleteInstanceData ;
1200
+
1201
+ return * new_instance ;
1202
+ }
1203
+
1173
1204
EipStatus CipFileInit () {
1174
1205
if (NULL == (file_object_class = CreateCipClass (kCipFileObjectClassCode , 7 , /* # class attributes */
1175
1206
32 , /* # highest class attribute number */
0 commit comments