1 /* ****************************************************************
3 * Copyright 2016 Intel Corporation All Rights Reserved.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 ******************************************************************/
19 #ifndef WINUICLIENT_H_
20 #define WINUICLIENT_H_
25 #include "OCPlatform.h"
27 #include "OCResource.h"
30 namespace WinUIClient{
40 Media() : m_state(false), m_volume(0), m_name("")
48 WinUIClientApp(OCPersistentStorage ps);
54 void GetMediaRepresentation();
55 void PutMediaRepresentation();
56 void PostMediaRepresentation();
57 void BeginObserving();
58 void CancelObserving();
60 std::shared_ptr<OCResource> GetResource();
61 Media GetMedia(){return mymedia;}
62 void SetMedia(bool state, int volume){mymedia.m_state = state; mymedia.m_volume=volume;}
66 void foundResource(std::shared_ptr<OCResource> resource);
67 void onGet(const HeaderOptions& /*headerOptions*/, const OCRepresentation& rep, const int eCode);
68 void onPut(const HeaderOptions& /*headerOptions*/, const OCRepresentation& rep, const int eCode);
69 void onPost(const HeaderOptions& /*headerOptions*/, const OCRepresentation& rep, const int eCode);
70 void onPost2(const HeaderOptions& /*headerOptions*/,const OCRepresentation& rep, const int eCode);
71 void onObserve(const HeaderOptions /*headerOptions*/, const OCRepresentation& rep, const int& eCode, const int& sequenceNumber);
76 typedef std::map<OCResourceIdentifier, std::shared_ptr<OCResource>> DiscoveredResourceMap;
78 OCPersistentStorage persistentStorage;
80 DiscoveredResourceMap discoveredResources;
81 std::shared_ptr<OCResource> curResource;
82 ObserveType OBSERVE_TYPE_TO_USE;
83 std::mutex curResourceLock;