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

Uprotocol 1.5 #61

Closed
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2023 General Motors GTO LLC
# Copyright (c) 2024 General Motors GTO LLC
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
Expand Down
4 changes: 2 additions & 2 deletions Changelog
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
## Changelog

- June 04 2023 17:52:23 Giorgio Zoppi <giorgio.zoppi@iotdbe.com>
- June 04 2024 17:52:23 Giorgio Zoppi <giorgio.zoppi@iotdbe.com>
* Restructuring old code and deleting unused code.
* Adding coverage and ctest support
- June 10 2023 17:52:23 Giorgio Zoppi <giorgio.zoppi@iotdbe.com>
- June 10 2024 17:52:23 Giorgio Zoppi <giorgio.zoppi@iotdbe.com>
* Cleanup uuid as much it was possible
* Replaced current Meyer's singleton
* Separate include directory.
2 changes: 1 addition & 1 deletion cmake/up-core-api-protos.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2023 General Motors GTO LLC
# Copyright (c) 2024 General Motors GTO LLC
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
Expand Down
4 changes: 2 additions & 2 deletions include/up-cpp/cloudevent/datamodel/attributes.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 General Motors GTO LLC
* Copyright (c) 2024 General Motors GTO LLC
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
Expand All @@ -19,7 +19,7 @@
* under the License.
*
* SPDX-FileType: SOURCE
* SPDX-FileCopyrightText: 2023 General Motors GTO LLC
* SPDX-FileCopyrightText: 2024 General Motors GTO LLC
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef CPP_COULDEVENT_ATTRIBUTES_H_
Expand Down
4 changes: 2 additions & 2 deletions include/up-cpp/cloudevent/datamodel/cloud_event.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 General Motors GTO LLC
* Copyright (c) 2024 General Motors GTO LLC
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
Expand All @@ -19,7 +19,7 @@
* under the License.
*
* SPDX-FileType: SOURCE
* SPDX-FileCopyrightText: 2023 General Motors GTO LLC
* SPDX-FileCopyrightText: 2024 General Motors GTO LLC
* SPDX-License-Identifier: Apache-2.0
*/

Expand Down
4 changes: 2 additions & 2 deletions include/up-cpp/cloudevent/datamodel/format.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 General Motors GTO LLC
* Copyright (c) 2024 General Motors GTO LLC
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
Expand All @@ -19,7 +19,7 @@
* under the License.
*
* SPDX-FileType: SOURCE
* SPDX-FileCopyrightText: 2023 General Motors GTO LLC
* SPDX-FileCopyrightText: 2024 General Motors GTO LLC
* SPDX-License-Identifier: Apache-2.0
*/

Expand Down
4 changes: 2 additions & 2 deletions include/up-cpp/cloudevent/datamodel/priority.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 General Motors GTO LLC
* Copyright (c) 2024 General Motors GTO LLC
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
Expand All @@ -19,7 +19,7 @@
* under the License.
*
* SPDX-FileType: SOURCE
* SPDX-FileCopyrightText: 2023 General Motors GTO LLC
* SPDX-FileCopyrightText: 2024 General Motors GTO LLC
* SPDX-License-Identifier: Apache-2.0
*/

Expand Down
4 changes: 2 additions & 2 deletions include/up-cpp/cloudevent/datamodel/service_type.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 General Motors GTO LLC
* Copyright (c) 2024 General Motors GTO LLC
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
Expand All @@ -19,7 +19,7 @@
* under the License.
*
* SPDX-FileType: SOURCE
* SPDX-FileCopyrightText: 2023 General Motors GTO LLC
* SPDX-FileCopyrightText: 2024 General Motors GTO LLC
* SPDX-License-Identifier: Apache-2.0
*/

