-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8d9344e
commit c58fc26
Showing
50 changed files
with
984 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[aliases] | ||
service:0x1234:0x5678:0x01:0x00=0x1236:0x5678:0x02:0x01 | ||
service:0x1235:0x5678:0x01:0x00=0x1236:0x5678:0x02:0x01 | ||
method:0x1234:0x5678:0x01:0x00:0x3E8=0x1236:0x5678:0x02:0x01:0x1388 | ||
method:0x1234:0x5678:0x01:0x00:0x3E9=0x1236:0x5678:0x02:0x01:0x1389 | ||
event:0x1234:0x5678:0x01:0x00:0x2B02=0x1236:0x5678:0x02:0x01:0xD6E2 | ||
eventgroup:0x1234:0x5678:0x01:0x00:0x2B02=0x1236:0x5678:0x02:0x01:0xD6E2 | ||
method:0x1235:0x5678:0x01:0x00:0xBB8=0x1236:0x5678:0x02:0x01:0x2BC | ||
method:0x1235:0x5678:0x01:0x00:0xBB9=0x1236:0x5678:0x02:0x01:0x2BD | ||
event:0x1235:0x5678:0x01:0x00:0x80F2=0x1236:0x5678:0x02:0x01:0x1E1E | ||
eventgroup:0x1235:0x5678:0x01:0x00:0x80F2=0x1236:0x5678:0x02:0x01:0x1E1E | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* Copyright (C) 2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
import "platform:/plugin/org.genivi.commonapi.someip/deployment/CommonAPI-SOMEIP_deployment_spec.fdepl" | ||
import "MergedInterfaceA.fidl" | ||
|
||
define org.genivi.commonapi.someip.deployment for interface commonapi.examples.A.MergedInterfaceA { | ||
SomeIpServiceID = 4660 | ||
|
||
attribute x1 { | ||
SomeIpGetterID = 1000 | ||
SomeIpSetterID = 1001 | ||
SomeIpNotifierID = 11010 | ||
SomeIpEventGroups = { 11010 } | ||
|
||
SomeIpGetterReliable = true | ||
SomeIpSetterReliable = true | ||
SomeIpNotifierReliable = true | ||
} | ||
|
||
attribute x2 { | ||
SomeIpGetterID = 2000 | ||
SomeIpSetterID = 2001 | ||
SomeIpNotifierID = 22010 | ||
SomeIpEventGroups = { 22010 } | ||
|
||
SomeIpGetterReliable = true | ||
SomeIpSetterReliable = true | ||
SomeIpNotifierReliable = true | ||
} | ||
} | ||
|
||
|
||
define org.genivi.commonapi.someip.deployment for provider Service { | ||
instance commonapi.examples.A.MergedInterfaceA { | ||
InstanceId = "commonapi.examples.A.MergedInterfaceA" | ||
SomeIpInstanceID = 22136 | ||
SomeIpUnicastAddress = "192.168.0.2" | ||
SomeIpReliableUnicastPort = 30499 | ||
SomeIpUnreliableUnicastPort = 30500 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* Copyright (C) 2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
package commonapi.examples.A | ||
|
||
interface MergedInterfaceA { | ||
version { major 1 minor 0 } | ||
|
||
attribute Int32 x1 | ||
attribute Int32 x2 | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* Copyright (C) 2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
import "platform:/plugin/org.genivi.commonapi.someip/deployment/CommonAPI-SOMEIP_deployment_spec.fdepl" | ||
import "MergedInterfaceB.fidl" | ||
|
||
define org.genivi.commonapi.someip.deployment for interface commonapi.examples.B.MergedInterfaceB { | ||
SomeIpServiceID = 4661 | ||
|
||
attribute x3 { | ||
SomeIpGetterID = 3000 | ||
SomeIpSetterID = 3001 | ||
SomeIpNotifierID = 33010 | ||
SomeIpEventGroups = { 33010 } | ||
|
||
SomeIpGetterReliable = true | ||
SomeIpSetterReliable = true | ||
SomeIpNotifierReliable = true | ||
} | ||
|
||
attribute x4 { | ||
SomeIpGetterID = 4000 | ||
SomeIpSetterID = 4001 | ||
SomeIpNotifierID = 44010 | ||
SomeIpEventGroups = { 44010 } | ||
|
||
SomeIpGetterReliable = true | ||
SomeIpSetterReliable = true | ||
SomeIpNotifierReliable = true | ||
} | ||
} | ||
|
||
|
||
define org.genivi.commonapi.someip.deployment for provider Service { | ||
instance commonapi.examples.B.MergedInterfaceB { | ||
InstanceId = "commonapi.examples.B.MergedInterfaceB" | ||
SomeIpInstanceID = 22136 | ||
SomeIpUnicastAddress = "192.168.0.2" | ||
SomeIpReliableUnicastPort = 30499 | ||
SomeIpUnreliableUnicastPort = 30500 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* Copyright (C) 2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
package commonapi.examples.B | ||
|
||
interface MergedInterfaceB { | ||
version { major 1 minor 0 } | ||
|
||
attribute Int32 x3 | ||
attribute Int32 x4 | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/* Copyright (C) 2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
import "platform:/plugin/org.genivi.commonapi.someip/deployment/CommonAPI-SOMEIP_deployment_spec.fdepl" | ||
import "MergedInterfaceC.fidl" | ||
|
||
define org.genivi.commonapi.someip.deployment for interface commonapi.examples.C.MergedInterfaceC { | ||
SomeIpServiceID = 4662 | ||
|
||
attribute x1 { | ||
SomeIpGetterID = 5000 | ||
SomeIpSetterID = 5001 | ||
SomeIpNotifierID = 55010 | ||
SomeIpEventGroups = { 55010 } | ||
|
||
SomeIpGetterReliable = true | ||
SomeIpSetterReliable = true | ||
SomeIpNotifierReliable = true | ||
} | ||
|
||
attribute x2 { | ||
SomeIpGetterID = 600 | ||
SomeIpSetterID = 601 | ||
SomeIpNotifierID = 6610 | ||
SomeIpEventGroups = { 6610 } | ||
|
||
SomeIpGetterReliable = true | ||
SomeIpSetterReliable = true | ||
SomeIpNotifierReliable = true | ||
} | ||
|
||
attribute x3 { | ||
SomeIpGetterID = 700 | ||
SomeIpSetterID = 701 | ||
SomeIpNotifierID = 7710 | ||
SomeIpEventGroups = { 7710 } | ||
|
||
SomeIpGetterReliable = true | ||
SomeIpSetterReliable = true | ||
SomeIpNotifierReliable = true | ||
} | ||
|
||
attribute x4 { | ||
SomeIpGetterID = 800 | ||
SomeIpSetterID = 801 | ||
SomeIpNotifierID = 8810 | ||
SomeIpEventGroups = { 8810 } | ||
|
||
SomeIpGetterReliable = true | ||
SomeIpSetterReliable = true | ||
SomeIpNotifierReliable = true | ||
} | ||
} | ||
|
||
|
||
define org.genivi.commonapi.someip.deployment for provider Service { | ||
instance commonapi.examples.C.MergedInterfaceC { | ||
InstanceId = "commonapi.examples.C.MergedInterfaceC" | ||
SomeIpInstanceID = 22136 | ||
SomeIpUnicastAddress = "192.168.0.2" | ||
SomeIpReliableUnicastPort = 30499 | ||
SomeIpUnreliableUnicastPort = 30500 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* Copyright (C) 2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
package commonapi.examples.C | ||
|
||
interface MergedInterfaceC { | ||
version { major 2 minor 1 } | ||
|
||
attribute Int32 x1 | ||
attribute Int32 x2 | ||
attribute Int32 x3 | ||
attribute Int32 x4 | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
/* Copyright (C) 2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
#include <iostream> | ||
|
||
#ifndef _WIN32 | ||
#include <unistd.h> | ||
#endif | ||
|
||
#include <CommonAPI/CommonAPI.hpp> | ||
#include <CommonAPI/Extensions/AttributeCacheExtension.hpp> | ||
#include <v1/commonapi/examples/A/MergedInterfaceAProxy.hpp> | ||
|
||
using namespace v1::commonapi::examples::A; | ||
|
||
void recv_cb(const CommonAPI::CallStatus& callStatus, const int32_t& val) { | ||
std::cout << "Receive callback: " << val << std::endl; | ||
} | ||
|
||
int main() { | ||
CommonAPI::Runtime::setProperty("LogContext", "E02CA"); | ||
CommonAPI::Runtime::setProperty("LogApplication", "E02CA"); | ||
CommonAPI::Runtime::setProperty("LibraryBase", "MergedInterface-A"); | ||
|
||
std::shared_ptr < CommonAPI::Runtime > runtime = CommonAPI::Runtime::get(); | ||
|
||
std::string domain = "local"; | ||
std::string instance = "commonapi.examples.A.MergedInterfaceA"; | ||
std::string connection = "client-sample"; | ||
|
||
auto myProxy = runtime->buildProxyWithDefaultAttributeExtension<MergedInterfaceAProxy, CommonAPI::Extensions::AttributeCacheExtension>(domain, instance, connection); | ||
|
||
std::cout << "Waiting for service to become available." << std::endl; | ||
while (!myProxy->isAvailable()) { | ||
std::this_thread::sleep_for(std::chrono::microseconds(10)); | ||
} | ||
|
||
CommonAPI::CallStatus callStatus; | ||
|
||
int32_t value = 0; | ||
|
||
CommonAPI::CallInfo info(1000); | ||
info.sender_ = 5678; | ||
|
||
// Get actual attribute value from service | ||
std::cout << "Proxy A getting attribute X1 value: " << value << std::endl; | ||
myProxy->getX1Attribute().getValue(callStatus, value, &info); | ||
if (callStatus != CommonAPI::CallStatus::SUCCESS) { | ||
std::cerr << "Remote call A failed!\n"; | ||
return -1; | ||
} | ||
std::cout << "Proxy A got attribute X1 value: " << value << std::endl; | ||
|
||
// Subscribe for receiving values | ||
myProxy->getX1Attribute().getChangedEvent().subscribe([&](const int32_t& val) { | ||
std::cout << "Proxy A received attribute X1 change message: " << val << std::endl; | ||
}); | ||
|
||
value = 100; | ||
|
||
// Asynchronous call to set attribute of service | ||
std::function<void(const CommonAPI::CallStatus&, int32_t)> fcb = recv_cb; | ||
myProxy->getX1Attribute().setValueAsync(value, fcb, &info); | ||
|
||
|
||
while (true) { | ||
int32_t errorValue = -1; | ||
int32_t valueCached = *myProxy->getX1AttributeExtension().getCachedValue(errorValue); | ||
if (valueCached != errorValue) { | ||
std::cout << "Proxy A ot cached attribute X1 value[" << (int)valueCached << "]: " << valueCached << std::endl; | ||
} else { | ||
std::cout << "Proxy A got cached attribute X1 error value[" << (int)valueCached << "]: " << valueCached << std::endl; | ||
} | ||
std::this_thread::sleep_for(std::chrono::microseconds(1000000)); | ||
} | ||
} |
Oops, something went wrong.