This is the sample program that can see the decode result of barcode data on Watson IoT.

Dependencies:   AsciiFont DisplayApp GR-PEACH_video LCD_shield_config LWIPBP3595Interface_STA_for_mbed-os USBDevice

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ObjectInstanceManager.h Source File

ObjectInstanceManager.h

Go to the documentation of this file.
00001 /**
00002  * @file    ObjectInstanceManager.h
00003  * @brief   mbed CoAP Endpoint Device Management Object Instance Manager (header)
00004  * @author  Doug Anson
00005  * @version 1.0
00006  * @see
00007  *
00008  * Copyright (c) 2016
00009  *
00010  * Licensed under the Apache License, Version 2.0 (the "License");
00011  * you may not use this file except in compliance with the License.
00012  * You may obtain a copy of the License at
00013  *
00014  *     http://www.apache.org/licenses/LICENSE-2.0
00015  *
00016  * Unless required by applicable law or agreed to in writing, software
00017  * distributed under the License is distributed on an "AS IS" BASIS,
00018  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00019  * See the License for the specific language governing permissions and
00020  * limitations under the License.
00021  */
00022 
00023 #ifndef __OBJECT_INSTANCE_MANAGER_H__
00024 #define __OBJECT_INSTANCE_MANAGER_H__
00025 
00026 // Logger
00027 #include "mbed-connector-interface/Logger.h"
00028 
00029 // Named Pointer List 
00030 #include "mbed-connector-interface/NamedPointer.h"
00031 
00032 // Resources list
00033 #include <vector>
00034 typedef vector<NamedPointer> NamedPointerList;
00035 
00036 class ObjectInstanceManager {
00037     public:
00038         /**
00039         Default constructor
00040         @param logger input logger instance
00041         @param ep input the Endpoint instance
00042         */
00043         ObjectInstanceManager(const Logger *logger,const void *ep);
00044         
00045         /**
00046         Copy constructor
00047         @param resource input the ObjectInstanceManager that is to be deep copied
00048         */
00049         ObjectInstanceManager(const ObjectInstanceManager &manager);
00050     
00051         /**
00052         Destructor
00053         */
00054         virtual ~ObjectInstanceManager();
00055         
00056         /**
00057         Create DynamicResourceInstance
00058         @param objID input the Object ID to parent this new resource instance under 
00059         @param resID input the Resource ID for this resource
00060         @param resName input the Resource Name 
00061         @param resType input the type of Resource (cast from Resource::ResourceType)
00062         @param observable input whether this Resource is observable or not
00063         */
00064         void *createDynamicResourceInstance(char *objID,char *resID,char *resName,int resType,bool observable);
00065         
00066         /**
00067         Create StaticResourceInstance
00068         @param objID input the Object ID to parent this new resource instance under 
00069         @param resID input the Resource ID for this resource
00070         @param resName input the Resource Name 
00071         @param resType input the type of Resource (cast from Resource::ResourceType)
00072         @param observable input whether this Resource is observable or not
00073         */
00074         void *createStaticResourceInstance(char *objID,char *resID,char *resName,int resType,void *data,int data_length);
00075         
00076         /**
00077         Get our Object List
00078         */
00079         NamedPointerList getObjectList();
00080         
00081         /** 
00082         Get the instance number of the just-created ResourceInstance
00083         */
00084         int getLastCreatedInstanceNumber();
00085     
00086     protected:
00087         Logger          *m_logger;
00088         void            *m_ep;
00089         NamedPointerList m_object_list;
00090         int              m_instance_number;
00091         
00092     private:
00093         // Generic Static and Dynamic Resource Instances/Objects
00094         void *getOrCreateInstance(char *objID,char *resID);
00095         NamedPointer *getOrCreateObject(char *objID);
00096                 
00097         // Underlying lookup support
00098         NamedPointer *getNamedPointer(const char *id,NamedPointerList *list);
00099         
00100         // Logger
00101         Logger *logger();
00102 };
00103 
00104 #endif // __OBJECT_INSTANCE_MANAGER_H__