Skip to content

Commit 79b8d53

Browse files
RDKEMW-1021: COM-RPC support fot SharedStorage (#220)
* RDKEMW-1021: COM-RPC support fot SharedStorage Reason for Change: Added ISharedStorage Test Procedure: Check for regressions Risks: Low Priority: P1 * RDKEMW-1021: COM-RPC support fot SharedStorage Reason for Change: Added ISharedStorage Test Procedure: Check for regressions Risks: Low Priority: P1 * RDKEMW-1021: COM-RPC support fot SharedStorage Reason for Change: Added ISharedStorage Test Procedure: Check for regressions Risks: Low Priority: P1 * RDKEMW-1021: COM-RPC support fot SharedStorage Reason for Change: Added ISharedStorage Test Procedure: Check for regressions Risks: Low Priority: P1 * RDKEMW-1021: COM-RPC support fot SharedStorage Reason for Change: Added ISharedStorage Test Procedure: Check for regressions Risks: Low Priority: P1 * Update Ids.h * RDKEMW-1021: COM-RPC support fot SharedStorage * RDKEMW-1021: COM-RPC support fot SharedStorage * RDKEMW-1021: COM-RPC support fot SharedStorage --------- Co-authored-by: dkumar798 <[email protected]>
1 parent 17fb509 commit 79b8d53

File tree

2 files changed

+175
-1
lines changed

2 files changed

+175
-1
lines changed

apis/Ids.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,16 @@ namespace Exchange {
276276
ID_HDCPPROFILE = ID_ENTOS_OFFSET + 0x390,
277277
ID_HDCPPROFILE_NOTIFICATION = ID_HDCPPROFILE + 1,
278278

279-
ID_LEDCONTROL = ID_ENTOS_OFFSET + 0x3A0
279+
ID_LEDCONTROL = ID_ENTOS_OFFSET + 0x3A0,
280+
281+
ID_SHARED_STORAGE = ID_ENTOS_OFFSET + 0x3B0,
282+
ID_SHARED_STORAGE_NOTIFICATION = ID_SHARED_STORAGE + 1,
283+
ID_SHARED_STORAGE_INSPECTOR = ID_SHARED_STORAGE + 2,
284+
ID_SHARED_STORAGE_INSPECTOR_NAMESPACE_SIZE_ITERATOR = ID_SHARED_STORAGE + 3,
285+
ID_SHARED_STORAGE_LIMIT = ID_SHARED_STORAGE + 4,
286+
ID_SHARED_STORAGE_LIMIT_NOTIFICATION = ID_SHARED_STORAGE + 5,
287+
ID_SHARED_STORAGE_LIMIT_INSPECTOR = ID_SHARED_STORAGE + 6,
288+
ID_SHARED_STORAGE_CACHE = ID_SHARED_STORAGE + 7
280289
};
281290
}
282291
}
Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
/*
2+
* If not stated otherwise in this file or this component's LICENSE file the
3+
* following copyright and licenses apply:
4+
*
5+
* Copyright 2025 RDK Management
6+
*
7+
* Licensed under the Apache License, Version 2.0 (the "License");
8+
* you may not use this file except in compliance with the License.
9+
* You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS,
15+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
* See the License for the specific language governing permissions and
17+
* limitations under the License.
18+
*/
19+
20+
#pragma once
21+
22+
#include "Module.h"
23+
24+
// @stubgen:include <com/IIteratorType.h>
25+
26+
namespace WPEFramework {
27+
namespace Exchange {
28+
29+
/* @json @text:keep */
30+
struct EXTERNAL ISharedStorage : virtual public Core::IUnknown {
31+
enum { ID = ID_SHARED_STORAGE };
32+
33+
~ISharedStorage() override = default;
34+
35+
enum ScopeType : uint8_t {
36+
DEVICE /* @text device */,
37+
ACCOUNT /* @text account */
38+
};
39+
struct EXTERNAL Success {
40+
bool success;
41+
};
42+
43+
// @event
44+
struct EXTERNAL INotification : virtual public Core::IUnknown {
45+
enum { ID = ID_SHARED_STORAGE_NOTIFICATION };
46+
47+
~INotification() override = default;
48+
49+
// @brief Values stored are changed using setValue
50+
// @text onValueChanged
51+
// @param scope: must be device or account
52+
// @param key: key
53+
// @param value: value
54+
virtual void OnValueChanged(const ScopeType scope, const string& ns /* @text:namespace */, const string& key, const string& value) {};
55+
};
56+
57+
virtual Core::hresult Register(Exchange::ISharedStorage::INotification* notification) = 0;
58+
virtual Core::hresult Unregister(Exchange::ISharedStorage::INotification* notification) = 0;
59+
60+
// @brief Sets the value of a key in the the specified namespace
61+
// @text setValue
62+
// @param scope: must be device or account
63+
// @param ns: name space
64+
// @param key: key
65+
// @param value: value
66+
// @param ttl: time to live (optional)
67+
// @param success: success
68+
virtual Core::hresult SetValue(const ScopeType scope, const string& ns /* @text:namespace */, const string& key, const string& value, const uint32_t ttl, Success& success /* @out */) = 0;
69+
// @brief Returns the value of a key from the specified namespace.
70+
// @text getValue
71+
// @param scope: must be device or account
72+
// @param ns: name space
73+
// @param key: key
74+
// @param value: value out
75+
// @param ttl: time to live (optional)
76+
// @param success: success
77+
virtual Core::hresult GetValue(const ScopeType scope, const string& ns /* @text:namespace */, const string& key, string& value /* @out */, uint32_t& ttl /* @out */, bool& success /* @out */) = 0;
78+
// @brief Deletes a key from the specified namespace
79+
// @text deleteKey
80+
// @param scope: must be device or account
81+
// @param ns: name space
82+
// @param key: key
83+
// @param success: success
84+
virtual Core::hresult DeleteKey(const ScopeType scope, const string& ns /* @text:namespace */, const string& key, Success& success /* @out */) = 0;
85+
// @brief Deletes the specified namespace
86+
// @text deleteNamespace
87+
// @param scope: must be device or account
88+
// @param ns: name space
89+
// @param success: success
90+
virtual Core::hresult DeleteNamespace(const ScopeType scope, const string& ns /* @text:namespace */, Success& success /* @out */) = 0;
91+
};
92+
93+
/* @json @text:keep */
94+
struct EXTERNAL ISharedStorageInspector : virtual public Core::IUnknown {
95+
enum { ID = ID_SHARED_STORAGE_INSPECTOR };
96+
97+
~ISharedStorageInspector() override = default;
98+
99+
struct NamespaceSize {
100+
string ns;
101+
uint32_t size;
102+
};
103+
104+
using ScopeType = ISharedStorage::ScopeType;
105+
using IStringIterator = RPC::IIteratorType<string, RPC::ID_STRINGITERATOR>;
106+
using INamespaceSizeIterator = RPC::IIteratorType<NamespaceSize, ID_SHARED_STORAGE_INSPECTOR_NAMESPACE_SIZE_ITERATOR>;
107+
108+
// @brief Returns the keys that are stored in the specified namespace
109+
// @text getKeys
110+
// @param scope: must be device or account
111+
// @param ns: name space
112+
// @param keys: keys list
113+
// @param success: success
114+
virtual Core::hresult GetKeys(const ScopeType scope, const string& ns /* @text:namespace */, IStringIterator*& keys /* @out */, bool& success /* @out */) = 0;
115+
// @brief Returns the namespaces
116+
// @text getNamespaces
117+
// @param scope: must be device or account
118+
// @param namespaces: namespaces list
119+
// @param success: success
120+
virtual Core::hresult GetNamespaces(const ScopeType scope, IStringIterator*& namespaces /* @out */, bool& success /* @out */) = 0;
121+
// @brief Returns the size occupied by each namespace
122+
// @text getStorageSizes
123+
// @param scope: must be device or account
124+
// @param storageList: list of namespaces and their sizes
125+
// @param success: success
126+
virtual Core::hresult GetStorageSizes(const ScopeType scope, INamespaceSizeIterator*& storageList /* @out */, bool& success /* @out */) = 0;
127+
};
128+
129+
/* @json @text:keep */
130+
struct EXTERNAL ISharedStorageLimit : virtual public Core::IUnknown {
131+
enum { ID = ID_SHARED_STORAGE_LIMIT };
132+
133+
~ISharedStorageLimit() override = default;
134+
135+
using ScopeType = ISharedStorage::ScopeType;
136+
struct StorageLimit {
137+
uint32_t storageLimit;
138+
};
139+
140+
// @brief Sets the storage limit for a given namespace
141+
// @text setNamespaceStorageLimit
142+
// @param scope: must be device or account
143+
// @param ns: name space
144+
// @param storageLimit: size
145+
// @param success: success
146+
virtual Core::hresult SetNamespaceStorageLimit(const ScopeType scope, const string& ns /* @text:namespace */, const uint32_t storageLimit, bool& success /* @out */) = 0;
147+
// @brief Returns the storage limit for a given namespace
148+
// @text getNamespaceStorageLimit
149+
// @param scope: must be device or account
150+
// @param ns: name space
151+
// @param storageLimit: Size in bytes
152+
virtual Core::hresult GetNamespaceStorageLimit(const ScopeType scope, const string& ns /* @text:namespace */, StorageLimit& storageLimit /* @out */) = 0;
153+
};
154+
155+
/* @json @text:keep */
156+
struct EXTERNAL ISharedStorageCache : virtual public Core::IUnknown {
157+
enum { ID = ID_SHARED_STORAGE_CACHE };
158+
159+
// @brief Flushes the device cache
160+
// @text flushCache
161+
virtual Core::hresult FlushCache() = 0;
162+
};
163+
164+
} // namespace Exchange
165+
} // namespace WPEFramework

0 commit comments

Comments
 (0)