Skip to content

Commit

Permalink
Update core.
Browse files Browse the repository at this point in the history
  • Loading branch information
mobizt committed Sep 9, 2023
1 parent 90d1c63 commit cdfc77e
Show file tree
Hide file tree
Showing 31 changed files with 321 additions and 306 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -231,26 +231,26 @@ void creatFunction()
/* The function to show the Cloud Function deployment status */
void functionCreationCallback(FunctionsOperationStatusInfo statusInfo)
{
if (statusInfo.status == fb_esp_functions_operation_status_unknown)
if (statusInfo.status == firebase_functions_operation_status_unknown)
Serial.printf("%s: Unknown\n", statusInfo.functionId.c_str());
else if (statusInfo.status == fb_esp_functions_operation_status_generate_upload_url)
else if (statusInfo.status == firebase_functions_operation_status_generate_upload_url)
Serial.printf("%s: Generate the upload Url...\n", statusInfo.functionId.c_str());
else if (statusInfo.status == fb_esp_functions_operation_status_upload_source_file_in_progress)
else if (statusInfo.status == firebase_functions_operation_status_upload_source_file_in_progress)
Serial.printf("%s: Uploading file...\n", statusInfo.functionId.c_str());
else if (statusInfo.status == fb_esp_functions_operation_status_deploy_in_progress)
else if (statusInfo.status == firebase_functions_operation_status_deploy_in_progress)
Serial.printf("%s: Deploying function...\n", statusInfo.functionId.c_str());
else if (statusInfo.status == fb_esp_functions_operation_status_set_iam_policy_in_progress)
else if (statusInfo.status == firebase_functions_operation_status_set_iam_policy_in_progress)
Serial.printf("%s: Set the IAM policy...\n", statusInfo.functionId.c_str());
else if (statusInfo.status == fb_esp_functions_operation_status_delete_in_progress)
else if (statusInfo.status == firebase_functions_operation_status_delete_in_progress)
Serial.printf("%s: Delete the function...\n", statusInfo.functionId.c_str());
else if (statusInfo.status == fb_esp_functions_operation_status_finished)
else if (statusInfo.status == firebase_functions_operation_status_finished)
{
Serial.printf("%s: success\n", statusInfo.functionId.c_str());
Serial.print("Trigger Url: ");
Serial.println(statusInfo.triggerUrl.c_str());
Serial.println();
}
else if (statusInfo.status == fb_esp_functions_operation_status_error)
else if (statusInfo.status == firebase_functions_operation_status_error)
{
Serial.printf("%s: Error, ", statusInfo.functionId.c_str());
Serial.println(statusInfo.errorMsg.c_str());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,26 +225,26 @@ void creatFunction()
/* The function to show the Cloud Function deployment status */
void functionCreationCallback(FunctionsOperationStatusInfo statusInfo)
{
if (statusInfo.status == fb_esp_functions_operation_status_unknown)
if (statusInfo.status == firebase_functions_operation_status_unknown)
Serial.printf("%s: Unknown\n", statusInfo.functionId.c_str());
else if (statusInfo.status == fb_esp_functions_operation_status_generate_upload_url)
else if (statusInfo.status == firebase_functions_operation_status_generate_upload_url)
Serial.printf("%s: Generate the upload Url...\n", statusInfo.functionId.c_str());
else if (statusInfo.status == fb_esp_functions_operation_status_upload_source_file_in_progress)
else if (statusInfo.status == firebase_functions_operation_status_upload_source_file_in_progress)
Serial.printf("%s: Uploading file...\n", statusInfo.functionId.c_str());
else if (statusInfo.status == fb_esp_functions_operation_status_deploy_in_progress)
else if (statusInfo.status == firebase_functions_operation_status_deploy_in_progress)
Serial.printf("%s: Deploying function...\n", statusInfo.functionId.c_str());
else if (statusInfo.status == fb_esp_functions_operation_status_set_iam_policy_in_progress)
else if (statusInfo.status == firebase_functions_operation_status_set_iam_policy_in_progress)
Serial.printf("%s: Set the IAM policy...\n", statusInfo.functionId.c_str());
else if (statusInfo.status == fb_esp_functions_operation_status_delete_in_progress)
else if (statusInfo.status == firebase_functions_operation_status_delete_in_progress)
Serial.printf("%s: Delete the function...\n", statusInfo.functionId.c_str());
else if (statusInfo.status == fb_esp_functions_operation_status_finished)
else if (statusInfo.status == firebase_functions_operation_status_finished)
{
Serial.printf("%s: success\n", statusInfo.functionId.c_str());
Serial.print("Trigger Url: ");
Serial.println(statusInfo.triggerUrl.c_str());
Serial.println();
}
else if (statusInfo.status == fb_esp_functions_operation_status_error)
else if (statusInfo.status == firebase_functions_operation_status_error)
{
Serial.printf("%s: Error, ", statusInfo.functionId.c_str());
Serial.println(statusInfo.errorMsg.c_str());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,24 +239,24 @@ void creatFunction()
/* The function to show the Cloud Function deployment status */
void functionCreationCallback(FunctionsOperationStatusInfo statusInfo)
{
if (statusInfo.status == fb_esp_functions_operation_status_unknown)
if (statusInfo.status == firebase_functions_operation_status_unknown)
Serial.printf("%s: Unknown\n", statusInfo.functionId.c_str());
else if (statusInfo.status == fb_esp_functions_operation_status_generate_upload_url)
else if (statusInfo.status == firebase_functions_operation_status_generate_upload_url)
Serial.printf("%s: Generate the upload Url...\n", statusInfo.functionId.c_str());
else if (statusInfo.status == fb_esp_functions_operation_status_upload_source_file_in_progress)
else if (statusInfo.status == firebase_functions_operation_status_upload_source_file_in_progress)
Serial.printf("%s: Uploading file...\n", statusInfo.functionId.c_str());
else if (statusInfo.status == fb_esp_functions_operation_status_deploy_in_progress)
else if (statusInfo.status == firebase_functions_operation_status_deploy_in_progress)
Serial.printf("%s: Deploying function...\n", statusInfo.functionId.c_str());
else if (statusInfo.status == fb_esp_functions_operation_status_set_iam_policy_in_progress)
else if (statusInfo.status == firebase_functions_operation_status_set_iam_policy_in_progress)
Serial.printf("%s: Set the IAM policy...\n", statusInfo.functionId.c_str());
else if (statusInfo.status == fb_esp_functions_operation_status_delete_in_progress)
else if (statusInfo.status == firebase_functions_operation_status_delete_in_progress)
Serial.printf("%s: Delete the function...\n", statusInfo.functionId.c_str());
else if (statusInfo.status == fb_esp_functions_operation_status_finished)
else if (statusInfo.status == firebase_functions_operation_status_finished)
{
Serial.printf("%s: success\n", statusInfo.functionId.c_str());
Serial.println();
}
else if (statusInfo.status == fb_esp_functions_operation_status_error)
else if (statusInfo.status == firebase_functions_operation_status_error)
{
Serial.printf("%s: Error, ", statusInfo.functionId.c_str());
Serial.println(statusInfo.errorMsg.c_str());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ bool taskCompleted = false;
/* Define the FunctionsOperationStatusInfo data to get the Cloud Function creation status */
FunctionsOperationStatusInfo statusInfo;

fb_esp_functions_operation_status last_status;
firebase_functions_operation_status last_status;

#if defined(ARDUINO_RASPBERRY_PI_PICO_W)
WiFiMulti multi;
Expand Down Expand Up @@ -237,26 +237,26 @@ void showFunctionCreationStatus(FunctionsOperationStatusInfo statusInfo)

last_status = statusInfo.status;

if (statusInfo.status == fb_esp_functions_operation_status_unknown)
if (statusInfo.status == firebase_functions_operation_status_unknown)
Serial.printf("%s: Unknown\n", statusInfo.functionId.c_str());
else if (statusInfo.status == fb_esp_functions_operation_status_generate_upload_url)
else if (statusInfo.status == firebase_functions_operation_status_generate_upload_url)
Serial.printf("%s: Generate the upload Url...\n", statusInfo.functionId.c_str());
else if (statusInfo.status == fb_esp_functions_operation_status_upload_source_file_in_progress)
else if (statusInfo.status == firebase_functions_operation_status_upload_source_file_in_progress)
Serial.printf("%s: Uploading file...\n", statusInfo.functionId.c_str());
else if (statusInfo.status == fb_esp_functions_operation_status_deploy_in_progress)
else if (statusInfo.status == firebase_functions_operation_status_deploy_in_progress)
Serial.printf("%s: Deploying function...\n", statusInfo.functionId.c_str());
else if (statusInfo.status == fb_esp_functions_operation_status_set_iam_policy_in_progress)
else if (statusInfo.status == firebase_functions_operation_status_set_iam_policy_in_progress)
Serial.printf("%s: Set the IAM policy...\n", statusInfo.functionId.c_str());
else if (statusInfo.status == fb_esp_functions_operation_status_delete_in_progress)
else if (statusInfo.status == firebase_functions_operation_status_delete_in_progress)
Serial.printf("%s: Delete the function...\n", statusInfo.functionId.c_str());
else if (statusInfo.status == fb_esp_functions_operation_status_finished)
else if (statusInfo.status == firebase_functions_operation_status_finished)
{
Serial.println("Status: success");
Serial.print("Trigger Url: ");
Serial.println(statusInfo.triggerUrl.c_str());
Serial.println();
}
else if (statusInfo.status == fb_esp_functions_operation_status_error)
else if (statusInfo.status == firebase_functions_operation_status_error)
{
Serial.print("Status: ");
Serial.println(statusInfo.errorMsg.c_str());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,24 +209,24 @@ void deployAutoZip()
/* The function to show the Cloud Function deployment status */
void functionCreationCallback(FunctionsOperationStatusInfo statusInfo)
{
if (statusInfo.status == fb_esp_functions_operation_status_unknown)
if (statusInfo.status == firebase_functions_operation_status_unknown)
Serial.printf("%s: Unknown\n", statusInfo.functionId.c_str());
else if (statusInfo.status == fb_esp_functions_operation_status_generate_upload_url)
else if (statusInfo.status == firebase_functions_operation_status_generate_upload_url)
Serial.printf("%s: Generate the upload Url...\n", statusInfo.functionId.c_str());
else if (statusInfo.status == fb_esp_functions_operation_status_upload_source_file_in_progress)
else if (statusInfo.status == firebase_functions_operation_status_upload_source_file_in_progress)
Serial.printf("%s: Uploading file...\n", statusInfo.functionId.c_str());
else if (statusInfo.status == fb_esp_functions_operation_status_deploy_in_progress)
else if (statusInfo.status == firebase_functions_operation_status_deploy_in_progress)
Serial.printf("%s: Deploying function...\n", statusInfo.functionId.c_str());
else if (statusInfo.status == fb_esp_functions_operation_status_set_iam_policy_in_progress)
else if (statusInfo.status == firebase_functions_operation_status_set_iam_policy_in_progress)
Serial.printf("%s: Set the IAM policy...\n", statusInfo.functionId.c_str());
else if (statusInfo.status == fb_esp_functions_operation_status_delete_in_progress)
else if (statusInfo.status == firebase_functions_operation_status_delete_in_progress)
Serial.printf("%s: Delete the function...\n", statusInfo.functionId.c_str());
else if (statusInfo.status == fb_esp_functions_operation_status_finished)
else if (statusInfo.status == firebase_functions_operation_status_finished)
{
Serial.printf("%s: success\n", statusInfo.functionId.c_str());
Serial.println();
}
else if (statusInfo.status == fb_esp_functions_operation_status_error)
else if (statusInfo.status == firebase_functions_operation_status_error)
{
Serial.printf("%s: Error, ", statusInfo.functionId.c_str());
Serial.println(statusInfo.errorMsg.c_str());
Expand Down
42 changes: 21 additions & 21 deletions examples/Firestore/BatchWriteDocuments/BatchWriteDocuments.ino
Original file line number Diff line number Diff line change
Expand Up @@ -137,17 +137,17 @@ void loop()

Serial.print("Batch write documents... ");

// The dyamic array of write object fb_esp_firestore_document_write_t.
std::vector<struct fb_esp_firestore_document_write_t> writes;
// The dyamic array of write object firebase_firestore_document_write_t.
std::vector<struct firebase_firestore_document_write_t> writes;

// A write object that will be written to the document.
struct fb_esp_firestore_document_write_t update_write;
struct firebase_firestore_document_write_t update_write;

// Set the write object write operation type.
// fb_esp_firestore_document_write_type_update,
// fb_esp_firestore_document_write_type_delete,
// fb_esp_firestore_document_write_type_transform
update_write.type = fb_esp_firestore_document_write_type_update;
// firebase_firestore_document_write_type_update,
// firebase_firestore_document_write_type_delete,
// firebase_firestore_document_write_type_transform
update_write.type = firebase_firestore_document_write_type_update;

// Set the document content to write (transform)

Expand All @@ -169,31 +169,31 @@ void loop()
writes.push_back(update_write);

// A write object that will be written to the document.
struct fb_esp_firestore_document_write_t transform_write;
struct firebase_firestore_document_write_t transform_write;

// Set the write object write operation type.
// fb_esp_firestore_document_write_type_update,
// fb_esp_firestore_document_write_type_delete,
// fb_esp_firestore_document_write_type_transform
transform_write.type = fb_esp_firestore_document_write_type_transform;
// firebase_firestore_document_write_type_update,
// firebase_firestore_document_write_type_delete,
// firebase_firestore_document_write_type_transform
transform_write.type = firebase_firestore_document_write_type_transform;

// Set the document path of document to write (transform)
transform_write.document_transform.transform_document_path = documentPath2;

// Set a transformation of a field of the document.
struct fb_esp_firestore_document_write_field_transforms_t field_transforms;
struct firebase_firestore_document_write_field_transforms_t field_transforms;

// Set field path to write.
field_transforms.fieldPath = "myTime";

// Set the transformation type.
// fb_esp_firestore_transform_type_set_to_server_value,
// fb_esp_firestore_transform_type_increment,
// fb_esp_firestore_transform_type_maaximum,
// fb_esp_firestore_transform_type_minimum,
// fb_esp_firestore_transform_type_append_missing_elements,
// fb_esp_firestore_transform_type_remove_all_from_array
field_transforms.transform_type = fb_esp_firestore_transform_type_set_to_server_value;
// firebase_firestore_transform_type_set_to_server_value,
// firebase_firestore_transform_type_increment,
// firebase_firestore_transform_type_maaximum,
// firebase_firestore_transform_type_minimum,
// firebase_firestore_transform_type_append_missing_elements,
// firebase_firestore_transform_type_remove_all_from_array
field_transforms.transform_type = firebase_firestore_transform_type_set_to_server_value;

// Set the transformation content, server value for this case.
// See https://firebase.google.com/docs/firestore/reference/rest/v1/Write#servervalue
Expand All @@ -205,7 +205,7 @@ void loop()
// Add a write object to a write array.
writes.push_back(transform_write);

if (Firebase.Firestore.batchWriteDocuments(&fbdo, FIREBASE_PROJECT_ID, "" /* databaseId can be (default) or empty */, writes /* dynamic array of fb_esp_firestore_document_write_t */, nullptr /* labels */))
if (Firebase.Firestore.batchWriteDocuments(&fbdo, FIREBASE_PROJECT_ID, "" /* databaseId can be (default) or empty */, writes /* dynamic array of firebase_firestore_document_write_t */, nullptr /* labels */))
Serial.printf("ok\n%s\n\n", fbdo.payload().c_str());
else
Serial.println(fbdo.errorReason());
Expand Down
32 changes: 16 additions & 16 deletions examples/Firestore/CommitDocument/AppendArray/AppendArray.ino
Original file line number Diff line number Diff line change
Expand Up @@ -132,35 +132,35 @@ void loop()

Serial.print("Commit a document (append array)... ");

// The dyamic array of write object fb_esp_firestore_document_write_t.
std::vector<struct fb_esp_firestore_document_write_t> writes;
// The dyamic array of write object firebase_firestore_document_write_t.
std::vector<struct firebase_firestore_document_write_t> writes;

// A write object that will be written to the document.
struct fb_esp_firestore_document_write_t transform_write;
struct firebase_firestore_document_write_t transform_write;

// Set the write object write operation type.
// fb_esp_firestore_document_write_type_update,
// fb_esp_firestore_document_write_type_delete,
// fb_esp_firestore_document_write_type_transform
transform_write.type = fb_esp_firestore_document_write_type_transform;
// firebase_firestore_document_write_type_update,
// firebase_firestore_document_write_type_delete,
// firebase_firestore_document_write_type_transform
transform_write.type = firebase_firestore_document_write_type_transform;

// Set the document path of document to write (transform)
transform_write.document_transform.transform_document_path = "test_collection/test_document";

// Set a transformation of a field of the document.
struct fb_esp_firestore_document_write_field_transforms_t field_transforms;
struct firebase_firestore_document_write_field_transforms_t field_transforms;

// Set field path to write.
field_transforms.fieldPath = "appended_data";

// Set the transformation type.
// fb_esp_firestore_transform_type_set_to_server_value,
// fb_esp_firestore_transform_type_increment,
// fb_esp_firestore_transform_type_maaximum,
// fb_esp_firestore_transform_type_minimum,
// fb_esp_firestore_transform_type_append_missing_elements,
// fb_esp_firestore_transform_type_remove_all_from_array
field_transforms.transform_type = fb_esp_firestore_transform_type_append_missing_elements;
// firebase_firestore_transform_type_set_to_server_value,
// firebase_firestore_transform_type_increment,
// firebase_firestore_transform_type_maaximum,
// firebase_firestore_transform_type_minimum,
// firebase_firestore_transform_type_append_missing_elements,
// firebase_firestore_transform_type_remove_all_from_array
field_transforms.transform_type = firebase_firestore_transform_type_append_missing_elements;

// For the usage of FirebaseJson, see examples/FirebaseJson/BasicUsage/Create_Edit_Parse/Create_Edit_Parse.ino
FirebaseJson content;
Expand All @@ -178,7 +178,7 @@ void loop()
// Add a write object to a write array.
writes.push_back(transform_write);

if (Firebase.Firestore.commitDocument(&fbdo, FIREBASE_PROJECT_ID, "" /* databaseId can be (default) or empty */, writes /* dynamic array of fb_esp_firestore_document_write_t */, "" /* transaction */))
if (Firebase.Firestore.commitDocument(&fbdo, FIREBASE_PROJECT_ID, "" /* databaseId can be (default) or empty */, writes /* dynamic array of firebase_firestore_document_write_t */, "" /* transaction */))
Serial.printf("ok\n%s\n\n", fbdo.payload().c_str());
else
Serial.println(fbdo.errorReason());
Expand Down
Loading

0 comments on commit cdfc77e

Please sign in to comment.