Ram Gandikota
/
metronome
FRDM K64F Metronome
mbed-client/test/mbedclient-smokeTest/testconfig.cpp@0:a2cb7295a1f7, 2017-05-14 (annotated)
- Committer:
- ram54288
- Date:
- Sun May 14 18:35:07 2017 +0000
- Revision:
- 0:a2cb7295a1f7
Initial commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ram54288 | 0:a2cb7295a1f7 | 1 | /* |
ram54288 | 0:a2cb7295a1f7 | 2 | * Copyright (c) 2015 ARM Limited. All rights reserved. |
ram54288 | 0:a2cb7295a1f7 | 3 | * SPDX-License-Identifier: Apache-2.0 |
ram54288 | 0:a2cb7295a1f7 | 4 | * Licensed under the Apache License, Version 2.0 (the License); you may |
ram54288 | 0:a2cb7295a1f7 | 5 | * not use this file except in compliance with the License. |
ram54288 | 0:a2cb7295a1f7 | 6 | * You may obtain a copy of the License at |
ram54288 | 0:a2cb7295a1f7 | 7 | * |
ram54288 | 0:a2cb7295a1f7 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
ram54288 | 0:a2cb7295a1f7 | 9 | * |
ram54288 | 0:a2cb7295a1f7 | 10 | * Unless required by applicable law or agreed to in writing, software |
ram54288 | 0:a2cb7295a1f7 | 11 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT |
ram54288 | 0:a2cb7295a1f7 | 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
ram54288 | 0:a2cb7295a1f7 | 13 | * See the License for the specific language governing permissions and |
ram54288 | 0:a2cb7295a1f7 | 14 | * limitations under the License. |
ram54288 | 0:a2cb7295a1f7 | 15 | */ |
ram54288 | 0:a2cb7295a1f7 | 16 | |
ram54288 | 0:a2cb7295a1f7 | 17 | #include <stdio.h> |
ram54288 | 0:a2cb7295a1f7 | 18 | #include "mbed-client/m2mstring.h" |
ram54288 | 0:a2cb7295a1f7 | 19 | #include "testconfig.h" |
ram54288 | 0:a2cb7295a1f7 | 20 | #include "security.h" |
ram54288 | 0:a2cb7295a1f7 | 21 | |
ram54288 | 0:a2cb7295a1f7 | 22 | TestConfig::TestConfig() { } |
ram54288 | 0:a2cb7295a1f7 | 23 | |
ram54288 | 0:a2cb7295a1f7 | 24 | TestConfig::~TestConfig() { } |
ram54288 | 0:a2cb7295a1f7 | 25 | |
ram54288 | 0:a2cb7295a1f7 | 26 | /*void TestConfig::set_endpoint_name(const char *name) { |
ram54288 | 0:a2cb7295a1f7 | 27 | _endpointName = m2m::String("lwm2mtest-"); |
ram54288 | 0:a2cb7295a1f7 | 28 | _endpointName += name; |
ram54288 | 0:a2cb7295a1f7 | 29 | |
ram54288 | 0:a2cb7295a1f7 | 30 | printf("MBED: endpoint=%s", _endpointName.c_str()); |
ram54288 | 0:a2cb7295a1f7 | 31 | }*/ |
ram54288 | 0:a2cb7295a1f7 | 32 | |
ram54288 | 0:a2cb7295a1f7 | 33 | void TestConfig::setup() { |
ram54288 | 0:a2cb7295a1f7 | 34 | _bootstrapAddress = m2m::String("dummy"); |
ram54288 | 0:a2cb7295a1f7 | 35 | _mdsAddress = m2m::String("coap://ds-test.dev.mbed.com:5683"); |
ram54288 | 0:a2cb7295a1f7 | 36 | _endpointName = m2m::String(MBED_ENDPOINT_NAME); |
ram54288 | 0:a2cb7295a1f7 | 37 | _endpointType = m2m::String("test2"); |
ram54288 | 0:a2cb7295a1f7 | 38 | _domain = m2m::String(MBED_DOMAIN); |
ram54288 | 0:a2cb7295a1f7 | 39 | _port = 5683; |
ram54288 | 0:a2cb7295a1f7 | 40 | _lifetime = 2222; |
ram54288 | 0:a2cb7295a1f7 | 41 | |
ram54288 | 0:a2cb7295a1f7 | 42 | printf("MBED: test configuration \n"); |
ram54288 | 0:a2cb7295a1f7 | 43 | printf("mds_server=%s\n", _mdsAddress.c_str()); |
ram54288 | 0:a2cb7295a1f7 | 44 | printf("endpoint name=%s\n", _endpointName.c_str()); |
ram54288 | 0:a2cb7295a1f7 | 45 | printf("endpoint type=%s\n", _endpointType.c_str()); |
ram54288 | 0:a2cb7295a1f7 | 46 | printf("domain=%s\n", _domain.c_str()); |
ram54288 | 0:a2cb7295a1f7 | 47 | printf("port=%d\n", _port); |
ram54288 | 0:a2cb7295a1f7 | 48 | printf("lifetime=%d\n\n", _lifetime); |
ram54288 | 0:a2cb7295a1f7 | 49 | } |
ram54288 | 0:a2cb7295a1f7 | 50 | |
ram54288 | 0:a2cb7295a1f7 | 51 | m2m::String& TestConfig::get_domain() { |
ram54288 | 0:a2cb7295a1f7 | 52 | return _domain; |
ram54288 | 0:a2cb7295a1f7 | 53 | } |
ram54288 | 0:a2cb7295a1f7 | 54 | |
ram54288 | 0:a2cb7295a1f7 | 55 | m2m::String& TestConfig::get_bootstrap_server() { |
ram54288 | 0:a2cb7295a1f7 | 56 | return _bootstrapAddress; |
ram54288 | 0:a2cb7295a1f7 | 57 | } |
ram54288 | 0:a2cb7295a1f7 | 58 | |
ram54288 | 0:a2cb7295a1f7 | 59 | m2m::String& TestConfig::get_mds_server() { |
ram54288 | 0:a2cb7295a1f7 | 60 | return _mdsAddress; |
ram54288 | 0:a2cb7295a1f7 | 61 | } |
ram54288 | 0:a2cb7295a1f7 | 62 | |
ram54288 | 0:a2cb7295a1f7 | 63 | m2m::String& TestConfig::get_endpoint_name() { |
ram54288 | 0:a2cb7295a1f7 | 64 | return _endpointName; |
ram54288 | 0:a2cb7295a1f7 | 65 | } |
ram54288 | 0:a2cb7295a1f7 | 66 | |
ram54288 | 0:a2cb7295a1f7 | 67 | m2m::String& TestConfig::get_endpoint_type() { |
ram54288 | 0:a2cb7295a1f7 | 68 | return _endpointType; |
ram54288 | 0:a2cb7295a1f7 | 69 | } |
ram54288 | 0:a2cb7295a1f7 | 70 | |
ram54288 | 0:a2cb7295a1f7 | 71 | int TestConfig::get_port() { |
ram54288 | 0:a2cb7295a1f7 | 72 | //return _port++; |
ram54288 | 0:a2cb7295a1f7 | 73 | return _port; |
ram54288 | 0:a2cb7295a1f7 | 74 | } |
ram54288 | 0:a2cb7295a1f7 | 75 | |
ram54288 | 0:a2cb7295a1f7 | 76 | int TestConfig::get_lifetime() { |
ram54288 | 0:a2cb7295a1f7 | 77 | return _lifetime; |
ram54288 | 0:a2cb7295a1f7 | 78 | } |
ram54288 | 0:a2cb7295a1f7 | 79 |