Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OCPP 2.0.1: Refactor Smart Charging Persistence #790

Merged
merged 15 commits into from
Oct 4, 2024

Commits on Sep 26, 2024

  1. smart_charging: Store ChargingLimitSource

    When calling `validate_and_add_profile()`, `add_profile()`, and
    `insert_or_update_charging_profile()`, we now can be given a source for
    the profile. This source is stored in our database and can be retrieved
    with the new method, `get_charging_limit_source_for_profile()`.
    
    We use this new method to retrieve the source when retrieving profiles
    for K09.
    
    All new functionality is under test.
    
    Co-authored-by: Coury Richards <[email protected]>
    Signed-off-by: Christopher Davis <[email protected]>
    christopher-davis-afs and couryrr-afs committed Sep 26, 2024
    Configuration menu
    Copy the full SHA
    7f6f951 View commit details
    Browse the repository at this point in the history
  2. database_handler: Add function to get profiles by EVSE ID

    Signed-off-by: Christopher Davis <[email protected]>
    christopher-davis-afs committed Sep 26, 2024
    Configuration menu
    Copy the full SHA
    b097289 View commit details
    Browse the repository at this point in the history
  3. smart_charging: Use new database handler func

    Signed-off-by: Christopher Davis <[email protected]>
    christopher-davis-afs committed Sep 26, 2024
    Configuration menu
    Copy the full SHA
    b685850 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    8574a9c View commit details
    Browse the repository at this point in the history
  5. smart_charging: Only store and load profiles from db

    Remove the map of profiles from the smart charging handler and use the
    database for storing, loading, and finding profiles.
    
    We've removed the function for getting all profiles from the
    smart charging handler, and in all cases where that was used, including
    tests, we retrieve the profiles from the database.
    
    Signed-off-by: Christopher Davis <[email protected]>
    christopher-davis-afs committed Sep 26, 2024
    Configuration menu
    Copy the full SHA
    4ec52b4 View commit details
    Browse the repository at this point in the history
  6. database_handler: Fix storage of charging profile purpose

    SQLite needs to hold onto a copy of the string in order for it to be
    stored properly.
    
    Signed-off-by: Christopher Davis <[email protected]>
    christopher-davis-afs committed Sep 26, 2024
    Configuration menu
    Copy the full SHA
    30492dd View commit details
    Browse the repository at this point in the history

Commits on Oct 2, 2024

  1. database_handler: Store transaction ID on profiles

    Edit the migration file for charging limit sources and remove
    
    Signed-off-by: Christopher Davis <[email protected]>
    christopher-davis-afs committed Oct 2, 2024
    Configuration menu
    Copy the full SHA
    22b541a View commit details
    Browse the repository at this point in the history

Commits on Oct 3, 2024

  1. database_handler: Add function for new statements

    Signed-off-by: Christopher Davis <[email protected]>
    christopher-davis-afs committed Oct 3, 2024
    Configuration menu
    Copy the full SHA
    ff6396c View commit details
    Browse the repository at this point in the history
  2. smart_charging: Query database for matches directly

    Use the database handler to select matching profiles instead of
    iterating over the entire list of profiles.
    
    Signed-off-by: Christopher Davis <[email protected]>
    christopher-davis-afs committed Oct 3, 2024
    Configuration menu
    Copy the full SHA
    a3981bc View commit details
    Browse the repository at this point in the history
  3. smart_charging, database_handler: Use db for K10

    Use new functions on the database handler to
    reimplement clearing charging profiles by a given
    set of criteria. This removes the existing
    implementation within the smart charging handler.
    
    Signed-off-by: Christopher Davis <[email protected]>
    christopher-davis-afs committed Oct 3, 2024
    Configuration menu
    Copy the full SHA
    6b70190 View commit details
    Browse the repository at this point in the history
  4. smart_charging, types: Move ReportedChargingProfiles

    Move the ReportedChargingProfiles struct to types.hpp where it can
    be used in e.g. DatabaseHandler without causing recursive imports.
    
    Signed-off-by: Christopher Davis <[email protected]>
    christopher-davis-afs committed Oct 3, 2024
    Configuration menu
    Copy the full SHA
    3010338 View commit details
    Browse the repository at this point in the history
  5. smart_charging, database_handler: Use db for K09

    Use new functions on the database handler to
    implement getting charging profiles by criteria.
    This allows us to remove more places where we were
    iterating over the entire list of charging
    profiles.
    
    This commit includes a fix for a bug where we
    were only accepting searches if one of the sources
    we were searching for is CSO.
    
    Co-authored-by: Christopher Davis <[email protected]>
    Signed-off-by: Coury Richards <[email protected]>
    Signed-off-by: Christopher Davis <[email protected]>
    couryrr-afs and christopher-davis-afs committed Oct 3, 2024
    Configuration menu
    Copy the full SHA
    26af863 View commit details
    Browse the repository at this point in the history
  6. smart_charging: Use db for overlapping validity periods

    Signed-off-by: Christopher Davis <[email protected]>
    christopher-davis-afs committed Oct 3, 2024
    Configuration menu
    Copy the full SHA
    dc19c7a View commit details
    Browse the repository at this point in the history
  7. dependencies: Rename json_schema_validator dep

    The name wasn't quite right, leading to some confusion.
    
    Signed-off-by: Christopher Davis <[email protected]>
    christopher-davis-afs committed Oct 3, 2024
    Configuration menu
    Copy the full SHA
    212a8f8 View commit details
    Browse the repository at this point in the history
  8. Renamed the method load charging profiles to clear invalid charging p…

    …rofiles, removed logic that adds profiles and replaced it with logic that only removes invalid profiles
    
    Signed-off-by: Peter Giavotto <[email protected]>
    Giavotto authored and christopher-davis-afs committed Oct 3, 2024
    Configuration menu
    Copy the full SHA
    d3ef256 View commit details
    Browse the repository at this point in the history