Expand Down
4 changes: 2 additions & 2 deletions include/up-cpp/cloudevent/datamodel/spec_version.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 General Motors GTO LLC
* Copyright (c) 2024 General Motors GTO LLC
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
Expand All @@ -19,7 +19,7 @@
* under the License.
*
* SPDX-FileType: SOURCE
* SPDX-FileCopyrightText: 2023 General Motors GTO LLC
* SPDX-FileCopyrightText: 2024 General Motors GTO LLC
* SPDX-License-Identifier: Apache-2.0
*/

Expand Down
4 changes: 2 additions & 2 deletions include/up-cpp/cloudevent/factory/cloud_event_factory.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 General Motors GTO LLC
* Copyright (c) 2024 General Motors GTO LLC
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
Expand All @@ -19,7 +19,7 @@
* under the License.
*
* SPDX-FileType: SOURCE
* SPDX-FileCopyrightText: 2023 General Motors GTO LLC
* SPDX-FileCopyrightText: 2024 General Motors GTO LLC
* SPDX-License-Identifier: Apache-2.0
*/

Expand Down
4 changes: 2 additions & 2 deletions include/up-cpp/cloudevent/serialize/binary_serializer.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 General Motors GTO LLC
* Copyright (c) 2024 General Motors GTO LLC
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
Expand All @@ -19,7 +19,7 @@
* under the License.
*
* SPDX-FileType: SOURCE
* SPDX-FileCopyrightText: 2023 General Motors GTO LLC
* SPDX-FileCopyrightText: 2024 General Motors GTO LLC
* SPDX-License-Identifier: Apache-2.0
*/

Expand Down
4 changes: 2 additions & 2 deletions include/up-cpp/cloudevent/serialize/json_serializer.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 General Motors GTO LLC
* Copyright (c) 2024 General Motors GTO LLC
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
Expand All @@ -19,7 +19,7 @@
* under the License.
*
* SPDX-FileType: SOURCE
* SPDX-FileCopyrightText: 2023 General Motors GTO LLC
* SPDX-FileCopyrightText: 2024 General Motors GTO LLC
* SPDX-License-Identifier: Apache-2.0
*/

Expand Down
7 changes: 3 additions & 4 deletions include/up-cpp/rpc/RpcClient.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 General Motors GTO LLC
* Copyright (c) 2024 General Motors GTO LLC
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
Expand All @@ -19,16 +19,15 @@
* under the License.
*
* SPDX-FileType: SOURCE
* SPDX-FileCopyrightText: 2023 General Motors GTO LLC
* SPDX-FileCopyrightText: 2024 General Motors GTO LLC
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef _RPC_CLIENT_H_
#define _RPC_CLIENT_H_

#include <future>
#include <up-cpp/transport/datamodel/UPayload.h>
#include <up-cpp/transport/datamodel/UAttributes.h>
#include "up-core-api/uri.pb.h"
#include "up-core-api/uattributes.pb.h"

using namespace uprotocol::utransport;
using namespace uprotocol::v1;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 General Motors GTO LLC
* Copyright (c) 2024 General Motors GTO LLC
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
Expand All @@ -19,18 +19,17 @@
* under the License.
*
* SPDX-FileType: SOURCE
* SPDX-FileCopyrightText: 2023 General Motors GTO LLC
* SPDX-FileCopyrightText: 2024 General Motors GTO LLC
* SPDX-License-Identifier: Apache-2.0
*/

#ifndef _ULISTENER_H_
#define _ULISTENER_H_

#include <up-cpp/transport/datamodel/UAttributes.h>
#include <up-core-api/ustatus.pb.h>
#include <up-core-api/uri.pb.h>
#include "UPayload.h"
#include "UAttributes.h"
#include <up-core-api/uattributes.pb.h>
#include <up-cpp/transport/datamodel/UPayload.h>

using namespace uprotocol::v1;

Expand Down
12 changes: 4 additions & 8 deletions include/up-cpp/transport/UTransport.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 General Motors GTO LLC
* Copyright (c) 2024 General Motors GTO LLC
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
Expand All @@ -19,7 +19,7 @@
* under the License.
*
* SPDX-FileType: SOURCE
* SPDX-FileCopyrightText: 2023 General Motors GTO LLC
* SPDX-FileCopyrightText: 2024 General Motors GTO LLC
* SPDX-License-Identifier: Apache-2.0
*/

