A 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.
- Type-Safe API: Full TypeScript support with comprehensive type definitions
- Async/Await: Modern promise-based API for better control flow
- Lazy Loading: Efficient resource management with on-demand library loading
- Error Handling: Robust error handling with detailed error messages
- Logging: Built-in debug logging for easier troubleshooting
- Documentation: Extensive JSDoc documentation for all methods
npm install tvt
import { Device } from 'tvt'
try {
// Create and initialize a new device instance
const device = await Device.create('192.168.1.100', 9008)
// Login to the device
await device.login('admin', 'password')
// Get device information
const info = await device.getInfo()
console.log(`Connected to ${info.deviceName}`)
// Capture a snapshot
await device.saveSnapshot(0, '/path/to/snapshot.jpg')
// Clean up
await device.dispose()
} catch (error) {
console.error('Error:', error)
}
- Device discovery
- Async connection management
- Authentication
- Device information retrieval
- Alarm management
- Manual alarm triggering
- Event monitoring
- Snapshot capture
- Live stream management
- Video recording
The main interface for interacting with TVT devices.
class Device {
static create(ip: string, port?: number, settings?: Settings): Promise<Device>
login(user: string, pass: string): Promise<boolean>
logout(): Promise<boolean>
getInfo(): Promise<DeviceInfo>
triggerAlarm(value: boolean): Promise<boolean>
saveSnapshot(channel: number, filePath: string): Promise<boolean>
dispose(): Promise<boolean>
// ... and more
}
See API Documentation for detailed method descriptions.
- Node.js 18 or higher
- Linux operating system (required for SDK operations)
git clone https://github.com/yourusername/tvt.git
cd tvt
npm install
npm run build
npm test
tvt/
βββ bin/ # Precompiled SDK libraries
βββ docs/ # Documentation and examples
βββ proto/ # Protocol definitions and dissectors
βββ source/ # TypeScript implementation
βββ lib/ # Core SDK implementation
βββ helpers/ # Utility functions
βββ types/ # TypeScript type definitions
- All SDK methods now return Promises and require
await
:
// Before
const info = device.info
// After
const info = await device.getInfo()
- Device creation is now async and uses a factory method:
// Before
const device = new Device('192.168.1.100')
// After
const device = await Device.create('192.168.1.100')
- Property access changes:
// Before
device.info.deviceName
// After
const info = await device.getInfo()
info.deviceName
Contributions 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.
- Follow TypeScript best practices
- Include tests for new features
- Update documentation as needed
- Follow the existing code style
This project is licensed under the MIT License - see the LICENSE file for details.
This 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.
- TVT Digital Technology for their CCTV systems
- The open-source community for various tools and libraries used in this project
- Contributors who have helped improve this SDK
- Create an issue for bug reports or feature requests