{"id":28174376,"url":"https://github.com/2bad/tvt","last_synced_at":"2025-05-15T22:16:47.360Z","repository":{"id":231641427,"uuid":"782301861","full_name":"2BAD/tvt","owner":"2BAD","description":"TypeScript SDK for TVT CCTV devices","archived":false,"fork":false,"pushed_at":"2025-05-13T13:09:00.000Z","size":26706,"stargazers_count":3,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-13T14:29:00.448Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/2BAD.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-04-05T03:00:24.000Z","updated_at":"2025-05-13T13:09:04.000Z","dependencies_parsed_at":"2025-05-05T12:43:32.556Z","dependency_job_id":null,"html_url":"https://github.com/2BAD/tvt","commit_stats":null,"previous_names":["2bad/ipc","2bad/tvt"],"tags_count":9,"template":false,"template_full_name":"2BAD/ts-lib-starter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2BAD%2Ftvt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2BAD%2Ftvt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2BAD%2Ftvt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2BAD%2Ftvt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/2BAD","download_url":"https://codeload.github.com/2BAD/tvt/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254430299,"owners_count":22069909,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-05-15T22:16:06.794Z","updated_at":"2025-05-15T22:16:47.338Z","avatar_url":"https://github.com/2BAD.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TVT Device SDK\n\n[![NPM version](https://img.shields.io/npm/v/@2bad/tvt)](https://www.npmjs.com/package/@2bad/tvt)\n[![License](https://img.shields.io/npm/l/@2bad/tvt)](https://opensource.org/license/MIT)\n[![GitHub Build Status](https://img.shields.io/github/actions/workflow/status/2BAD/tvt/build.yml)](https://github.com/2BAD/tvt/actions/workflows/build.yml)\n[![Code coverage](https://img.shields.io/codecov/c/github/2BAD/tvt)](https://codecov.io/gh/2BAD/tvt)\n[![Written in TypeScript](https://img.shields.io/github/languages/top/2BAD/tvt)](https://www.typescriptlang.org/)\n\nA modern TypeScript SDK for TVT CCTV devices, providing a clean and type-safe interface for device management, monitoring, and control. This project is the result of extensive research and reverse engineering of TVT (Tongwei Video Technology) CCTV systems.\n\n## 🌟 Features\n\n- **Type-Safe API**: Full TypeScript support with comprehensive type definitions\n- **Async/Await**: Modern promise-based API for better control flow\n- **Lazy Loading**: Efficient resource management with on-demand library loading\n- **Error Handling**: Robust error handling with detailed error messages\n- **Logging**: Built-in debug logging for easier troubleshooting\n- **Documentation**: Extensive JSDoc documentation for all methods\n\n## 📦 Installation\n\n```bash\nnpm install tvt\n```\n\n## 🚀 Quick Start\n\n```typescript\nimport { Device } from 'tvt'\n\ntry {\n  // Create and initialize a new device instance\n  const device = await Device.create('192.168.1.100', 9008)\n\n  // Login to the device\n  await device.login('admin', 'password')\n\n  // Get device information\n  const info = await device.getInfo()\n  console.log(`Connected to ${info.deviceName}`)\n\n  // Capture a snapshot\n  await device.saveSnapshot(0, '/path/to/snapshot.jpg')\n\n  // Clean up\n  await device.dispose()\n} catch (error) {\n  console.error('Error:', error)\n}\n\n```\n\n## 🔧 Core Features\n\n### Device Management\n- Device discovery\n- Async connection management\n- Authentication\n- Device information retrieval\n\n### Security Features\n- Alarm management\n- Manual alarm triggering\n- Event monitoring\n\n### Media Operations\n- Snapshot capture\n- Live stream management\n- Video recording\n\n## 📚 API Reference\n\n### Device Class\n\nThe main interface for interacting with TVT devices.\n\n```typescript\nclass Device {\n  static create(ip: string, port?: number, settings?: Settings): Promise\u003cDevice\u003e\n  login(user: string, pass: string): Promise\u003cboolean\u003e\n  logout(): Promise\u003cboolean\u003e\n  getInfo(): Promise\u003cDeviceInfo\u003e\n  triggerAlarm(value: boolean): Promise\u003cboolean\u003e\n  saveSnapshot(channel: number, filePath: string): Promise\u003cboolean\u003e\n  dispose(): Promise\u003cboolean\u003e\n  // ... and more\n}\n```\n\nSee [API Documentation](source/lib/sdk.ts) for detailed method descriptions.\n\n## 🛠️ Development\n\n### Prerequisites\n\n- Node.js 18 or higher\n- Linux operating system (required for SDK operations)\n\n### Building from Source\n\n```bash\ngit clone https://github.com/yourusername/tvt.git\ncd tvt\nnpm install\nnpm run build\n```\n\n### Running Tests\n\n```bash\nnpm test\n```\n\n## 📁 Project Structure\n\n```\ntvt/\n├── bin/            # Precompiled SDK libraries\n├── docs/           # Documentation and examples\n├── proto/          # Protocol definitions and dissectors\n└── source/         # TypeScript implementation\n    ├── lib/        # Core SDK implementation\n    ├── helpers/    # Utility functions\n    └── types/      # TypeScript type definitions\n```\n\n## 🔄 Migration from v1.x to v2.x\n\n### Breaking Changes\n\n1. All SDK methods now return Promises and require `await`:\n```typescript\n// Before\nconst info = device.info\n\n// After\nconst info = await device.getInfo()\n```\n\n2. Device creation is now async and uses a factory method:\n```typescript\n// Before\nconst device = new Device('192.168.1.100')\n\n// After\nconst device = await Device.create('192.168.1.100')\n```\n\n3. Property access changes:\n```typescript\n// Before\ndevice.info.deviceName\n\n// After\nconst info = await device.getInfo()\ninfo.deviceName\n```\n\n## 🤝 Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.\n\n### Development Guidelines\n\n1. Follow TypeScript best practices\n2. Include tests for new features\n3. Update documentation as needed\n4. Follow the existing code style\n\n## 📝 License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## ⚠️ Disclaimer\n\nThis project is not officially associated with TVT Digital Technology Co., Ltd. It is an independent implementation based on research and reverse engineering. Use at your own risk.\n\n## 🙏 Acknowledgments\n\n- TVT Digital Technology for their CCTV systems\n- The open-source community for various tools and libraries used in this project\n- Contributors who have helped improve this SDK\n\n## 📬 Support\n\n- Create an issue for bug reports or feature requests\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F2bad%2Ftvt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F2bad%2Ftvt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F2bad%2Ftvt/lists"}