Expand All @@ -28,11 +28,11 @@

#include <stdint.h>
#include <cstddef>
#include <up-cpp/transport/datamodel/UListener.h>
#include <up-cpp/transport/UListener.h>
#include <up-cpp/transport/datamodel/UPayload.h>
#include <up-cpp/transport/datamodel/UAttributes.h>
#include <up-core-api/uri.pb.h>
#include <up-core-api/ustatus.pb.h>
#include <up-core-api/uattributes.pb.h>

using namespace uprotocol::utransport;
using namespace uprotocol::v1;
Expand Down Expand Up @@ -76,10 +76,6 @@ namespace uprotocol::utransport {
*/
virtual UStatus unregisterListener(const UUri &uri,
const UListener &listner) = 0;

virtual UStatus receive(const UUri &uri,
const UPayload &payload,
const UAttributes &attributes) = 0;

virtual ~UTransport() {}
};
Expand Down
105 changes: 105 additions & 0 deletions include/up-cpp/transport/builder/UAttributesBuilder.h

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What we need is uProtocol based uAttributes builder meaning we build publish, notification, request, and response headers, otherwise you leave the complexity of building these types (and ensuring the right information is populated) up to the app developer who will more often than not miss something that is mandatory.

Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
/*
* Copyright (c) 2024 General Motors GTO LLC
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
* SPDX-FileType: SOURCE
* SPDX-FileCopyrightText: 2024 General Motors GTO LLC
* SPDX-License-Identifier: Apache-2.0
*/

#ifndef _UATTRIBUTESBUILDER_
#define _UATTRIBUTESBUILDER_

#include <string>
#include <up-core-api/uattributes.pb.h>
#include <up-core-api/uuid.pb.h>

using namespace uprotocol::v1;

namespace uprotocol::utransport {

class UAttributesBuilder {
private:
uprotocol::v1::UAttributes attributes_;

public:
UAttributesBuilder() {
attributes_.Clear();
}

UAttributesBuilder(const uprotocol::v1::UUID& id, uprotocol::v1::UMessageType type, uprotocol::v1::UPriority priority) {
attributes_.Clear();
attributes_.mutable_id()->CopyFrom(id);
attributes_.set_type(type);
attributes_.set_priority(priority);
}

UAttributesBuilder& setToken(const std::string& token) {
attributes_.set_token(token);
return *this;
}

UAttributesBuilder& setId(const uprotocol::v1::UUID& id) {
attributes_.mutable_id()->CopyFrom(id);
return *this;
}

UAttributesBuilder& setSink(const uprotocol::v1::UUri& sink) {
attributes_.mutable_sink()->CopyFrom(sink);
return *this;
}

UAttributesBuilder& setReqid(const uprotocol::v1::UUID& reqid) {
attributes_.mutable_reqid()->CopyFrom(reqid);
return *this;
}

UAttributesBuilder& setType(uprotocol::v1::UMessageType type) {
attributes_.set_type(type);
return *this;
}

UAttributesBuilder& setPriority(uprotocol::v1::UPriority priority) {
attributes_.set_priority(priority);
return *this;
}

UAttributesBuilder& setTtl(int32_t ttl) {
attributes_.set_ttl(ttl);
return *this;
}

UAttributesBuilder& setPermissionLevel(int32_t permission_level) {
attributes_.set_permission_level(permission_level);
return *this;
}

UAttributesBuilder& setCommstatus(int32_t commstatus) {
attributes_.set_commstatus(commstatus);
return *this;
}

uprotocol::v1::UAttributes build() const {
return attributes_;
}
};

} // namespace uprotocol::utransport

#endif /* _UATTRIBUTESBUILDER_*/
Loading