1 //******************************************************************
3 // Copyright 2014 Intel Mobile Communications GmbH All Rights Reserved.
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
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
11 // http://www.apache.org/licenses/LICENSE-2.0
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.
19 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
26 #include <sys/types.h>
29 #define TAG "sample-common"
31 const char *getResult(OCStackResult result) {
35 case OC_STACK_RESOURCE_CREATED:
36 return "OC_STACK_RESOURCE_CREATED";
37 case OC_STACK_RESOURCE_DELETED:
38 return "OC_STACK_RESOURCE_DELETED";
39 case OC_STACK_INVALID_URI:
40 return "OC_STACK_INVALID_URI";
41 case OC_STACK_INVALID_QUERY:
42 return "OC_STACK_INVALID_QUERY";
43 case OC_STACK_INVALID_IP:
44 return "OC_STACK_INVALID_IP";
45 case OC_STACK_INVALID_PORT:
46 return "OC_STACK_INVALID_PORT";
47 case OC_STACK_INVALID_CALLBACK:
48 return "OC_STACK_INVALID_CALLBACK";
49 case OC_STACK_INVALID_METHOD:
50 return "OC_STACK_INVALID_METHOD";
51 case OC_STACK_NO_MEMORY:
52 return "OC_STACK_NO_MEMORY";
53 case OC_STACK_COMM_ERROR:
54 return "OC_STACK_COMM_ERROR";
55 case OC_STACK_INVALID_PARAM:
56 return "OC_STACK_INVALID_PARAM";
57 case OC_STACK_NOTIMPL:
58 return "OC_STACK_NOTIMPL";
59 case OC_STACK_NO_RESOURCE:
60 return "OC_STACK_NO_RESOURCE";
61 case OC_STACK_RESOURCE_ERROR:
62 return "OC_STACK_RESOURCE_ERROR";
63 case OC_STACK_SLOW_RESOURCE:
64 return "OC_STACK_SLOW_RESOURCE";
65 case OC_STACK_NO_OBSERVERS:
66 return "OC_STACK_NO_OBSERVERS";
68 case OC_STACK_PRESENCE_STOPPED:
69 return "OC_STACK_PRESENCE_STOPPED";
72 return "OC_STACK_ERROR";
78 void StripNewLineChar(char* str) {