Пример #1
0
 def on_authorize(self, id_tag):
     if id_tag in valid_tokens:
         return call_result.AuthorizePayload(
             id_tag_info={"status": AuthorizationStatus.accepted})
     else:
         return call_result.AuthorizePayload(
             id_tag_info={"status": AuthorizationStatus.invalid})
Пример #2
0
 def on_authorize_notification(self, **kwargs):
     return call_result.AuthorizePayload(
         id_tag_info={
             'expiryDate': datetime.utcnow().isoformat(),
             'parentIdTag': '123hhh',
             'status': AuthorizationStatus.accepted
         })
Пример #3
0
        def on_authorize_response(self, id_tag: str, **kwargs):
            global idTag
            idTag = id_tag
            print("He recibido: ", id_tag)

            return call_result.AuthorizePayload(
                id_tag_info={"status": AuthorizationStatus.accepted})
Пример #4
0
async def on_authorize(
    *, payload: call.AuthorizePayload, context: HandlerContext
) -> call_result.AuthorizePayload:
    print(f"(Central System) on_authorize Charging Station {id=}")
    response = call_result.AuthorizePayload(
        id_tag_info={"status": AuthorizationStatus.accepted}
    )
    return response
Пример #5
0
    def on_authorize_notification(self, **kwargs):
        print("cp -> server , on_authorize_notification: \n", kwargs, "\n")
        self.export_json_file(kwargs, "./dataFromCp2Server", "Authorize.req")

        response = call_result.AuthorizePayload(
            id_tag_info={
                'expiryDate': datetime.utcnow().isoformat(),
                'parentIdTag':
                '123hhh',  # Optional. This contains the parent-identifier.
                'status': AuthorizationStatus.
                accepted  # Required. This contains whether the idTag has been accepted or not by the Central System.
            })
        self.export_json_file(response.__dict__, "./dataFromCp2Server",
                              "Authorize.con")
        print("server -> cp, on_authorize_notification: \n", response, "\n")
        return response
Пример #6
0
    async def _on_authorize(self, id_tag: str,
                            **kwargs) -> call_result.AuthorizePayload:
        token = self._get_token(id_tag)
        # Log all authorization requests
        auth_req = AuthorizationRequest(token_string=id_tag,
                                        chargepoint=self._data_object,
                                        timestamp=utc_datetime())
        self._session.add(auth_req)
        self._session.commit()

        # TODO: Add parent tag if exists
        return call_result.AuthorizePayload(
            id_tag_info={
                'status':
                AuthorizationStatus.accepted if token else AuthorizationStatus.
                blocked
            })
Пример #7
0
        def on_authorize_response(self, id_tag: str):
            print("He recibido: ", id_tag)

            return call_result.AuthorizePayload(
                id_tag_info={"status": AuthorizationStatus.accepted})
Пример #8
0
 def on_authorize ( self, **kwargs ) :
     return call_result.AuthorizePayload(
         dict([('status', "Accepted"), ('expiryDate', "2023-09-17T10:44:33.638259"),
               ('parentIdTag', "Rajanbabu_simulator")])   ## Parent id taqge belongs to charger
     )
Пример #9
0
 def on_authorize(self, id_tag: str, **kwargs):
     return call_result.AuthorizePayload(
         id_tag_info={'status': AuthorizationStatus.accepted})