The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1 | /* |
| 2 | ** |
| 3 | ** Copyright 2008, The Android Open Source Project |
| 4 | ** |
Wu-cheng Li | 8de57d8 | 2009-09-23 14:37:52 -0700 | [diff] [blame] | 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 |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 8 | ** |
Wu-cheng Li | 8de57d8 | 2009-09-23 14:37:52 -0700 | [diff] [blame] | 9 | ** http://www.apache.org/licenses/LICENSE-2.0 |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 10 | ** |
Wu-cheng Li | 8de57d8 | 2009-09-23 14:37:52 -0700 | [diff] [blame] | 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 |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 15 | ** limitations under the License. |
| 16 | */ |
| 17 | |
| 18 | #define LOG_TAG "CameraParams" |
| 19 | #include <utils/Log.h> |
| 20 | |
| 21 | #include <string.h> |
| 22 | #include <stdlib.h> |
Mathias Agopian | 000479f | 2010-02-09 17:46:37 -0800 | [diff] [blame] | 23 | #include <camera/CameraParameters.h> |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 24 | |
| 25 | namespace android { |
Wu-cheng Li | 8de57d8 | 2009-09-23 14:37:52 -0700 | [diff] [blame] | 26 | // Parameter keys to communicate between camera application and driver. |
| 27 | const char CameraParameters::KEY_PREVIEW_SIZE[] = "preview-size"; |
| 28 | const char CameraParameters::KEY_SUPPORTED_PREVIEW_SIZES[] = "preview-size-values"; |
| 29 | const char CameraParameters::KEY_PREVIEW_FORMAT[] = "preview-format"; |
| 30 | const char CameraParameters::KEY_SUPPORTED_PREVIEW_FORMATS[] = "preview-format-values"; |
| 31 | const char CameraParameters::KEY_PREVIEW_FRAME_RATE[] = "preview-frame-rate"; |
| 32 | const char CameraParameters::KEY_SUPPORTED_PREVIEW_FRAME_RATES[] = "preview-frame-rate-values"; |
| 33 | const char CameraParameters::KEY_PICTURE_SIZE[] = "picture-size"; |
| 34 | const char CameraParameters::KEY_SUPPORTED_PICTURE_SIZES[] = "picture-size-values"; |
| 35 | const char CameraParameters::KEY_PICTURE_FORMAT[] = "picture-format"; |
| 36 | const char CameraParameters::KEY_SUPPORTED_PICTURE_FORMATS[] = "picture-format-values"; |
| 37 | const char CameraParameters::KEY_JPEG_THUMBNAIL_WIDTH[] = "jpeg-thumbnail-width"; |
| 38 | const char CameraParameters::KEY_JPEG_THUMBNAIL_HEIGHT[] = "jpeg-thumbnail-height"; |
Wu-cheng Li | acf7703 | 2010-01-25 15:18:18 +0800 | [diff] [blame] | 39 | const char CameraParameters::KEY_SUPPORTED_JPEG_THUMBNAIL_SIZES[] = "jpeg-thumbnail-size-values"; |
Wu-cheng Li | 8de57d8 | 2009-09-23 14:37:52 -0700 | [diff] [blame] | 40 | const char CameraParameters::KEY_JPEG_THUMBNAIL_QUALITY[] = "jpeg-thumbnail-quality"; |
| 41 | const char CameraParameters::KEY_JPEG_QUALITY[] = "jpeg-quality"; |
| 42 | const char CameraParameters::KEY_ROTATION[] = "rotation"; |
| 43 | const char CameraParameters::KEY_GPS_LATITUDE[] = "gps-latitude"; |
| 44 | const char CameraParameters::KEY_GPS_LONGITUDE[] = "gps-longitude"; |
| 45 | const char CameraParameters::KEY_GPS_ALTITUDE[] = "gps-altitude"; |
| 46 | const char CameraParameters::KEY_GPS_TIMESTAMP[] = "gps-timestamp"; |
| 47 | const char CameraParameters::KEY_WHITE_BALANCE[] = "whitebalance"; |
| 48 | const char CameraParameters::KEY_SUPPORTED_WHITE_BALANCE[] = "whitebalance-values"; |
| 49 | const char CameraParameters::KEY_EFFECT[] = "effect"; |
| 50 | const char CameraParameters::KEY_SUPPORTED_EFFECTS[] = "effect-values"; |
| 51 | const char CameraParameters::KEY_ANTIBANDING[] = "antibanding"; |
| 52 | const char CameraParameters::KEY_SUPPORTED_ANTIBANDING[] = "antibanding-values"; |
| 53 | const char CameraParameters::KEY_SCENE_MODE[] = "scene-mode"; |
| 54 | const char CameraParameters::KEY_SUPPORTED_SCENE_MODES[] = "scene-mode-values"; |
| 55 | const char CameraParameters::KEY_FLASH_MODE[] = "flash-mode"; |
| 56 | const char CameraParameters::KEY_SUPPORTED_FLASH_MODES[] = "flash-mode-values"; |
| 57 | const char CameraParameters::KEY_FOCUS_MODE[] = "focus-mode"; |
| 58 | const char CameraParameters::KEY_SUPPORTED_FOCUS_MODES[] = "focus-mode-values"; |
Wu-cheng Li | 6c8d276 | 2010-01-27 22:55:14 +0800 | [diff] [blame] | 59 | const char CameraParameters::KEY_FOCAL_LENGTH[] = "focal-length"; |
| 60 | const char CameraParameters::KEY_HORIZONTAL_VIEW_ANGLE[] = "horizontal-view-angle"; |
| 61 | const char CameraParameters::KEY_VERTICAL_VIEW_ANGLE[] = "vertical-view-angle"; |
Wu-cheng Li | ff723b6 | 2010-02-09 13:38:19 +0800 | [diff] [blame] | 62 | const char CameraParameters::KEY_EXPOSURE_COMPENSATION[] = "exposure-compensation"; |
Wu-cheng Li | 24b326a | 2010-02-20 17:47:04 +0800 | [diff] [blame] | 63 | const char CameraParameters::KEY_MAX_EXPOSURE_COMPENSATION[] = "max-exposure-compensation"; |
| 64 | const char CameraParameters::KEY_MIN_EXPOSURE_COMPENSATION[] = "min-exposure-compensation"; |
| 65 | const char CameraParameters::KEY_EXPOSURE_COMPENSATION_STEP[] = "exposure-compensation-step"; |
Wu-cheng Li | 8cbb8f5 | 2010-02-28 23:19:55 -0800 | [diff] [blame^] | 66 | const char CameraParameters::KEY_ZOOM[] = "zoom"; |
| 67 | const char CameraParameters::KEY_MAX_ZOOM[] = "max-zoom"; |
| 68 | const char CameraParameters::KEY_ZOOM_RATIOS[] = "zoom-ratios"; |
| 69 | const char CameraParameters::KEY_ZOOM_SUPPORTED[] = "zoom-supported"; |
| 70 | const char CameraParameters::KEY_SMOOTH_ZOOM_SUPPORTED[] = "smooth-zoom-supported"; |
Wu-cheng Li | 8de57d8 | 2009-09-23 14:37:52 -0700 | [diff] [blame] | 71 | |
| 72 | // Values for white balance settings. |
| 73 | const char CameraParameters::WHITE_BALANCE_AUTO[] = "auto"; |
| 74 | const char CameraParameters::WHITE_BALANCE_INCANDESCENT[] = "incandescent"; |
| 75 | const char CameraParameters::WHITE_BALANCE_FLUORESCENT[] = "fluorescent"; |
| 76 | const char CameraParameters::WHITE_BALANCE_WARM_FLUORESCENT[] = "warm-fluorescent"; |
| 77 | const char CameraParameters::WHITE_BALANCE_DAYLIGHT[] = "daylight"; |
| 78 | const char CameraParameters::WHITE_BALANCE_CLOUDY_DAYLIGHT[] = "cloudy-daylight"; |
| 79 | const char CameraParameters::WHITE_BALANCE_TWILIGHT[] = "twilight"; |
| 80 | const char CameraParameters::WHITE_BALANCE_SHADE[] = "shade"; |
| 81 | |
| 82 | // Values for effect settings. |
| 83 | const char CameraParameters::EFFECT_NONE[] = "none"; |
| 84 | const char CameraParameters::EFFECT_MONO[] = "mono"; |
| 85 | const char CameraParameters::EFFECT_NEGATIVE[] = "negative"; |
| 86 | const char CameraParameters::EFFECT_SOLARIZE[] = "solarize"; |
| 87 | const char CameraParameters::EFFECT_SEPIA[] = "sepia"; |
| 88 | const char CameraParameters::EFFECT_POSTERIZE[] = "posterize"; |
| 89 | const char CameraParameters::EFFECT_WHITEBOARD[] = "whiteboard"; |
| 90 | const char CameraParameters::EFFECT_BLACKBOARD[] = "blackboard"; |
| 91 | const char CameraParameters::EFFECT_AQUA[] = "aqua"; |
| 92 | |
| 93 | // Values for antibanding settings. |
| 94 | const char CameraParameters::ANTIBANDING_AUTO[] = "auto"; |
| 95 | const char CameraParameters::ANTIBANDING_50HZ[] = "50hz"; |
| 96 | const char CameraParameters::ANTIBANDING_60HZ[] = "60hz"; |
| 97 | const char CameraParameters::ANTIBANDING_OFF[] = "off"; |
| 98 | |
| 99 | // Values for flash mode settings. |
| 100 | const char CameraParameters::FLASH_MODE_OFF[] = "off"; |
| 101 | const char CameraParameters::FLASH_MODE_AUTO[] = "auto"; |
| 102 | const char CameraParameters::FLASH_MODE_ON[] = "on"; |
| 103 | const char CameraParameters::FLASH_MODE_RED_EYE[] = "red-eye"; |
Wu-cheng Li | fe1a86d | 2009-09-28 13:51:12 -0700 | [diff] [blame] | 104 | const char CameraParameters::FLASH_MODE_TORCH[] = "torch"; |
Wu-cheng Li | 8de57d8 | 2009-09-23 14:37:52 -0700 | [diff] [blame] | 105 | |
| 106 | // Values for scene mode settings. |
| 107 | const char CameraParameters::SCENE_MODE_AUTO[] = "auto"; |
| 108 | const char CameraParameters::SCENE_MODE_ACTION[] = "action"; |
| 109 | const char CameraParameters::SCENE_MODE_PORTRAIT[] = "portrait"; |
| 110 | const char CameraParameters::SCENE_MODE_LANDSCAPE[] = "landscape"; |
| 111 | const char CameraParameters::SCENE_MODE_NIGHT[] = "night"; |
| 112 | const char CameraParameters::SCENE_MODE_NIGHT_PORTRAIT[] = "night-portrait"; |
| 113 | const char CameraParameters::SCENE_MODE_THEATRE[] = "theatre"; |
| 114 | const char CameraParameters::SCENE_MODE_BEACH[] = "beach"; |
| 115 | const char CameraParameters::SCENE_MODE_SNOW[] = "snow"; |
| 116 | const char CameraParameters::SCENE_MODE_SUNSET[] = "sunset"; |
| 117 | const char CameraParameters::SCENE_MODE_STEADYPHOTO[] = "steadyphoto"; |
| 118 | const char CameraParameters::SCENE_MODE_FIREWORKS[] = "fireworks"; |
| 119 | const char CameraParameters::SCENE_MODE_SPORTS[] = "sports"; |
| 120 | const char CameraParameters::SCENE_MODE_PARTY[] = "party"; |
| 121 | const char CameraParameters::SCENE_MODE_CANDLELIGHT[] = "candlelight"; |
| 122 | |
| 123 | // Formats for setPreviewFormat and setPictureFormat. |
| 124 | const char CameraParameters::PIXEL_FORMAT_YUV422SP[] = "yuv422sp"; |
| 125 | const char CameraParameters::PIXEL_FORMAT_YUV420SP[] = "yuv420sp"; |
| 126 | const char CameraParameters::PIXEL_FORMAT_YUV422I[] = "yuv422i-yuyv"; |
| 127 | const char CameraParameters::PIXEL_FORMAT_RGB565[] = "rgb565"; |
| 128 | const char CameraParameters::PIXEL_FORMAT_JPEG[] = "jpeg"; |
| 129 | |
| 130 | // Values for focus mode settings. |
| 131 | const char CameraParameters::FOCUS_MODE_AUTO[] = "auto"; |
| 132 | const char CameraParameters::FOCUS_MODE_INFINITY[] = "infinity"; |
| 133 | const char CameraParameters::FOCUS_MODE_MACRO[] = "macro"; |
| 134 | const char CameraParameters::FOCUS_MODE_FIXED[] = "fixed"; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 135 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 136 | CameraParameters::CameraParameters() |
| 137 | : mMap() |
| 138 | { |
| 139 | } |
| 140 | |
| 141 | CameraParameters::~CameraParameters() |
| 142 | { |
| 143 | } |
| 144 | |
| 145 | String8 CameraParameters::flatten() const |
| 146 | { |
| 147 | String8 flattened(""); |
| 148 | size_t size = mMap.size(); |
| 149 | |
| 150 | for (size_t i = 0; i < size; i++) { |
| 151 | String8 k, v; |
| 152 | k = mMap.keyAt(i); |
| 153 | v = mMap.valueAt(i); |
| 154 | |
| 155 | flattened += k; |
| 156 | flattened += "="; |
| 157 | flattened += v; |
| 158 | if (i != size-1) |
| 159 | flattened += ";"; |
| 160 | } |
| 161 | |
| 162 | return flattened; |
| 163 | } |
| 164 | |
| 165 | void CameraParameters::unflatten(const String8 ¶ms) |
| 166 | { |
| 167 | const char *a = params.string(); |
| 168 | const char *b; |
| 169 | |
| 170 | mMap.clear(); |
| 171 | |
| 172 | for (;;) { |
| 173 | // Find the bounds of the key name. |
| 174 | b = strchr(a, '='); |
| 175 | if (b == 0) |
| 176 | break; |
| 177 | |
| 178 | // Create the key string. |
| 179 | String8 k(a, (size_t)(b-a)); |
| 180 | |
| 181 | // Find the value. |
| 182 | a = b+1; |
| 183 | b = strchr(a, ';'); |
| 184 | if (b == 0) { |
| 185 | // If there's no semicolon, this is the last item. |
| 186 | String8 v(a); |
| 187 | mMap.add(k, v); |
| 188 | break; |
| 189 | } |
| 190 | |
| 191 | String8 v(a, (size_t)(b-a)); |
| 192 | mMap.add(k, v); |
| 193 | a = b+1; |
| 194 | } |
| 195 | } |
| 196 | |
| 197 | |
| 198 | void CameraParameters::set(const char *key, const char *value) |
| 199 | { |
Wu-cheng Li | 8de57d8 | 2009-09-23 14:37:52 -0700 | [diff] [blame] | 200 | // XXX i think i can do this with strspn() |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 201 | if (strchr(key, '=') || strchr(key, ';')) { |
| 202 | //XXX LOGE("Key \"%s\"contains invalid character (= or ;)", key); |
| 203 | return; |
| 204 | } |
| 205 | |
| 206 | if (strchr(value, '=') || strchr(key, ';')) { |
| 207 | //XXX LOGE("Value \"%s\"contains invalid character (= or ;)", value); |
| 208 | return; |
| 209 | } |
| 210 | |
| 211 | mMap.replaceValueFor(String8(key), String8(value)); |
| 212 | } |
| 213 | |
| 214 | void CameraParameters::set(const char *key, int value) |
| 215 | { |
| 216 | char str[16]; |
| 217 | sprintf(str, "%d", value); |
| 218 | set(key, str); |
| 219 | } |
| 220 | |
Wu-cheng Li | 7eae31c | 2010-01-31 14:19:38 +0800 | [diff] [blame] | 221 | void CameraParameters::setFloat(const char *key, float value) |
| 222 | { |
| 223 | char str[16]; // 14 should be enough. We overestimate to be safe. |
| 224 | snprintf(str, sizeof(str), "%g", value); |
| 225 | set(key, str); |
| 226 | } |
| 227 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 228 | const char *CameraParameters::get(const char *key) const |
| 229 | { |
| 230 | String8 v = mMap.valueFor(String8(key)); |
| 231 | if (v.length() == 0) |
| 232 | return 0; |
| 233 | return v.string(); |
| 234 | } |
| 235 | |
| 236 | int CameraParameters::getInt(const char *key) const |
| 237 | { |
| 238 | const char *v = get(key); |
| 239 | if (v == 0) |
| 240 | return -1; |
| 241 | return strtol(v, 0, 0); |
| 242 | } |
| 243 | |
Wu-cheng Li | 7eae31c | 2010-01-31 14:19:38 +0800 | [diff] [blame] | 244 | float CameraParameters::getFloat(const char *key) const |
| 245 | { |
| 246 | const char *v = get(key); |
| 247 | if (v == 0) return -1; |
| 248 | return strtof(v, 0); |
| 249 | } |
| 250 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 251 | static int parse_size(const char *str, int &width, int &height) |
| 252 | { |
| 253 | // Find the width. |
| 254 | char *end; |
| 255 | int w = (int)strtol(str, &end, 10); |
| 256 | // If an 'x' does not immediately follow, give up. |
| 257 | if (*end != 'x') |
| 258 | return -1; |
| 259 | |
| 260 | // Find the height, immediately after the 'x'. |
| 261 | int h = (int)strtol(end+1, 0, 10); |
| 262 | |
| 263 | width = w; |
| 264 | height = h; |
| 265 | |
| 266 | return 0; |
| 267 | } |
| 268 | |
| 269 | void CameraParameters::setPreviewSize(int width, int height) |
| 270 | { |
| 271 | char str[32]; |
| 272 | sprintf(str, "%dx%d", width, height); |
Wu-cheng Li | 8de57d8 | 2009-09-23 14:37:52 -0700 | [diff] [blame] | 273 | set(KEY_PREVIEW_SIZE, str); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 274 | } |
| 275 | |
| 276 | void CameraParameters::getPreviewSize(int *width, int *height) const |
| 277 | { |
| 278 | *width = -1; |
| 279 | *height = -1; |
| 280 | |
| 281 | // Get the current string, if it doesn't exist, leave the -1x-1 |
Wu-cheng Li | 8de57d8 | 2009-09-23 14:37:52 -0700 | [diff] [blame] | 282 | const char *p = get(KEY_PREVIEW_SIZE); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 283 | if (p == 0) |
| 284 | return; |
| 285 | |
| 286 | int w, h; |
| 287 | if (parse_size(p, w, h) == 0) { |
| 288 | *width = w; |
| 289 | *height = h; |
| 290 | } |
| 291 | } |
| 292 | |
| 293 | void CameraParameters::setPreviewFrameRate(int fps) |
| 294 | { |
Wu-cheng Li | 8de57d8 | 2009-09-23 14:37:52 -0700 | [diff] [blame] | 295 | set(KEY_PREVIEW_FRAME_RATE, fps); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 296 | } |
| 297 | |
| 298 | int CameraParameters::getPreviewFrameRate() const |
| 299 | { |
Wu-cheng Li | 8de57d8 | 2009-09-23 14:37:52 -0700 | [diff] [blame] | 300 | return getInt(KEY_PREVIEW_FRAME_RATE); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 301 | } |
| 302 | |
| 303 | void CameraParameters::setPreviewFormat(const char *format) |
| 304 | { |
Wu-cheng Li | 8de57d8 | 2009-09-23 14:37:52 -0700 | [diff] [blame] | 305 | set(KEY_PREVIEW_FORMAT, format); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 306 | } |
| 307 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 308 | const char *CameraParameters::getPreviewFormat() const |
| 309 | { |
Wu-cheng Li | 8de57d8 | 2009-09-23 14:37:52 -0700 | [diff] [blame] | 310 | return get(KEY_PREVIEW_FORMAT); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 311 | } |
| 312 | |
| 313 | void CameraParameters::setPictureSize(int width, int height) |
| 314 | { |
| 315 | char str[32]; |
| 316 | sprintf(str, "%dx%d", width, height); |
Wu-cheng Li | 8de57d8 | 2009-09-23 14:37:52 -0700 | [diff] [blame] | 317 | set(KEY_PICTURE_SIZE, str); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 318 | } |
| 319 | |
| 320 | void CameraParameters::getPictureSize(int *width, int *height) const |
| 321 | { |
| 322 | *width = -1; |
| 323 | *height = -1; |
| 324 | |
| 325 | // Get the current string, if it doesn't exist, leave the -1x-1 |
Wu-cheng Li | 8de57d8 | 2009-09-23 14:37:52 -0700 | [diff] [blame] | 326 | const char *p = get(KEY_PICTURE_SIZE); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 327 | if (p == 0) |
| 328 | return; |
| 329 | |
| 330 | int w, h; |
| 331 | if (parse_size(p, w, h) == 0) { |
| 332 | *width = w; |
| 333 | *height = h; |
| 334 | } |
| 335 | } |
| 336 | |
| 337 | void CameraParameters::setPictureFormat(const char *format) |
| 338 | { |
Wu-cheng Li | 8de57d8 | 2009-09-23 14:37:52 -0700 | [diff] [blame] | 339 | set(KEY_PICTURE_FORMAT, format); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 340 | } |
| 341 | |
| 342 | const char *CameraParameters::getPictureFormat() const |
| 343 | { |
Wu-cheng Li | 8de57d8 | 2009-09-23 14:37:52 -0700 | [diff] [blame] | 344 | return get(KEY_PICTURE_FORMAT); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 345 | } |
| 346 | |
| 347 | void CameraParameters::dump() const |
| 348 | { |
| 349 | LOGD("dump: mMap.size = %d", mMap.size()); |
| 350 | for (size_t i = 0; i < mMap.size(); i++) { |
| 351 | String8 k, v; |
| 352 | k = mMap.keyAt(i); |
| 353 | v = mMap.valueAt(i); |
| 354 | LOGD("%s: %s\n", k.string(), v.string()); |
| 355 | } |
| 356 | } |
| 357 | |
| 358 | status_t CameraParameters::dump(int fd, const Vector<String16>& args) const |
| 359 | { |
| 360 | const size_t SIZE = 256; |
| 361 | char buffer[SIZE]; |
| 362 | String8 result; |
| 363 | snprintf(buffer, 255, "CameraParameters::dump: mMap.size = %d\n", mMap.size()); |
| 364 | result.append(buffer); |
| 365 | for (size_t i = 0; i < mMap.size(); i++) { |
| 366 | String8 k, v; |
| 367 | k = mMap.keyAt(i); |
| 368 | v = mMap.valueAt(i); |
| 369 | snprintf(buffer, 255, "\t%s: %s\n", k.string(), v.string()); |
| 370 | result.append(buffer); |
| 371 | } |
| 372 | write(fd, result.string(), result.size()); |
| 373 | return NO_ERROR; |
| 374 | } |
| 375 | |
| 376 | }; // namespace android |