diff options
Diffstat (limited to 'Software/.jxbrowser-data/Cache/f_000003')
| -rw-r--r-- | Software/.jxbrowser-data/Cache/f_000003 | 1224 |
1 files changed, 1131 insertions, 93 deletions
diff --git a/Software/.jxbrowser-data/Cache/f_000003 b/Software/.jxbrowser-data/Cache/f_000003 index 03809ee51..3c991af21 100644 --- a/Software/.jxbrowser-data/Cache/f_000003 +++ b/Software/.jxbrowser-data/Cache/f_000003 @@ -1,94 +1,1132 @@ -<!-- -Copyright (c) 2014 The Polymer Project Authors. All rights reserved. -This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt -The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt -The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt -Code distributed by Google as part of the polymer project is also -subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt ---> +/* + * ======== rovapi.js ======== + * Browser-side ROVServer API + */ -<link rel="import" href="../iron-icon/iron-icon.html"> -<link rel="import" href="../iron-iconset-svg/iron-iconset-svg.html"> -<iron-iconset-svg name="device" size="24"> -<svg><defs> -<g id="access-alarm"><path d="M22 5.72l-4.6-3.86-1.29 1.53 4.6 3.86L22 5.72zM7.88 3.39L6.6 1.86 2 5.71l1.29 1.53 4.59-3.85zM12.5 8H11v6l4.75 2.85.75-1.23-4-2.37V8zM12 4c-4.97 0-9 4.03-9 9s4.02 9 9 9c4.97 0 9-4.03 9-9s-4.03-9-9-9zm0 16c-3.87 0-7-3.13-7-7s3.13-7 7-7 7 3.13 7 7-3.13 7-7 7z"/></g> -<g id="access-alarms"><path d="M22 5.7l-4.6-3.9-1.3 1.5 4.6 3.9L22 5.7zM7.9 3.4L6.6 1.9 2 5.7l1.3 1.5 4.6-3.8zM12.5 8H11v6l4.7 2.9.8-1.2-4-2.4V8zM12 4c-5 0-9 4-9 9s4 9 9 9 9-4 9-9-4-9-9-9zm0 16c-3.9 0-7-3.1-7-7s3.1-7 7-7 7 3.1 7 7-3.1 7-7 7z"/></g> -<g id="access-time"><path d="M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8zm.5-13H11v6l5.25 3.15.75-1.23-4.5-2.67z"/></g> -<g id="add-alarm"><path d="M7.88 3.39L6.6 1.86 2 5.71l1.29 1.53 4.59-3.85zM22 5.72l-4.6-3.86-1.29 1.53 4.6 3.86L22 5.72zM12 4c-4.97 0-9 4.03-9 9s4.02 9 9 9c4.97 0 9-4.03 9-9s-4.03-9-9-9zm0 16c-3.87 0-7-3.13-7-7s3.13-7 7-7 7 3.13 7 7-3.13 7-7 7zm1-11h-2v3H8v2h3v3h2v-3h3v-2h-3V9z"/></g> -<g id="airplanemode-active"><path d="M10.18 9"/><path d="M21 16v-2l-8-5V3.5c0-.83-.67-1.5-1.5-1.5S10 2.67 10 3.5V9l-8 5v2l8-2.5V19l-2 1.5V22l3.5-1 3.5 1v-1.5L13 19v-5.5l8 2.5z"/></g> -<g id="airplanemode-inactive"><path d="M13 9V3.5c0-.83-.67-1.5-1.5-1.5S10 2.67 10 3.5v3.68l7.83 7.83L21 16v-2l-8-5zM3 5.27l4.99 4.99L2 14v2l8-2.5V19l-2 1.5V22l3.5-1 3.5 1v-1.5L13 19v-3.73L18.73 21 20 19.73 4.27 4 3 5.27z"/></g> -<g id="battery-20"><path d="M7 17v3.67C7 21.4 7.6 22 8.33 22h7.33c.74 0 1.34-.6 1.34-1.33V17H7z"/><path fill-opacity=".3" d="M17 5.33C17 4.6 16.4 4 15.67 4H14V2h-4v2H8.33C7.6 4 7 4.6 7 5.33V17h10V5.33z"/></g> -<g id="battery-30"><path fill-opacity=".3" d="M17 5.33C17 4.6 16.4 4 15.67 4H14V2h-4v2H8.33C7.6 4 7 4.6 7 5.33V15h10V5.33z"/><path d="M7 15v5.67C7 21.4 7.6 22 8.33 22h7.33c.74 0 1.34-.6 1.34-1.33V15H7z"/></g> -<g id="battery-50"><path fill-opacity=".3" d="M17 5.33C17 4.6 16.4 4 15.67 4H14V2h-4v2H8.33C7.6 4 7 4.6 7 5.33V13h10V5.33z"/><path d="M7 13v7.67C7 21.4 7.6 22 8.33 22h7.33c.74 0 1.34-.6 1.34-1.33V13H7z"/></g> -<g id="battery-60"><path fill-opacity=".3" d="M17 5.33C17 4.6 16.4 4 15.67 4H14V2h-4v2H8.33C7.6 4 7 4.6 7 5.33V11h10V5.33z"/><path d="M7 11v9.67C7 21.4 7.6 22 8.33 22h7.33c.74 0 1.34-.6 1.34-1.33V11H7z"/></g> -<g id="battery-80"><path fill-opacity=".3" d="M17 5.33C17 4.6 16.4 4 15.67 4H14V2h-4v2H8.33C7.6 4 7 4.6 7 5.33V9h10V5.33z"/><path d="M7 9v11.67C7 21.4 7.6 22 8.33 22h7.33c.74 0 1.34-.6 1.34-1.33V9H7z"/></g> -<g id="battery-90"><path fill-opacity=".3" d="M17 5.33C17 4.6 16.4 4 15.67 4H14V2h-4v2H8.33C7.6 4 7 4.6 7 5.33V8h10V5.33z"/><path d="M7 8v12.67C7 21.4 7.6 22 8.33 22h7.33c.74 0 1.34-.6 1.34-1.33V8H7z"/></g> -<g id="battery-alert"><path d="M15.67 4H14V2h-4v2H8.33C7.6 4 7 4.6 7 5.33v15.33C7 21.4 7.6 22 8.33 22h7.33c.74 0 1.34-.6 1.34-1.33V5.33C17 4.6 16.4 4 15.67 4zM13 18h-2v-2h2v2zm0-4h-2V9h2v5z"/></g> -<g id="battery-charging-20"><path d="M11 20v-3H7v3.67C7 21.4 7.6 22 8.33 22h7.33c.74 0 1.34-.6 1.34-1.33V17h-4.4L11 20z"/><path fill-opacity=".3" d="M15.67 4H14V2h-4v2H8.33C7.6 4 7 4.6 7 5.33V17h4v-2.5H9L13 7v5.5h2L12.6 17H17V5.33C17 4.6 16.4 4 15.67 4z"/></g> -<g id="battery-charging-30"><path fill-opacity=".3" d="M15.67 4H14V2h-4v2H8.33C7.6 4 7 4.6 7 5.33v9.17h2L13 7v5.5h2l-1.07 2H17V5.33C17 4.6 16.4 4 15.67 4z"/><path d="M11 20v-5.5H7v6.17C7 21.4 7.6 22 8.33 22h7.33c.74 0 1.34-.6 1.34-1.33V14.5h-3.07L11 20z"/></g> -<g id="battery-charging-50"><path d="M14.47 13.5L11 20v-5.5H9l.53-1H7v7.17C7 21.4 7.6 22 8.33 22h7.33c.74 0 1.34-.6 1.34-1.33V13.5h-2.53z"/><path fill-opacity=".3" d="M15.67 4H14V2h-4v2H8.33C7.6 4 7 4.6 7 5.33v8.17h2.53L13 7v5.5h2l-.53 1H17V5.33C17 4.6 16.4 4 15.67 4z"/></g> -<g id="battery-charging-60"><path fill-opacity=".3" d="M15.67 4H14V2h-4v2H8.33C7.6 4 7 4.6 7 5.33V11h3.87L13 7v4h4V5.33C17 4.6 16.4 4 15.67 4z"/><path d="M13 12.5h2L11 20v-5.5H9l1.87-3.5H7v9.67C7 21.4 7.6 22 8.33 22h7.33c.74 0 1.34-.6 1.34-1.33V11h-4v1.5z"/></g> -<g id="battery-charging-80"><path fill-opacity=".3" d="M15.67 4H14V2h-4v2H8.33C7.6 4 7 4.6 7 5.33V9h4.93L13 7v2h4V5.33C17 4.6 16.4 4 15.67 4z"/><path d="M13 12.5h2L11 20v-5.5H9L11.93 9H7v11.67C7 21.4 7.6 22 8.33 22h7.33c.74 0 1.34-.6 1.34-1.33V9h-4v3.5z"/></g> -<g id="battery-charging-90"><path fill-opacity=".3" d="M15.67 4H14V2h-4v2H8.33C7.6 4 7 4.6 7 5.33V8h5.47L13 7v1h4V5.33C17 4.6 16.4 4 15.67 4z"/><path d="M13 12.5h2L11 20v-5.5H9L12.47 8H7v12.67C7 21.4 7.6 22 8.33 22h7.33c.74 0 1.34-.6 1.34-1.33V8h-4v4.5z"/></g> -<g id="battery-charging-full"><path d="M15.67 4H14V2h-4v2H8.33C7.6 4 7 4.6 7 5.33v15.33C7 21.4 7.6 22 8.33 22h7.33c.74 0 1.34-.6 1.34-1.33V5.33C17 4.6 16.4 4 15.67 4zM11 20v-5.5H9L13 7v5.5h2L11 20z"/></g> -<g id="battery-full"><path d="M15.67 4H14V2h-4v2H8.33C7.6 4 7 4.6 7 5.33v15.33C7 21.4 7.6 22 8.33 22h7.33c.74 0 1.34-.6 1.34-1.33V5.33C17 4.6 16.4 4 15.67 4z"/></g> -<g id="battery-std"><path d="M15.67 4H14V2h-4v2H8.33C7.6 4 7 4.6 7 5.33v15.33C7 21.4 7.6 22 8.33 22h7.33c.74 0 1.34-.6 1.34-1.33V5.33C17 4.6 16.4 4 15.67 4z"/></g> -<g id="battery-unknown"><path d="M15.67 4H14V2h-4v2H8.33C7.6 4 7 4.6 7 5.33v15.33C7 21.4 7.6 22 8.33 22h7.33c.74 0 1.34-.6 1.34-1.33V5.33C17 4.6 16.4 4 15.67 4zm-2.72 13.95h-1.9v-1.9h1.9v1.9zm1.35-5.26s-.38.42-.67.71c-.48.48-.83 1.15-.83 1.6h-1.6c0-.83.46-1.52.93-2l.93-.94c.27-.27.44-.65.44-1.06 0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5H9c0-1.66 1.34-3 3-3s3 1.34 3 3c0 .66-.27 1.26-.7 1.69z"/></g> -<g id="bluetooth"><path d="M17.71 7.71L12 2h-1v7.59L6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 11 14.41V22h1l5.71-5.71-4.3-4.29 4.3-4.29zM13 5.83l1.88 1.88L13 9.59V5.83zm1.88 10.46L13 18.17v-3.76l1.88 1.88z"/></g> -<g id="bluetooth-connected"><path d="M7 12l-2-2-2 2 2 2 2-2zm10.71-4.29L12 2h-1v7.59L6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 11 14.41V22h1l5.71-5.71-4.3-4.29 4.3-4.29zM13 5.83l1.88 1.88L13 9.59V5.83zm1.88 10.46L13 18.17v-3.76l1.88 1.88zM19 10l-2 2 2 2 2-2-2-2z"/></g> -<g id="bluetooth-disabled"><path d="M13 5.83l1.88 1.88-1.6 1.6 1.41 1.41 3.02-3.02L12 2h-1v5.03l2 2v-3.2zM5.41 4L4 5.41 10.59 12 5 17.59 6.41 19 11 14.41V22h1l4.29-4.29 2.3 2.29L20 18.59 5.41 4zM13 18.17v-3.76l1.88 1.88L13 18.17z"/></g> -<g id="bluetooth-searching"><path d="M14.24 12.01l2.32 2.32c.28-.72.44-1.51.44-2.33 0-.82-.16-1.59-.43-2.31l-2.33 2.32zm5.29-5.3l-1.26 1.26c.63 1.21.98 2.57.98 4.02s-.36 2.82-.98 4.02l1.2 1.2c.97-1.54 1.54-3.36 1.54-5.31-.01-1.89-.55-3.67-1.48-5.19zm-3.82 1L10 2H9v7.59L4.41 5 3 6.41 8.59 12 3 17.59 4.41 19 9 14.41V22h1l5.71-5.71-4.3-4.29 4.3-4.29zM11 5.83l1.88 1.88L11 9.59V5.83zm1.88 10.46L11 18.17v-3.76l1.88 1.88z"/></g> -<g id="brightness-auto"><path d="M10.85 12.65h2.3L12 9l-1.15 3.65zM20 8.69V4h-4.69L12 .69 8.69 4H4v4.69L.69 12 4 15.31V20h4.69L12 23.31 15.31 20H20v-4.69L23.31 12 20 8.69zM14.3 16l-.7-2h-3.2l-.7 2H7.8L11 7h2l3.2 9h-1.9z"/></g> -<g id="brightness-high"><path d="M20 8.69V4h-4.69L12 .69 8.69 4H4v4.69L.69 12 4 15.31V20h4.69L12 23.31 15.31 20H20v-4.69L23.31 12 20 8.69zM12 18c-3.31 0-6-2.69-6-6s2.69-6 6-6 6 2.69 6 6-2.69 6-6 6zm0-10c-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4-1.79-4-4-4z"/></g> -<g id="brightness-low"><path d="M20 15.31L23.31 12 20 8.69V4h-4.69L12 .69 8.69 4H4v4.69L.69 12 4 15.31V20h4.69L12 23.31 15.31 20H20v-4.69zM12 18c-3.31 0-6-2.69-6-6s2.69-6 6-6 6 2.69 6 6-2.69 6-6 6z"/></g> -<g id="brightness-medium"><path d="M20 15.31L23.31 12 20 8.69V4h-4.69L12 .69 8.69 4H4v4.69L.69 12 4 15.31V20h4.69L12 23.31 15.31 20H20v-4.69zM12 18V6c3.31 0 6 2.69 6 6s-2.69 6-6 6z"/></g> -<g id="data-usage"><path d="M13 2.05v3.03c3.39.49 6 3.39 6 6.92 0 .9-.18 1.75-.48 2.54l2.6 1.53c.56-1.24.88-2.62.88-4.07 0-5.18-3.95-9.45-9-9.95zM12 19c-3.87 0-7-3.13-7-7 0-3.53 2.61-6.43 6-6.92V2.05c-5.06.5-9 4.76-9 9.95 0 5.52 4.47 10 9.99 10 3.31 0 6.24-1.61 8.06-4.09l-2.6-1.53C16.17 17.98 14.21 19 12 19z"/></g> -<g id="developer-mode"><path d="M7 5h10v2h2V3c0-1.1-.9-1.99-2-1.99L7 1c-1.1 0-2 .9-2 2v4h2V5zm8.41 11.59L20 12l-4.59-4.59L14 8.83 17.17 12 14 15.17l1.41 1.42zM10 15.17L6.83 12 10 8.83 8.59 7.41 4 12l4.59 4.59L10 15.17zM17 19H7v-2H5v4c0 1.1.9 2 2 2h10c1.1 0 2-.9 2-2v-4h-2v2z"/></g> -<g id="devices"><path d="M4 6h18V4H4c-1.1 0-2 .9-2 2v11H0v3h14v-3H4V6zm19 2h-6c-.55 0-1 .45-1 1v10c0 .55.45 1 1 1h6c.55 0 1-.45 1-1V9c0-.55-.45-1-1-1zm-1 9h-4v-7h4v7z"/></g> -<g id="dvr"><path d="M21 3H3c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h5v2h8v-2h5c1.1 0 1.99-.9 1.99-2L23 5c0-1.1-.9-2-2-2zm0 14H3V5h18v12zm-2-9H8v2h11V8zm0 4H8v2h11v-2zM7 8H5v2h2V8zm0 4H5v2h2v-2z"/></g> -<g id="gps-fixed"><path d="M12 8c-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4-1.79-4-4-4zm8.94 3c-.46-4.17-3.77-7.48-7.94-7.94V1h-2v2.06C6.83 3.52 3.52 6.83 3.06 11H1v2h2.06c.46 4.17 3.77 7.48 7.94 7.94V23h2v-2.06c4.17-.46 7.48-3.77 7.94-7.94H23v-2h-2.06zM12 19c-3.87 0-7-3.13-7-7s3.13-7 7-7 7 3.13 7 7-3.13 7-7 7z"/></g> -<g id="gps-not-fixed"><path d="M20.94 11c-.46-4.17-3.77-7.48-7.94-7.94V1h-2v2.06C6.83 3.52 3.52 6.83 3.06 11H1v2h2.06c.46 4.17 3.77 7.48 7.94 7.94V23h2v-2.06c4.17-.46 7.48-3.77 7.94-7.94H23v-2h-2.06zM12 19c-3.87 0-7-3.13-7-7s3.13-7 7-7 7 3.13 7 7-3.13 7-7 7z"/></g> -<g id="gps-off"><path d="M20.94 11c-.46-4.17-3.77-7.48-7.94-7.94V1h-2v2.06c-1.13.12-2.19.46-3.16.97l1.5 1.5C10.16 5.19 11.06 5 12 5c3.87 0 7 3.13 7 7 0 .94-.19 1.84-.52 2.65l1.5 1.5c.5-.96.84-2.02.97-3.15H23v-2h-2.06zM3 4.27l2.04 2.04C3.97 7.62 3.25 9.23 3.06 11H1v2h2.06c.46 4.17 3.77 7.48 7.94 7.94V23h2v-2.06c1.77-.2 3.38-.91 4.69-1.98L19.73 21 21 19.73 4.27 3 3 4.27zm13.27 13.27C15.09 18.45 13.61 19 12 19c-3.87 0-7-3.13-7-7 0-1.61.55-3.09 1.46-4.27l9.81 9.81z"/></g> -<g id="graphic-eq"><path d="M7 18h2V6H7v12zm4 4h2V2h-2v20zm-8-8h2v-4H3v4zm12 4h2V6h-2v12zm4-8v4h2v-4h-2z"/></g> -<g id="location-disabled"><path d="M20.94 11c-.46-4.17-3.77-7.48-7.94-7.94V1h-2v2.06c-1.13.12-2.19.46-3.16.97l1.5 1.5C10.16 5.19 11.06 5 12 5c3.87 0 7 3.13 7 7 0 .94-.19 1.84-.52 2.65l1.5 1.5c.5-.96.84-2.02.97-3.15H23v-2h-2.06zM3 4.27l2.04 2.04C3.97 7.62 3.25 9.23 3.06 11H1v2h2.06c.46 4.17 3.77 7.48 7.94 7.94V23h2v-2.06c1.77-.2 3.38-.91 4.69-1.98L19.73 21 21 19.73 4.27 3 3 4.27zm13.27 13.27C15.09 18.45 13.61 19 12 19c-3.87 0-7-3.13-7-7 0-1.61.55-3.09 1.46-4.27l9.81 9.81z"/></g> -<g id="location-searching"><path d="M20.94 11c-.46-4.17-3.77-7.48-7.94-7.94V1h-2v2.06C6.83 3.52 3.52 6.83 3.06 11H1v2h2.06c.46 4.17 3.77 7.48 7.94 7.94V23h2v-2.06c4.17-.46 7.48-3.77 7.94-7.94H23v-2h-2.06zM12 19c-3.87 0-7-3.13-7-7s3.13-7 7-7 7 3.13 7 7-3.13 7-7 7z"/></g> -<g id="network-cell"><path fill-opacity=".3" d="M2 22h20V2z"/><path d="M17 7L2 22h15z"/></g> -<g id="network-wifi"><path fill-opacity=".3" d="M12.01 21.49L23.64 7c-.45-.34-4.93-4-11.64-4C5.28 3 .81 6.66.36 7l11.63 14.49.01.01.01-.01z"/><path d="M3.53 10.95l8.46 10.54.01.01.01-.01 8.46-10.54C20.04 10.62 16.81 8 12 8c-4.81 0-8.04 2.62-8.47 2.95z"/></g> -<g id="nfc"><path d="M20 2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm0 18H4V4h16v16zM18 6h-5c-1.1 0-2 .9-2 2v2.28c-.6.35-1 .98-1 1.72 0 1.1.9 2 2 2s2-.9 2-2c0-.74-.4-1.38-1-1.72V8h3v8H8V8h2V6H6v12h12V6z"/></g> -<g id="screen-lock-landscape"><path d="M21 5H3c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm-2 12H5V7h14v10zm-9-1h4c.55 0 1-.45 1-1v-3c0-.55-.45-1-1-1v-1c0-1.11-.9-2-2-2-1.11 0-2 .9-2 2v1c-.55 0-1 .45-1 1v3c0 .55.45 1 1 1zm.8-6c0-.66.54-1.2 1.2-1.2.66 0 1.2.54 1.2 1.2v1h-2.4v-1z"/></g> -<g id="screen-lock-portrait"><path d="M10 16h4c.55 0 1-.45 1-1v-3c0-.55-.45-1-1-1v-1c0-1.11-.9-2-2-2-1.11 0-2 .9-2 2v1c-.55 0-1 .45-1 1v3c0 .55.45 1 1 1zm.8-6c0-.66.54-1.2 1.2-1.2.66 0 1.2.54 1.2 1.2v1h-2.4v-1zM17 1H7c-1.1 0-2 .9-2 2v18c0 1.1.9 2 2 2h10c1.1 0 2-.9 2-2V3c0-1.1-.9-2-2-2zm0 18H7V5h10v14z"/></g> -<g id="screen-lock-rotation"><path d="M23.25 12.77l-2.57-2.57-1.41 1.41 2.22 2.22-5.66 5.66L4.51 8.17l5.66-5.66 2.1 2.1 1.41-1.41L11.23.75c-.59-.59-1.54-.59-2.12 0L2.75 7.11c-.59.59-.59 1.54 0 2.12l12.02 12.02c.59.59 1.54.59 2.12 0l6.36-6.36c.59-.59.59-1.54 0-2.12zM8.47 20.48C5.2 18.94 2.86 15.76 2.5 12H1c.51 6.16 5.66 11 11.95 11l.66-.03-3.81-3.82-1.33 1.33zM16 9h5c.55 0 1-.45 1-1V4c0-.55-.45-1-1-1v-.5C21 1.12 19.88 0 18.5 0S16 1.12 16 2.5V3c-.55 0-1 .45-1 1v4c0 .55.45 1 1 1zm.8-6.5c0-.94.76-1.7 1.7-1.7s1.7.76 1.7 1.7V3h-3.4v-.5z"/></g> -<g id="screen-rotation"><path d="M16.48 2.52c3.27 1.55 5.61 4.72 5.97 8.48h1.5C23.44 4.84 18.29 0 12 0l-.66.03 3.81 3.81 1.33-1.32zm-6.25-.77c-.59-.59-1.54-.59-2.12 0L1.75 8.11c-.59.59-.59 1.54 0 2.12l12.02 12.02c.59.59 1.54.59 2.12 0l6.36-6.36c.59-.59.59-1.54 0-2.12L10.23 1.75zm4.6 19.44L2.81 9.17l6.36-6.36 12.02 12.02-6.36 6.36zm-7.31.29C4.25 19.94 1.91 16.76 1.55 13H.05C.56 19.16 5.71 24 12 24l.66-.03-3.81-3.81-1.33 1.32z"/></g> -<g id="sd-storage"><path d="M18 2h-8L4.02 8 4 20c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-6 6h-2V4h2v4zm3 0h-2V4h2v4zm3 0h-2V4h2v4z"/></g> -<g id="settings-system-daydream"><path d="M9 16h6.5c1.38 0 2.5-1.12 2.5-2.5S16.88 11 15.5 11h-.05c-.24-1.69-1.69-3-3.45-3-1.4 0-2.6.83-3.16 2.02h-.16C7.17 10.18 6 11.45 6 13c0 1.66 1.34 3 3 3zM21 3H3c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16.01H3V4.99h18v14.02z"/></g> -<g id="signal-cellular-0-bar"><path fill-opacity=".3" d="M2 22h20V2z"/></g> -<g id="signal-cellular-1-bar"><path fill-opacity=".3" d="M2 22h20V2z"/><path d="M12 12L2 22h10z"/></g> -<g id="signal-cellular-2-bar"><path fill-opacity=".3" d="M2 22h20V2z"/><path d="M14 10L2 22h12z"/></g> -<g id="signal-cellular-3-bar"><path fill-opacity=".3" d="M2 22h20V2z"/><path d="M17 7L2 22h15z"/></g> -<g id="signal-cellular-4-bar"><path d="M2 22h20V2z"/></g> -<g id="signal-cellular-connected-no-internet-0-bar"><path fill-opacity=".3" d="M22 8V2L2 22h16V8z"/><path d="M20 22h2v-2h-2v2zm0-12v8h2v-8h-2z"/></g> -<g id="signal-cellular-connected-no-internet-1-bar"><path fill-opacity=".3" d="M22 8V2L2 22h16V8z"/><path d="M20 10v8h2v-8h-2zm-8 12V12L2 22h10zm8 0h2v-2h-2v2z"/></g> -<g id="signal-cellular-connected-no-internet-2-bar"><path fill-opacity=".3" d="M22 8V2L2 22h16V8z"/><path d="M14 22V10L2 22h12zm6-12v8h2v-8h-2zm0 12h2v-2h-2v2z"/></g> -<g id="signal-cellular-connected-no-internet-3-bar"><path fill-opacity=".3" d="M22 8V2L2 22h16V8z"/><path d="M17 22V7L2 22h15zm3-12v8h2v-8h-2zm0 12h2v-2h-2v2z"/></g> -<g id="signal-cellular-connected-no-internet-4-bar"><path d="M20 18h2v-8h-2v8zm0 4h2v-2h-2v2zM2 22h16V8h4V2L2 22z"/></g> -<g id="signal-cellular-no-sim"><path d="M18.99 5c0-1.1-.89-2-1.99-2h-7L7.66 5.34 19 16.68 18.99 5zM3.65 3.88L2.38 5.15 5 7.77V19c0 1.1.9 2 2 2h10.01c.35 0 .67-.1.96-.26l1.88 1.88 1.27-1.27L3.65 3.88z"/></g> -<g id="signal-cellular-null"><path d="M20 6.83V20H6.83L20 6.83M22 2L2 22h20V2z"/></g> -<g id="signal-cellular-off"><path d="M21 1l-8.59 8.59L21 18.18V1zM4.77 4.5L3.5 5.77l6.36 6.36L1 21h17.73l2 2L22 21.73 4.77 4.5z"/></g> -<g id="signal-wifi-0-bar"><path fill-opacity=".3" d="M12.01 21.49L23.64 7c-.45-.34-4.93-4-11.64-4C5.28 3 .81 6.66.36 7l11.63 14.49.01.01.01-.01z"/></g> -<g id="signal-wifi-1-bar"><path fill-opacity=".3" d="M12.01 21.49L23.64 7c-.45-.34-4.93-4-11.64-4C5.28 3 .81 6.66.36 7l11.63 14.49.01.01.01-.01z"/><path d="M6.67 14.86L12 21.49v.01l.01-.01 5.33-6.63C17.06 14.65 15.03 13 12 13s-5.06 1.65-5.33 1.86z"/></g> -<g id="signal-wifi-1-bar-lock"><path d="M23 16v-1.5c0-1.4-1.1-2.5-2.5-2.5S18 13.1 18 14.5V16c-.5 0-1 .5-1 1v4c0 .5.5 1 1 1h5c.5 0 1-.5 1-1v-4c0-.5-.5-1-1-1zm-1 0h-3v-1.5c0-.8.7-1.5 1.5-1.5s1.5.7 1.5 1.5V16z"/><path d="M15.5 14.5c0-2.8 2.2-5 5-5 .4 0 .7 0 1 .1L23.6 7c-.4-.3-4.9-4-11.6-4C5.3 3 .8 6.7.4 7L12 21.5l3.5-4.3v-2.7z" opacity=".3"/><path d="M6.7 14.9l5.3 6.6 3.5-4.3v-2.6c0-.2 0-.5.1-.7-.9-.5-2.2-.9-3.6-.9-3 0-5.1 1.7-5.3 1.9z"/></g> -<g id="signal-wifi-2-bar"><path fill-opacity=".3" d="M12.01 21.49L23.64 7c-.45-.34-4.93-4-11.64-4C5.28 3 .81 6.66.36 7l11.63 14.49.01.01.01-.01z"/><path d="M4.79 12.52l7.2 8.98H12l.01-.01 7.2-8.98C18.85 12.24 16.1 10 12 10s-6.85 2.24-7.21 2.52z"/></g> -<g id="signal-wifi-2-bar-lock"><path d="M23 16v-1.5c0-1.4-1.1-2.5-2.5-2.5S18 13.1 18 14.5V16c-.5 0-1 .5-1 1v4c0 .5.5 1 1 1h5c.5 0 1-.5 1-1v-4c0-.5-.5-1-1-1zm-1 0h-3v-1.5c0-.8.7-1.5 1.5-1.5s1.5.7 1.5 1.5V16z"/><path d="M15.5 14.5c0-2.8 2.2-5 5-5 .4 0 .7 0 1 .1L23.6 7c-.4-.3-4.9-4-11.6-4C5.3 3 .8 6.7.4 7L12 21.5l3.5-4.3v-2.7z" opacity=".3"/><path d="M4.8 12.5l7.2 9 3.5-4.4v-2.6c0-1.3.5-2.5 1.4-3.4C15.6 10.5 14 10 12 10c-4.1 0-6.8 2.2-7.2 2.5z"/></g> -<g id="signal-wifi-3-bar"><path fill-opacity=".3" d="M12.01 21.49L23.64 7c-.45-.34-4.93-4-11.64-4C5.28 3 .81 6.66.36 7l11.63 14.49.01.01.01-.01z"/><path d="M3.53 10.95l8.46 10.54.01.01.01-.01 8.46-10.54C20.04 10.62 16.81 8 12 8c-4.81 0-8.04 2.62-8.47 2.95z"/></g> -<g id="signal-wifi-3-bar-lock"><path opacity=".3" d="M12 3C5.3 3 .8 6.7.4 7l3.2 3.9L12 21.5l3.5-4.3v-2.6c0-2.2 1.4-4 3.3-4.7.3-.1.5-.2.8-.2.3-.1.6-.1.9-.1.4 0 .7 0 1 .1L23.6 7c-.4-.3-4.9-4-11.6-4z"/><path d="M23 16v-1.5c0-1.4-1.1-2.5-2.5-2.5S18 13.1 18 14.5V16c-.5 0-1 .5-1 1v4c0 .5.5 1 1 1h5c.5 0 1-.5 1-1v-4c0-.5-.5-1-1-1zm-1 0h-3v-1.5c0-.8.7-1.5 1.5-1.5s1.5.7 1.5 1.5V16zm-10 5.5l3.5-4.3v-2.6c0-2.2 1.4-4 3.3-4.7C17.3 9 14.9 8 12 8c-4.8 0-8 2.6-8.5 2.9"/></g> -<g id="signal-wifi-4-bar"><path d="M12.01 21.49L23.64 7c-.45-.34-4.93-4-11.64-4C5.28 3 .81 6.66.36 7l11.63 14.49.01.01.01-.01z"/></g> -<g id="signal-wifi-4-bar-lock"><path d="M23 16v-1.5c0-1.4-1.1-2.5-2.5-2.5S18 13.1 18 14.5V16c-.5 0-1 .5-1 1v4c0 .5.5 1 1 1h5c.5 0 1-.5 1-1v-4c0-.5-.5-1-1-1zm-1 0h-3v-1.5c0-.8.7-1.5 1.5-1.5s1.5.7 1.5 1.5V16zm-6.5-1.5c0-2.8 2.2-5 5-5 .4 0 .7 0 1 .1L23.6 7c-.4-.3-4.9-4-11.6-4C5.3 3 .8 6.7.4 7L12 21.5l3.5-4.4v-2.6z"/></g> -<g id="signal-wifi-off"><path d="M23.64 7c-.45-.34-4.93-4-11.64-4-1.5 0-2.89.19-4.15.48L18.18 13.8 23.64 7zm-6.6 8.22L3.27 1.44 2 2.72l2.05 2.06C1.91 5.76.59 6.82.36 7l11.63 14.49.01.01.01-.01 3.9-4.86 3.32 3.32 1.27-1.27-3.46-3.46z"/></g> -<g id="storage"><path d="M2 20h20v-4H2v4zm2-3h2v2H4v-2zM2 4v4h20V4H2zm4 3H4V5h2v2zm-4 7h20v-4H2v4zm2-3h2v2H4v-2z"/></g> -<g id="usb"><path d="M15 7v4h1v2h-3V5h2l-3-4-3 4h2v8H8v-2.07c.7-.37 1.2-1.08 1.2-1.93 0-1.21-.99-2.2-2.2-2.2-1.21 0-2.2.99-2.2 2.2 0 .85.5 1.56 1.2 1.93V13c0 1.11.89 2 2 2h3v3.05c-.71.37-1.2 1.1-1.2 1.95 0 1.22.99 2.2 2.2 2.2 1.21 0 2.2-.98 2.2-2.2 0-.85-.49-1.58-1.2-1.95V15h3c1.11 0 2-.89 2-2v-2h1V7h-4z"/></g> -<g id="wallpaper"><path d="M4 4h7V2H4c-1.1 0-2 .9-2 2v7h2V4zm6 9l-4 5h12l-3-4-2.03 2.71L10 13zm7-4.5c0-.83-.67-1.5-1.5-1.5S14 7.67 14 8.5s.67 1.5 1.5 1.5S17 9.33 17 8.5zM20 2h-7v2h7v7h2V4c0-1.1-.9-2-2-2zm0 18h-7v2h7c1.1 0 2-.9 2-2v-7h-2v7zM4 13H2v7c0 1.1.9 2 2 2h7v-2H4v-7z"/></g> -<g id="widgets"><path d="M13 13v8h8v-8h-8zM3 21h8v-8H3v8zM3 3v8h8V3H3zm13.66-1.31L11 7.34 16.66 13l5.66-5.66-5.66-5.65z"/></g> -<g id="wifi-lock"><path d="M20.5 9.5c.28 0 .55.04.81.08L24 6c-3.34-2.51-7.5-4-12-4S3.34 3.49 0 6l12 16 3.5-4.67V14.5c0-2.76 2.24-5 5-5zM23 16v-1.5c0-1.38-1.12-2.5-2.5-2.5S18 13.12 18 14.5V16c-.55 0-1 .45-1 1v4c0 .55.45 1 1 1h5c.55 0 1-.45 1-1v-4c0-.55-.45-1-1-1zm-1 0h-3v-1.5c0-.83.67-1.5 1.5-1.5s1.5.67 1.5 1.5V16z"/></g> -<g id="wifi-tethering"><path d="M12 11c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm6 2c0-3.31-2.69-6-6-6s-6 2.69-6 6c0 2.22 1.21 4.15 3 5.19l1-1.74c-1.19-.7-2-1.97-2-3.45 0-2.21 1.79-4 4-4s4 1.79 4 4c0 1.48-.81 2.75-2 3.45l1 1.74c1.79-1.04 3-2.97 3-5.19zM12 3C6.48 3 2 7.48 2 13c0 3.7 2.01 6.92 4.99 8.65l1-1.73C5.61 18.53 4 15.96 4 13c0-4.42 3.58-8 8-8s8 3.58 8 8c0 2.96-1.61 5.53-4 6.92l1 1.73c2.99-1.73 5-4.95 5-8.65 0-5.52-4.48-10-10-10z"/></g> -</defs></svg> -</iron-iconset-svg> +var rov; /* TICloudAgent ROVServer sub module */ + +var packagePath; /* package path array from the environment, CCS, or ... */ + +var wssPort = 8888; /* standalone nodeserver's WebSocket server port */ +var sock; /* standalone WebSocket server socket */ + +/* ccs7 is true when we are running in the context of the CCS cloud */ +var ccs7 = false; + +var ds; /* DebugServer module: agent.getSubModule("DS") */ +var dsFlag = false; /* true if we're told to connect via DSLite */ +var dsActiveCoreName = null; + +var deferedSymbols = null; +var exeSet = null; /* exeSet != null => ROV connected to the exe exeSet */ + +/* + * ======== debuggerStatus ======== + * Current debugger state + * + * null - unknown or disconnected + * "Disconnected" - + * "TargetHalt" - + * "Running" - + * "Connected" - + * + * TODO: connected/disconnected should be orthogonal to + * running/halted so what's up with the states above?!?! + */ +var debuggerStatus = null; + +/* + * ======== init ======== + */ +function init() +{ + ccs7 = (typeof TICloudAgent) == "undefined" ? false : true; + + /* parse URL for setup parameters */ + var tokens = location.href.split(/[?&]/); + tokens.shift(); + for (var i = 0; i < tokens.length; i++) { + var param = tokens.shift(); + var pair = param.split('='); + switch (pair[0]) { + case "wsPort": { + if (pair[1]) { + wssPort = pair[1]; + console.log("set wssPort to: " + wssPort); + } + break; + } + } + } +} + +/* + * ======== setExecutable ======== + * Specify the executable to decode + * + * This function initializes ROV and must be called before any other calls. + * + * During the operation, progress() is called with a progress string that + * may be useful to an impatient user. + * + * On completion, callback() is called with a response of the form: + * {resStr: "...", exeName: "...", connType: "...", connArgs: ["...", ...]} + * where, + * exeName - full path of the executable + * connType - connection type: "DSLite", "Serial", "Net", ... + * connArgs - array of String values needed by the connection + * or, in the event that none are supplied, [] + * coreName - name of core to which we're connected (if unknown, null) + * resStr - final status result string from this operation: + * "OK" - success + * any other string - failure and the string is a printable + * message explaining the cause + * + * Events coming from the target after a connection is estabilished + * but possibly _before_ and after the executable has been set are + * returned by calling targetEvents(). + * + * path is a string of the form: + * <exe_path>?comm=<comm_type>[:<comm_arg>]*[&<name=value>]* + * where, + * <exe_path> is the full path to the executable + * <comm_type> is "DSLite", "Serial", "Net", ... + * <comm_arg> is a communication-specific value + * <name=value> is an arbitrary name-value pair that is + * specified by the client + */ +function setExecutable(path, reqObj, callback, progress, targetEvents) +{ + init(); + + /* standalone (for now we need TICloudAgent to use DSLite, blech!) */ + if (!ccs7 && path.indexOf("DSLite") == -1) { + var old = sock; + sock = new WebSocket("ws://localhost:" + wssPort); + sock.onopen = function() { + sock.send(JSON.stringify("exec:" + path + "\r\n")); + if (old != null) { + old.close(); + } + }; + + sock.onmessage = function (ret) { + console.log("setExec response: " + ret.data); + if (ret.data != null && ret.data.indexOf("Working:") == 0) { + if (progress != null) progress(ret.data, reqObj); + } + else { + var result = _parseExePath(path); + + /* add resStr to result to form callback value */ + result.resStr = ret.data; + result.exeName = ""; /* safe, but is this needed??? */ + result.coreName = ""; + callback(result, reqObj); + } + }; + } + /* TI Cloud */ + else { + var dev = ""; + var k = path.indexOf("DSLite"); + if (k != -1) { + dsFlag = true; + + /* check path for a device name (default is "") */ + var tmp = path.substr(k + 7).split(':')[0]; + if (tmp != null && tmp != "" && tmp != "undefined") { + dev = tmp; + } + } + + /* connect to the ROV module and DS (if requested) */ + _connect().then( + /* connect to active core's module */ + function(obj) { + /* save ROVServer module for subsequent use */ + rov = obj; + + /* use ds to get debug core */ + if (ds == null || dsFlag == false) { + var promContainer = Q.defer(); + var prom = promContainer.promise; + promContainer.resolve(); + return (prom); /* return undefined */ + } + + /* if ds != null, get all core names */ + return ds.listCores().then( + function(cores) { + return _setupCore(cores, dev, targetEvents, reqObj); + } + ).then( + function(core0) { + console.log("dstatus: " + debuggerStatus); + if (debuggerStatus == null + || debuggerStatus == "Disconnected") { + console.log("debugger is not connected"); + /* don't fail if connection is, say, Serial. + * (does this make sense?) + */ + if (dsFlag) { + throw new Error("The debugger is not connected"); + } + } + return (core0); /* return core's module */ + } + ); + } + ) + .then( + /* use debug core to get exe name */ + function(core0) { + if (core0 != null) { + /* ask debugger for files loaded on specified core */ + return _getSymbols(core0); + } + console.log("no debugger => no symbol file list"); + return ({symbolFiles: []}); + } + ) + .then( + /* get package path for the specified exe */ + function(files) { + console.log("core files: " + + JSON.stringify(files, null, 3)); + var exe = _validateExe(path, files).split('?')[0]; + return _getProject(exe).then( + function (proj) { + console.log("exe project: " + + JSON.stringify(proj, null, 3)); + if (proj.location && rov_setFileDefaults) { + rov_setFileDefaults(proj.location, proj.location); + } + return (_getPackagePath(proj.name)); + } + ) + .then( + function (path) { + packagePath = path; + console.log("exe package path: " + path); + return (files); + } + ) + .fail( + function(msg) { + throw new Error(msg); + } + ); + } + ) + .then( + /* start ROV model with an exe specified by path or debugger */ + function(files) { + console.log("core files: " + + JSON.stringify(files, null, 3)); + var newPath = _validateExe(path, files); + var obj = _parsePackagePath(packagePath); + + console.log("rov.setExec(" + newPath + ", " + obj.xdcroot + + ", " + obj.xdcpath + ")"); + return rov.setExec(newPath, obj.xdcroot, obj.xdcpath).then( + function detectProgress(res) { + console.log("setExec response: " + res); + if (res != null && res.indexOf("Working:") == 0) { + rov.getProgress().then(detectProgress); + if (progress != null) { + progress(res, reqObj); + } + } + else { + /* parse newPath for the UI */ + var result = _parseExePath(newPath); + result.coreName = _getCoreName(dsActiveCoreName); + + /* add resStr to result to form callback value */ + result.resStr = res; + + /* save just the exe name */ + exeSet = result.exeName; + + callback(result, reqObj); + } + } + ); + } + ) + .fail( + function(err) { + var msg = err.message ? err.message : err; + console.log("Error: setExecutable() failed: " + msg); + var result = _parseExePath(path); + result.resStr = String(msg); + result.exeName = ""; + result.coreName = ""; + callback(result, reqObj); + } + ); + } + + return (true); +} + +/* + * ======== discoverAddons ======== + */ +function discoverAddons(reqObj, callback) +{ + /* standalone */ + if (sock != null) { + sock.onmessage = function(ret) { + var parsed = null; + var err = null; + try { + parsed = JSON.parse(ret.data); + } + catch (e) { + err = 'Error: JSON.parse exception: ' + e.message; + } + callback(err, parsed, reqObj); + }; + sock.send(JSON.stringify("addons\r\n")); + } + /* TI Cloud */ + else { + rov.discoverAddons().then( + function(list) { + console.log("addons: " + list); + var parsed = null; + var err = null; + try { + parsed = JSON.parse(list); + } + catch (e) { + err = 'Error: JSON.parse exception: ' + e.message; + } + callback(err, parsed, reqObj); + } + ).fail( + function (err) { + var msg = err.message ? err.message : err; + console.log( + "Error: Unexpected Exception from discoverAddons callback:" + + msg); + } + ); + } + + return (true); +} + +/* + * ======== getViewList ======== + * Get list of all modules and their supported views + * + * The view list is a map of arrays, where keys are module names and values + * are arrays of the objects with 'name' and 'type' properties. + * [{name:"view1", type:"view1_type"}, ... ,{name:"viewN", type:"viewN_type"}] + * + * Returns the view list or an error by calling callback(err, list, reqObj), + * where, + * err - error string (or null for no error) + * list - the view list (or null if err is non-null + * reqObj - the passed in context object + */ +function getViewList(reqObj, callback) +{ + /* standalone */ + if (sock != null) { + sock.onmessage = function(ret) { + var parsed = null; + var err = null; + try { + parsed = JSON.parse(ret.data); + } + catch (e) { + err = 'Error: JSON.parse exception: ' + e.message; + } + callback(err, parsed, reqObj); + }; + sock.send(JSON.stringify("list\r\n")); + } + /* TI Cloud */ + else { + rov.getViews().then( + function(list) { + console.log("list: " + list); + var parsed = null; + var err = null; + try { + parsed = JSON.parse(list); + } + catch (e) { + err = 'Error: JSON.parse exception: ' + e.message; + } + callback(err, parsed, reqObj); + } + ).fail( + function (err) { + var msg = err.message ? err.message : err; + console.log( + "Error: Unexpected Exception from getViewList callback:" + + msg); + } + ); + } + + return (true); +} + +/* + * ======== getView ======== + * Get specified view from a module + * + * Returns the view list or an error by calling + * callback(err, view, module, view,reqObj), + * where, + * err - error string (or null forno error) + * list - the view JSON object (or null if err is non-null + * module - the passed in modeule name + * view - the passed in view name + * reqObj - the passed in context object + */ +var queue = []; +function getView(module, view, reqObj, callback) +{ + /* standalone */ + if (sock != null) { + queue.push({module: module, view: view, reqObj: reqObj}); + sock.onmessage = function(ret) { + var parsed = null; + var err = null; + + if (ret.data.indexOf("Error:") == 0) { + err = ret.data; + } + else { + try { + parsed = JSON.parse(ret.data); + } + catch (e) { + err = 'Error: JSON.parse exception: ' + + e.message + ": " + ret.data; + } + } + var args = queue.shift(); + callback(err, parsed, args.module, args.view, args.reqObj); + }; + + sock.send(JSON.stringify("view:" + module + "," + view + "\r\n")); + } + /* TI Cloud */ + else { + //if (debuggerStatus == "Running") { + // callback("Target is running!", null, module, view, reqObj); + // return; + //} + if (dsFlag && (debuggerStatus == null + || debuggerStatus == "Disconnected")) { + callback("Target is disconnected!", null, module, view, reqObj); + return (false); + } + rov.getView(module, view).then( + function(response) { + if (response.indexOf("Error:") == 0) { + callback(response, null, module, view, reqObj); + } + else { + var parsedRes; + var parseErr = null; + try { + parsedRes = JSON.parse(response); + } + catch (e) { + parseErr = 'Error: JSON.parse exception: ' + e.message; + parsedRes = null; + } + callback(parseErr, parsedRes, module, view, reqObj); + } + console.log(module + ":" + view + ": " + response); + } + ).fail( + function (err) { + var msg = err.message ? err.message : err; + console.log("Error: Unexpected exception from getView(" + + module + ", " + view + "): " + msg); + } + ); + } + + return (true); +} + +/* + * ======== _configureDebugger ======== + * Configure debugger using the supplied target configuration + * + * devName is the basename of a .ccxml file (minus the .ccxml extension) + * that defines how to setup the debugger + * + * rov is assumed to be non-null (i.e., _connect() returns a promise to get + * the ROVServer module _and_ that promise resolved to rov). + * + * ds is also assumed to be non-null, which is implied by rov != null + * because, ds is initialized by _connect() before creating the promise to + * get rov. + * + * Returns a promise + * resolved to dbg, where dbg.cores == array of cores + * or + * rejected because devName.ccxml is not found or + * configuration with this file failed + * + * (Internal function) + */ +function _configureDebugger(devName) +{ + console.log("_configureDebugger(" + devName + ")"); + return _getProject().then( + /* get the package path from active project (or workspace if none) */ + function(proj) { + console.log("activeProjectContext: " + JSON.stringify(proj, null, 3)); + return _getPackagePath(proj.name); + } + ).then( + /* lookup .ccxml file along package path */ + function (packagePath) { + return rov.find(devName + ".ccxml", packagePath); + } + ).then( + /* configure the debugger */ + function(ccxmlFile) { + console.log("configuring with: " + ccxmlFile); + return ds.configure(ccxmlFile).fail( + function(err) { + var msg = "configuration for '" + devName + + "' failed: " + (err.message ? err.message : err); + console.log(msg); + throw new Error(msg); + } + ); + } + ).fail( + function(err) { + debuggerStatus = null; + + var msg = "can't find " + devName + ".ccxml"; + console.log(msg); + throw new Error(msg); + } + ); +} + +/* + * ======== _connect ======== + * Connect to the ROV module in the TICloudAgent WebSocket server + * + * Called directly by setExecutable() to establish connection with + * the ROVServer module (rov_server.js). + * + * Returns a promise + * resolved to rov = ROVServer submodule (agent.getSubModule("ROVServer")) + * rejected because we can't start agent or the connection is + * DSLite and we failed to get the DS submodule + * + * Throws an exception if TICloudAgent.Init() throws (which it shouldn't) + * + * Side Effects: sets ds to the DebugServer/DSLite module + * + * (Internal function) + */ +function _connect() +{ + var agent; + console.log("_connect: connecting ..."); + + if (rov != null) { + var prom = Q.defer(); + prom.resolve(rov); + console.log("_connect: using cached rov = " + rov); + return (prom.promise); + } + + return TICloudAgent.Init().then( + /* init/configure agent and get EventBroker module */ + function(_agent) { + agent = _agent; + agent.addConfigProperty("cloudAgentInstallerServerURL", + location.origin + "/ticloudagent/"); + return agent.getSubModule("EventBroker"); + } + ).then( + /* add EventBroker listeners and get active project */ + function(broker) { + broker.addListener("ccs.debug.activeContextChangedEvent", + function(data) { + console.log("ccs.debug.activeContextChanged: " + + JSON.stringify(data, null, 3)); + }); + + return broker.fetchData("ccs.debug.activeContext"); + } + ).then( + /* get DS module */ + function(obj) { + console.log("activeDebugContext: " + JSON.stringify(obj, null, 3)); + if (obj.data && obj.data.length > 0) { + dsActiveCoreName = obj.data[0].core; + } + + /* get DS sub-model from agent */ + return agent.getSubModule("DS"); + } + ).then( + /* add DS listeners */ + function(_ds) { + ds = _ds; + console.log("acquired DS sub-module: " + ds); + ds.addListener("close", + function() { + console.log("DS closing"); + debuggerStatus = null; + } + ); + ds.addListener("configChanged", + function(data) { + console.log("DS config changed: " + + JSON.stringify(data, null, 3)); + if (data.cores[0] == undefined) { + debuggerStatus = null; + console.log("DS config changed: debugger terminated"); + if (exeSet != null) { + location.reload(true); + exeSet = null; + } + } + } + ); + } + ).fail( + /* throw exception if we can't start agent or get DS submodule */ + function(err) { + var emsg = err.message ? err.message : err; + if (agent == null) { + var msg = "ROV _connect failed to start agent: " + emsg; + console.log(msg); + throw new Error(msg); + } + else if (ds == null) { + var msg = "ROV _connect failed to acquire DS: " + emsg; + console.log(msg); + if (String(emsg).indexOf("ccs.debug.activeContext") != -1) { + msg = "Unable to obtain package path from CCS. Try " + + "restarting ROV after starting the debugger. " + + emsg; + } + if (dsFlag) { + throw new Error(msg); + } + } + } + ).then( + /* return ROVServer submodule */ + function() { + console.log("_connect: requesting server ROV Module from agent"); + return agent.getSubModule("ROVServer"); + } + ); +} + +/* + * ======== _getCoreName ======== + */ +function _getCoreName(dsName) +{ + var coreName = ""; + if (dsName != null) { + var k = dsName.lastIndexOf('/'); + coreName = dsName.substr(k + 1); + } + + return (coreName); +} + +/* + * ======== _getProject ======== + * Return the "current project" or the project containing exePath + * + * Returns a promise that resolves to an object containing the name of the + * current project and its location. + * + * XMLHttpRequest returns: + * 400 and an error message when a required argument is not present + * in the request. + * 500 and log the error message when there is an unexpected exception + * while servicing a request + * 200 and an empty body when there is nothing to return. Eg, if the + * findContextProject finds nothing + * 200 and a JSON object in body (with contentType header set to + * "application/json"), when there is data to return + * 404, 403, etc. in the cases where server is down for some reason, + * or when request is sent to an unknown route + */ +function _getProject(exePath) +{ + var defer = Q.defer(); + + if (!ccs7) { + defer.resolve(null); + return (defer.promise); + } + + /* get project/workspace information */ + function transferFailed(req) { + /* the request for info failed */ + return function (evt) { + var msg = "An error occurred while getting " + + req + " info: " + evt; + console.log(msg); + defer.reject(msg); + }; + } + + function reqListener(req) { + /* the request for info succeeded (maybe: 404 errors return HTML!) */ + return function() { + console.log(req + " info: " + this.responseText); + var result = {name: null, location: null}; + try { + /* TODO: throw if req.status != 200? */ + if (this.responseText != "") { + result = JSON.parse(this.responseText); + } + } + catch (e) { + /* TODO: use statusText rather than responseText? */ + defer.reject("An error occurred while getting " + + req + " info: IDE server failed: " + this.responseText); + } + defer.resolve(result); + }; + } + + /* request current project from the CCS "ide server" */ + var req = new XMLHttpRequest(); + console.log("getting project ..."); + req.addEventListener("load", reqListener("project")); + req.addEventListener("error", transferFailed("project")); + + var suffix = "/ide/findContextProject"; + if (exePath != null) { + suffix = "/ide/findOwnerProject?resourcePath=" + exePath; + } + + req.open("GET", encodeURI(location.origin + suffix)); + req.send(); + + return (defer.promise); +} + +/* + * ======== _getPackagePath ======== + * Return the package path from the current context (if provided) + * + * Returns an array consisting of the package path components, the last + * being the "./packages" sub-directory of XDCtools. + * + * If running in the context of CCS7, ask CCS, otherwise returns null. + */ +function _getPackagePath(projectName) +{ + var defer = Q.defer(); + + if (!ccs7) { + defer.resolve(null); + return (defer.promise); + } + + /* get project/workspace information */ + function transferFailed(req) { + /* the request for info failed */ + return function (evt) { + var msg = "An error occurred while getting " + + req + " info: " + evt; + console.log(msg); + defer.reject(msg); + }; + } + + function reqListener(req) { + /* the request for info succeeded (maybe: 404 errors return HTML!) */ + return function() { + console.log(req + " info: " + this.responseText); + var result = null; + try { + if (this.responseText != "") { + var obj = JSON.parse(this.responseText); + result = obj.packagePath; + } + } + catch (e) { + defer.reject("An error occurred while getting " + + req + " info: IDE server failed: " + this.responseText); + } + defer.resolve(result); + }; + } + + /* request package path from the CCS "ide server" */ + var req = new XMLHttpRequest(); + if (projectName != null && projectName != "") { + /* get path from project */ + console.log("getting package path from project '" + projectName + "'."); + req.addEventListener("load", reqListener("project")); + req.addEventListener("error", transferFailed("project")); + req.open("GET", location.origin + + "/ide/getProjectProperties?projectName=" + projectName); + } + else { + /* get path from workspace */ + console.log("getting package path from workspace"); + req.addEventListener("load", reqListener("workspace")); + req.addEventListener("error", transferFailed("workspace")); + req.open("GET", location.origin + "/ide/getBuildPreferences"); + } + req.send(); + + return (defer.promise); +} + +/* + * ======== _getSymbols ======== + * Return a non-empty set of symbol files for the specified core + * + * If the current set of symbol files is [], wait up to 5s for that to + * change. If it doesn't, fail by rejecting the returned promise. + */ +function _getSymbols(core) +{ + console.log("_getSymbols: request core's symbol files"); + var defered = Q.defer(); + deferedSymbols = defered; /* request symbol files from symbols listener */ + return (core.symbols.getSymbolFiles().then( + function (syms) { + if (syms.symbolFiles.length != 0) { + console.log("_getSymbols: canceled core.symbols request"); + deferedSymbols = null; /* cancel symbols listener request */ + defered.resolve(syms); + } + return (defered.promise.timeout(5000, + "Can't connect: Program symbols must be loaded to " + + "core '" + dsActiveCoreName + "'")); + } + )); +} + +/* + * ======== _parsePackagePath ======== + */ +function _parsePackagePath(packagePath) +{ + if (packagePath != null && packagePath.length > 0) { + var xdcroot = packagePath[packagePath.length - 1].replace(/packages$/, ""); + var xdcpath = packagePath.slice(0, packagePath.length - 1).join(';'); + return ({ + xdcroot: xdcroot, + xdcpath: xdcpath + }); + } + return ({xdcpath: null, xdcroot:null}); +} + +/* + * ======== _parseExePath ======== + * Return JSON object with path components split out into distinct items + * { + * exeName: non-null String + * connType: non-null String + * connArgs: Array of 0 or more Strings + * } + * where, + * exeName - full path of the executable + * connType - connection type: "DSLite", "Serial", "Net", ... + * connArgs - array of String values needed by the connection + * or, in the event that none are supplied, [] + * + */ +function _parseExePath(path) +{ + var result = {}; + + /* separate exe from path */ + var tokens = path.split('?'); + result.exeName = tokens[0]; + + /* separate connection from name=value pairs */ + var connection = tokens[1].split('&')[0]; + + /* split connection into type and args */ + tokens = connection.split(':'); + result.connType = tokens.shift(); + result.connArgs = tokens; + + return (result); +} + +/* + * ======== _setupCore ======== + * If the debugger is not already configured, we configure it here for the + * specified device + * + * This function is only called when we are connecting via DSLite. + * + * dbg is the a debugger object that has a list of (possibly already) + * configured cores. + * + * devName is either "" or and basename (minus extension) of a .ccxml file + * that should be used to configure the device; if devName is "" + * the debugger should already have been configured. + * + * targetEvents and obj are used to send target events generated by + * dbg.cores[0] up to the caller + * + * Returns a promise + * resolved to core 0 module with debugger connected and target running + * or + * rejected because we can't start agent or the connection is + * DSLite and we failed to get the DS submodule + * + * (Internal function) + */ +function _setupCore(dbg, devName, targetEvents, obj) +{ + var prom; + console.log("configuring one debugger core of " + dbg.cores.length + + " cores"); + if (dbg.cores.length == 0 && devName != "") { + /* if the number of cores is 0, core 0 has not already been configured + * by the user via the debugger or a second instance of ROV; so, we + * try to do it now using the .ccxml file specified by devName. + */ + prom = _configureDebugger(devName); + } + else { + var promContainer = Q.defer(); + prom = promContainer.promise; + + if (dbg.cores.length == 0) { /* and devName == "" */ + promContainer.reject(new Error( + "the debugger has not been configured for any device. " + + "Try reconnecting after connecting to the target with " + + "the debugger.")); + } + else if (devName != "") { /* and dbg.cores.length != 0 */ + /* deconfigure closes websockets connected to all cores; so, to + * properly deconfigure we must restart monserver. For now we + * skip the deconfigure step until we figure out how to manage + * the lifecycle of DSLite cores and monserver instances + */ + promContainer.reject(new Error( + "the debugger has already been configured for the device. " + + "To connect with the existing configuration, don't " + + "specify a device configuration; use just 'Debugger'.")); + } + else { /* devName == "" and dbg.cores.length != 0 */ + /* Assume that the debugger has already started for the + * right configuration. + */ + console.log("debugger is up for core " + dbg.cores[0]); + promContainer.resolve(dbg); + } + } + + /* at this point prom is either resolved as dbg, or rejected */ + return prom.then( + function(dbg) { + /* select the currently active debug core */ + var id = 0; + if (dsActiveCoreName != null) { + for (var i = 0; i < dbg.cores.length; i++) { + if (dbg.cores[i] == dsActiveCoreName) { + id = i; + break; + } + } + } + var cname = dbg.cores[id]; + + console.log("adding listeners to core[" + id + "] = '" + cname + "'"); + return ds.getSubModule(cname).then( + /* add listeners to active core */ + function(debugCore) { + console.log("adding target state halt listener"); + debugCore.targetState.waitForHalt( + function(halted) { + debuggerStatus = "TargetHalt"; + console.log("targetState halted"); + } + ); + + debugCore.addListener("refresh", + function(status) { + console.log("core 'refresh' status: " + + JSON.stringify(status, null, 3)); + debuggerStatus = status.reason; + if (targetEvents) { + targetEvents(debuggerStatus, obj); + } + } + ); + + console.log("adding target state change listener"); + debugCore.targetState.addListener("changed", + function(status) { + console.log("targetState status: " + + JSON.stringify(status, null, 3)); + if (status.description == "Running") { + debuggerStatus = "Running"; + } + else if (status.description.match(/^Disconnected/)) + { + debuggerStatus = "Disconnected"; + } + } + ); + + console.log("adding target symbols change listener"); + debugCore.symbols.addListener("changed", + function(status) { + console.log("core.symbols status: " + + JSON.stringify(status, null, 3)); + + /* resolve non-empty symbol file requests */ + if (deferedSymbols + && status.symbolFiles + && status.symbolFiles.length != 0) { + + deferedSymbols.resolve(status); + deferedSymbols = null; + console.log("core.symbols resolved request"); + } + + /* trigger ROV reloads (if necessary) */ + if (exeSet != null + && status.symbolFiles + && status.symbolFiles.length == 0) { + + exeSet = null; + location.reload(true); + } + } + ); + + return (debugCore); + } + ).then( + /* connect to and start "active" debug core */ + function(debugCore) { + var alreadyConnected = false; + + console.log("connecting to active core"); + return debugCore.targetState.connect().then( + function() { + debuggerStatus = "Connected"; + } + ).fail( + function(err) { + if (err.message != undefined + && err.message == + "Target is already connected") { + /* If we made it here with this error message, + * it means the user already started debugger + * so we are not going to call run(). We + * let the user control ROV via the debugger. + */ + debuggerStatus = "Connected"; + alreadyConnected = true; + } + else { + console.log("connect failed: " + + (err.message ? err.message : err)); + throw (err); + } + } + ).then( + function() { + if (alreadyConnected == false) { + /* try starting the core, but ignore fails */ + console.log("starting: " + debugCore); + debugCore.targetState.run().fail( + function (err) { + var msg = + err.message ? err.message : err; + console.log(debugCore + + " could not be started: " + msg); + } + ); + } + + return (debugCore); + } + ); + } + ); + } + ). + fail( + /* handle the case where original prom was rejected */ + function(err) { + var msg = "Debugger setup failed: " + + (err.message ? err.message : err); + console.log(msg); + throw new Error(msg); + } + ); +} + +/* + * ======== _validateExe ======== + */ +function _validateExe(path, files) +{ + console.log("_validateExe(" + path + ", [" + files.symbolFiles + "])"); + + var tokens = path.split('?'); /* split exe path from the connection */ + var fpath = tokens[0].replace(/\\/g, '/'); + var suffix = '?' + tokens[1]; + + var dpath = ""; + if (files.symbolFiles.length > 0) { + dpath = files.symbolFiles[0].replace(/\\/g, '/'); + } + + /* check for miracles */ + if (dpath == fpath) { + return (dpath + suffix); + } + + /* take debugger's path if it's set and nothing else if specified */ + if (dpath != "" && (fpath == "undefined" || fpath == "")) { + return (dpath + suffix); + } + + /* take specified path if it's set and the debugger is clueless */ + if (dpath == "" && (fpath != "undefined" && fpath != "")) { + return (fpath + suffix); + } + + /* else fail */ + var msg = "can't determine the executable path from input '" + + fpath + "' and debugger's '" + dpath + "'"; + + if (dpath != "" && fpath != "undefined" && fpath != "") { + msg = "debugger loaded " + dpath + + "' but '" + fpath + "' was specified."; + } + else if (dpath == "" && (fpath == "undefined" || fpath == "")) { + msg = "no executable path was specifed. Either specify the path to the executable or, if connected via CCS, load program symbols."; + } + + throw (new Error(msg)); +} |
