12019,12019,救命啊!!!!!!!!!!

leexiaotian 2005-07-27 09:48:23
我用winInet进行通讯,我保存了HttpOpenRequest返回的句柄,当我用HttpSendRequestEx发送报头时,会出现如下错误:错误代号为,12019 ERROR_INTERNET_INCORRECT_HANDLE_STATE
The requested operation cannot be carried out because the
handle supplied is not in the correct state.
请问该如何解决啊?

...全文
88 回复 打赏 收藏 举报
写回复
回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
相关推荐
View Assessment Result: Multiple-Choice Quiz 2 Your performance was as follows: 1. The degree of a table is the number of _____ in the table. (a) keys (b) columns (c) rows (d) foreign keys Correct answer is (b) Your score on this question is: 10.00 Feedback: (b) -------------------------------------------------------------------------------- 2. The arity of a table is the number of _____ in the table. (a) keys (b) columns (c) foreign keys (d) rows Correct answer is (b) Your score on this question is: 10.00 Feedback: (b) -------------------------------------------------------------------------------- 3. What information is necessary when specifying the structure of a table? (a) the name of the table and the amount of storage space to be allocated to the table (b) the name of the table, the names of the table's attributes, the data types of the table's attributes, the formats of the table's attributes, and the maximum number of rows that the table can have (c) the name of the table and the names of the table's attributes (d) the name of the table, the names of the table's attributes, the data types of attributes, and the formats of attributes Correct answer is (d) Your score on this question is: 10.00 Feedback: (d) -------------------------------------------------------------------------------- 4. The foreign key in a table T1 _____ the same _____ as the corresponding primary key in table T2. must have, name need not have, name must have, domain (a) I, II, and III (b) I and II (c) I and III (d) II and III Correct answer is (d) Your score on this question is: 10.00 Feedback: (d) -------------------------------------------------------------------------------- 5. Which of the following SQL statements can be used to add a row to a table? (a) CREATE (b) INSERT (c) APPEND (d) ADD Correct answer is (b) Your score on this question is: 10.00 Feedback: (b) -------------------------------------------------------------------------------- 6. A difference operation can be applied to tables that (a) are union compatible (b) have the same column names (c) have the same name (d) are the same size Correct answer is (a) Your score on this question is: 10.00 Feedback: (a) -------------------------------------------------------------------------------- 7. Which of the following SQL statements can be used to create a relational table? (a) INSERT (b) ADD (c) CREATE (d) APPEND Correct answer is (c) Your score on this question is: 10.00 Feedback: (c) -------------------------------------------------------------------------------- 8. For two tables to be union compatible, the tables should be the same with respect to which of the following? (a) keys (b) cardinality (c) name (d) degree Correct answer is (d) Your score on this question is: 0.00 Feedback: (b) -------------------------------------------------------------------------------- 9. A deletion operation will _____ if the deletion leads to the violation of a referential integrity constraint. (a) fail (b) succeed with warning (c) succeed without warning (d) crash the system Correct answer is (a) Your score on this question is: 10.00 Feedback: (a) -------------------------------------------------------------------------------- 10. With Query By Example, a user enters a query by (a) filling in skeleton tables of the database with examples of what is to be retrieved (b) placing SQL keywords, such as select, under the column names they want to retrieve (c) typing a syntactically correct SQL query that uses column and table names similar to the correct column and table names in a database (d) writing an English description of the data that the user needs Correct answer is (a) Your score on this question is: 10.00 Feedback: See section 1.2.3 in the course notes. (a) -------------------------------------------------------------------------------- Go to top of assessment. Total score: 90.00 ? Copyright 2008 iCarnegie, Inc. All rights reserved. 1. In the Entity-Relationship model, the degree of a relationship specifies which of the following? (a) The cardinality ratio of the relationship (b) The number of integrity constraints required to implement the relationship (c) The number of attributes that characterize the relationship (d) The number of entities that participate in the relationship Correct answer is (d) 2. In an ER model, which of the following is true about a component attribute? (a) A component attribute is always atomic. (b) Component attributes must always be combined by an aggregation operation. (c) A component attribute can be a composite attribute. (d) A component attribute always contains other components. Correct answer is (c) 3. In the Entity-Relationship model, properties that characterize entities and relationships are modeled as (a) attributes (b) participation constraints (c) entity types (d) weak entities Correct answer is (a) 4. What is an identifying owner in an ER model? (a) The entity upon which a weak entity's existence depends (b) The relationship that identifies a weak entity's owner (c) The entity upon which a strong entity's existence depends (d) The relationship that identifies a strong entity's owner Correct answer is (a) 5. In an ER model, the cardinality ratio of a relationship type is (a) the number of instances of relationships of that relationship type (b) the number of entity types involved in that relationship type (c) the number of relationships of that relationship type in which an entity can participate (d) the minimum number of entities that can participate in that relationship type Correct answer is (c) 6. Which of the following is true about storage for derived attributes? (a) Derived attributes must not be stored. (b) Derived attributes are usually stored because storage improves retrieval performance. (c) Derived attributes must be stored. (d) Derived attributes are usually not stored because they can be computed. Correct answer is (d) 7. In an ER model, what is a recursive relationship type? (a) A never-ending type of relationship (b) The type of relationship that does not belong anywhere (c) The type of relationship between entities of one entity type (d) The relationship type where the related entities are one and the same Correct answer is (c) 8. In EER modeling, generalization is the process of generating (a) superclasses out of subclasses (b) subclasses out of superclasses (c) entities out of attributes (d) attributes out of entities Correct answer is (a) 9. When mapping from an ER model to a relational model, a strong entity is mapped into a (a) table (b) row (c) column (d) key Correct answer is (a) 10. Which of the following is true about attributes in a relational model? Attributes can be multi-valued. Attributes can be composite. (a) Both I and II (b) II only (c) Neither I nor II (d) I only Correct answer is (c) 1. In an ER model, what is a recursive relationship type? (a) The relationship type where the related entities are one and the same (b) The type of relationship that does not belong anywhere (c) The type of relationship between entities of one entity type (d) A never-ending type of relationship Correct answer is (c) 2. In an ER model, the cardinality ratio of a relationship type is (a) the number of relationships of that relationship type in which an entity can participate (b) the minimum number of entities that can participate in that relationship type (c) the number of entity types involved in that relationship type (d) the number of instances of relationships of that relationship type Correct answer is (a) 3. In the Entity-Relationship model, a derived attribute is one (a) that is composed of multiple atomic attributes (b) that characterizes a relationship instead of an entity (c) that may have multiple values simultaneously (d) whose value can be computed from the values of other attributes Correct answer is (d) 4. In the Entity-Relationship model, properties that characterize entities and relationships are modeled as (a) entity types (b) weak entities (c) attributes (d) participation constraints Correct answer is (c) 5. Which of the following is true about storage for derived attributes? (a) Derived attributes must be stored. (b) Derived attributes are usually stored because storage improves retrieval performance. (c) Derived attributes must not be stored. (d) Derived attributes are usually not stored because they can be computed. Correct answer is (d) 6. What is an identifying owner in an ER model? (a) The relationship that identifies a weak entity's owner (b) The relationship that identifies a strong entity's owner (c) The entity upon which a strong entity's existence depends (d) The entity upon which a weak entity's existence depends Correct answer is (d) 7. In an ER model, which of the following is true about a component attribute? (a) A component attribute always contains other components. (b) A component attribute can be a composite attribute. (c) A component attribute is always atomic. (d) Component attributes must always be combined by an aggregation operation. Correct answer is (b) 8. In EER modeling, generalization is the process of generating (a) attributes out of entities (b) superclasses out of subclasses (c) subclasses out of superclasses (d) entities out of attributes Correct answer is (b) 9. When mapping from an ER model to a relational model, a strong entity is mapped into a (a) key (b) row (c) column (d) table Correct answer is (d) 10. Which of the following is true about attributes in a relational model? Attributes can be multi-valued. Attributes can be composite. (a) I only (b) II only (c) Neither I nor II (d) Both I and II Correct answer is (c) 1. Through normalization, update anomalies (a) can be eliminated (b) is usually left unchanged (c) can be maximized (d) can be minimized but not eliminated Correct answer is (a) 2. Which of the following is a property (are properties) exhibited by good relational schemas? The use of null values in tuples The grouping of as many attributes as possible into one main table The elimination of data redundancy to avoid update anomalies (a) III only (b) None (c) I and II only (d) II and III only Correct answer is (a) 3. Which of the following statements concerning normal forms is true? (a) A relation that is in second normal form is also in first normal form. (b) The lower the normal form number, the better the schema design is. (c) Each normal form contains a state of independent properties, unrelated to other normal forms. (d) Schemas that are in second normal form are considered the best. Correct answer is (a) 4. Consider the following functional dependency. {A, B} -> {C} Regarding this dependency, which of the following statements is (are) true? The values of C are uniquely determined by the values of A. The values of A are uniquely determined by the values of C. (a) None (b) II only (c) I only (d) I and II Correct answer is (a) 5. Which of the following problems can be caused by data redundancy in a relational schema? Inefficient use of space Update anomalies and possible loss of data Inefficient use of processing time (a) I and II only (b) I and III only (c) I, II, and III (d) II only Correct answer is (c) 6. Consider a table with atomic attributes A, B, and C and the following functional dependencies. A -> B B -> C If the primary key of this table is attribute A, then this relation satisfies which of the following normal forms? First Second Third (a) None (b) I only (c) I, II and III (d) I and II only Correct answer is (d) 7. For a relation to be in 3NF, it should not contain _____ attribute that is transitively dependent on _____. (a) a non-primary key, a foreign key (b) a primary key, a non-primary key (c) a primary key, a foreign key (d) a non-primary key, the primary key Correct answer is (d) 8. The FD X -> Y is a full dependency in a relation R, if there is _____ attribute A that can be _____ X and the dependency still holds. (a) no, added to (b) no, removed from (c) at least one, removed from (d) at least one, added to Correct answer is (b) 9. For a relation to be in 2NF, _____ attribute must be fully functionally dependent on _____. (a) every non-primary-key, the primary key (b) every alternate key, the primary key (c) every non-key, every key (d) every non-key, at least one key Correct answer is (a) 10. The FD X -> Y is a partial dependency in a relation R, if there is _____ attribute A that can be _____ X and the dependency still holds. (a) at least one, removed from (b) at least one, added to (c) no, added to (d) no, removed from Correct answer is (a) 1. Through normalization, update anomalies (a) can be eliminated (b) is usually left unchanged (c) can be minimized but not eliminated (d) can be maximized Correct answer is (a) 2. Consider the following functional dependency. {A, B} -> {C} Regarding this dependency, which of the following statements is (are) true? The values of C are uniquely determined by the values of A. The values of A are uniquely determined by the values of C. (a) None (b) I and II (c) I only (d) II only Correct answer is (a) 3. Which of the following is a property (are properties) exhibited by good relational schemas? The use of null values in tuples The grouping of as many attributes as possible into one main table The elimination of data redundancy to avoid update anomalies (a) III only (b) None (c) II and III only (d) I and II only Correct answer is (a) 4. Through normalization, data redundancy (a) can be eliminated (b) can be maximized (c) can be minimized but not eliminated (d) are usually left unchanged Correct answer is (a) 5. Which of the following statements concerning normal forms is true? (a) A relation that is in second normal form is also in first normal form. (b) Each normal form contains a state of independent properties, unrelated to other normal forms. (c) Schemas that are in second normal form are considered the best. (d) The lower the normal form number, the better the schema design is. Correct answer is (a) 6. For a relation to be in 3NF, it should not contain _____ attribute that is transitively dependent on _____. (a) a primary key, a foreign key (b) a primary key, a non-primary key (c) a non-primary key, a foreign key (d) a non-primary key, the primary key Correct answer is (d) 7. The FD X -> Y is a full dependency in a relation R, if there is _____ attribute A that can be _____ X and the dependency still holds. (a) no, removed from (b) at least one, removed from (c) at least one, added to (d) no, added to Correct answer is (a) 8. Consider a table with atomic attributes A, B, and C and the following functional dependencies. A -> B B -> C If the primary key of this table is attribute A, then this relation satisfies which of the following normal forms? First Second Third (a) I, II and III (b) None (c) I and II only (d) I only Correct answer is (c) 9. For a relation to be in 2NF, _____ attribute must be fully functionally dependent on _____. (a) every alternate key, the primary key (b) every non-key, at least one key (c) every non-key, every key (d) every non-primary-key, the primary key Correct answer is (d) 10. The FD X -> Y is a partial dependency in a relation R, if there is _____ attribute A that can be _____ X and the dependency still holds. (a) no, added to (b) no, removed from (c) at least one, added to (d) at least one, removed from Correct answer is (d) 1. What is an identifying owner in an ER model? (a) The entity upon which a weak entity's existence depends (b) The relationship that identifies a weak entity's owner (c) The relationship that identifies a strong entity's owner (d) The entity upon which a strong entity's existence depends Correct answer is (a) 2. In an ER model, the cardinality ratio of a relationship type is (a) the minimum number of entities that can participate in that relationship type (b) the number of instances of relationships of that relationship type (c) the number of entity types involved in that relationship type (d) the number of relationships of that relationship type in which an entity can participate Correct answer is (d) 3. In the Entity-Relationship model, properties that characterize entities and relationships are modeled as (a) entity types (b) participation constraints (c) weak entities (d) attributes Correct answer is (d) 4. In an ER model, what is a recursive relationship type? (a) A never-ending type of relationship (b) The relationship type where the related entities are one and the same (c) The type of relationship between entities of one entity type (d) The type of relationship that does not belong anywhere Correct answer is (c) 5. In the Entity-Relationship model, a derived attribute is one (a) that characterizes a relationship instead of an entity (b) that may have multiple values simultaneously (c) whose value can be computed from the values of other attributes (d) that is composed of multiple atomic attributes Correct answer is (c) 6. In the Entity-Relationship model, the degree of a relationship specifies which of the following? (a) The number of attributes that characterize the relationship (b) The number of entities that participate in the relationship (c) The cardinality ratio of the relationship (d) The number of integrity constraints required to implement the relationship Correct answer is (b) 7. Which of the following is true about storage for derived attributes? (a) Derived attributes are usually not stored because they can be computed. (b) Derived attributes are usually stored because storage improves retrieval performance. (c) Derived attributes must be stored. (d) Derived attributes must not be stored. Correct answer is (a) 8. In EER modeling, generalization is the process of generating (a) superclasses out of subclasses (b) entities out of attributes (c) subclasses out of superclasses (d) attributes out of entities Correct answer is (a) 9. When mapping from an ER model to a relational model, a strong entity is mapped into a (a) key (b) table (c) row (d) column Correct answer is (b) 10. Which of the following is true about attributes in a relational model? Attributes can be multi-valued. Attributes can be composite. (a) II only (b) I only (c) Both I and II (d) Neither I nor II Correct answer is (d) 1. Which of the following is true about storage for derived attributes? (a) Derived attributes are usually stored because storage improves retrieval performance. (b) Derived attributes must be stored. (c) Derived attributes are usually not stored because they can be computed. (d) Derived attributes must not be stored. Correct answer is (c) 2. In an ER model, the cardinality ratio of a relationship type is (a) the minimum number of entities that can participate in that relationship type (b) the number of entity types involved in that relationship type (c) the number of relationships of that relationship type in which an entity can participate (d) the number of instances of relationships of that relationship type Correct answer is (c) 3. In the Entity-Relationship model, the degree of a relationship specifies which of the following? (a) The number of attributes that characterize the relationship (b) The number of integrity constraints required to implement the relationship (c) The cardinality ratio of the relationship (d) The number of entities that participate in the relationship Correct answer is (d) 4. In the Entity-Relationship model, properties that characterize entities and relationships are modeled as (a) weak entities (b) participation constraints (c) attributes (d) entity types Correct answer is (c) Your score on this question is: 0.00 5. A weak entity type implies a (a) weak relationship type (b) relationship with total participation constraint (c) strong relationship type (d) relationship with partial participation constraint Correct answer is (b) 6. In an ER model, which of the following is true about a component attribute? (a) A component attribute can be a composite attribute. (b) Component attributes must always be combined by an aggregation operation. (c) A component attribute always contains other components. (d) A component attribute is always atomic. Correct answer is (a) 7. In the Entity-Relationship model, a derived attribute is one (a) that characterizes a relationship instead of an entity (b) that is composed of multiple atomic attributes (c) whose value can be computed from the values of other attributes (d) that may have multiple values simultaneously Correct answer is (c) 1. Through normalization, update anomalies (a) is usually left unchanged (b) can be minimized but not eliminated (c) can be maximized (d) can be eliminated Correct answer is (d) 2. Which of the following problems can be caused by data redundancy in a relational schema? Inefficient use of space Update anomalies and possible loss of data Inefficient use of processing time (a) I and II only (b) I and III only (c) II only (d) I, II, and III Correct answer is (d) 3. Consider the following functional dependency. {A, B} -> {C} Regarding this dependency, which of the following statements is (are) true? The values of C are uniquely determined by the values of A. The values of A are uniquely determined by the values of C. (a) I only (b) I and II (c) II only (d) None Correct answer is (d) 4. Which of the following is a property (are properties) exhibited by good relational schemas? The use of null values in tuples The grouping of as many attributes as possible into one main table The elimination of data redundancy to avoid update anomalies (a) III only (b) II and III only (c) I and II only (d) None Correct answer is (a) 5. Which of the following statements concerning normal forms is true? (a) Schemas that are in second normal form are considered the best. (b) Each normal form contains a state of independent properties, unrelated to other normal forms. (c) A relation that is in second normal form is also in first normal form. (d) The lower the normal form number, the better the schema design is. Correct answer is (c) 6. The FD X -> Y is a partial dependency in a relation R, if there is _____ attribute A that can be _____ X and the dependency still holds. (a) at least one, added to (b) at least one, removed from (c) no, removed from (d) no, added to Correct answer is (b) 7. For a relation to be in 2NF, _____ attribute must be fully functionally dependent on _____. (a) every non-primary-key, the primary key (b) every non-key, at least one key (c) every non-key, every key (d) every alternate key, the primary key Correct answer is (a) 8. Consider a table with atomic attributes A, B, and C and the following functional dependencies. A -> B B -> C If the primary key of this table is attribute A, then this relation satisfies which of the following normal forms? First Second Third (a) I only (b) None (c) I and II only (d) I, II and III Correct answer is (c) 9. The FD X -> Y is a full dependency in a relation R, if there is _____ attribute A that can be _____ X and the dependency still holds. (a) no, removed from (b) at least one, removed from (c) at least one, added to (d) no, added to Correct answer is (a) 10. For a relation to be in 3NF, it should not contain _____ attribute that is transitively dependent on _____. (a) a primary key, a foreign key (b) a non-primary key, a foreign key (c) a non-primary key, the primary key (d) a primary key, a non-primary key Correct answer is (c) 1. Which of the following statements concerning normal forms is true? (a) The lower the normal form number, the better the schema design is. (b) A relation that is in second normal form is also in first normal form. (c) Schemas that are in second normal form are considered the best. (d) Each normal form contains a state of independent properties, unrelated to other normal forms. Correct answer is (b) 2. Consider the following functional dependency. {A, B} -> {C} Regarding this dependency, which of the following statements is (are) true? The values of C are uniquely determined by the values of A. The values of A are uniquely determined by the values of C. (a) I only (b) II only (c) I and II (d) None Correct answer is (d) 3. Which of the following problems can be caused by data redundancy in a relational schema? Inefficient use of space Update anomalies and possible loss of data Inefficient use of processing time (a) I, II, and III (b) I and II only (c) I and III only (d) II only Correct answer is (a) Y 4. Through normalization, update anomalies (a) can be eliminated (b) can be maximized (c) is usually left unchanged (d) can be minimized but not eliminated Correct answer is (a) 5. Which of the following is a property (are properties) exhibited by good relational schemas? The use of null values in tuples The grouping of as many attributes as possible into one main table The elimination of data redundancy to avoid update anomalies (a) I and II only (b) III only (c) None (d) II and III only Correct answer is (b) 6. Consider a table with atomic attributes A, B, and C and the following functional dependencies. A -> B B -> C If the primary key of this table is attribute A, then this relation satisfies which of the following normal forms? First Second Third (a) I and II only (b) I only (c) I, II and III (d) None Correct answer is (a) 7. For a relation to be in 3NF, it should not contain _____ attribute that is transitively dependent on _____. (a) a non-primary key, a foreign key (b) a primary key, a foreign key (c) a primary key, a non-primary key (d) a non-primary key, the primary key Correct answer is (d) 8. The FD X -> Y is a partial dependency in a relation R, if there is _____ attribute A that can be _____ X and the dependency still holds. (a) at least one, added to (b) no, removed from (c) no, added to (d) at least one, removed from Correct answer is (d) 9. For a relation to be in 2NF, _____ attribute must be fully functionally dependent on _____. (a) every non-primary-key, the primary key (b) every alternate key, the primary key (c) every non-key, every key (d) every non-key, at least one key Correct answer is (a) 10. The FD X -> Y is a full dependency in a relation R, if there is _____ attribute A that can be _____ X and the dependency still holds. (a) no, added to (b) at least one, removed from (c) at least one, added to (d) no, removed from Correct answer is (d) 1. In an ER model, which of the following is true about a composite attribute? (a) A composite attribute can have a method attached to it. (b) A composite attribute cannot be broken into more basic attributes. (c) A composite attribute can be broken into more basic attributes. (d) A composite attribute can only be designed by users with special privileges. Correct answer is (c) 2. The term physical data independence refers to the ability to change (a) the physical layout of the data without changing the external schemas, the conceptual schemas, or the application programs (b) the data without physically relocating the tables (c) the conceptual schema without changing the application programs (d) the application programs without changing the conceptual schema Correct answer is (a) 3. What attributes does a subclass have? (a) None of the attributes of its superclass (b) All the attributes of its superclass, and possibly more (c) Just the attributes from the superclass (d) A subset of the attributes of its superclass Correct answer is (b) 4. If X -> Y, which of the following would make Y fully dependent on X? (a) Y is a single attribute (b) X is a single attribute (c) X consists of multiple attributes (d) Y consists of multiple attributes Correct answer is (b) 5. In an ER model, what is the degree of a relationship type? (a) The validity of the relationship type (b) The strength of the relationship type (c) The number of entity types participating in the relationship type (d) The number of instances of the relationship type Correct answer is (c) 6. Database design typically consists of which of the following phases? Conceptual design Logical design Physical design (a) II only (b) I, II, and III (c) II and III only (d) I only Correct answer is (b) 7. A relational schema is in first normal form, if the domain of all of its (a) primary keys are not multi-valued (b) primary keys and alternate keys are not multi-valued (c) primary keys are not composite (d) attributes can take on only atomic values Correct answer is (d) 8. In an ER model, a derived attribute is one whose values (a) have been derived at some time in the past (b) can be derived from the values of some other attributes (c) can be derived from the system tables (d) can be derived from another table Correct answer is (b) 9. Y is transitively dependent on X, if (a) X -> Y and A -> Y (b) X -> A, B and A -> Y (c) X -> Y and Y -> A (d) X -> A, B and Y -> A, B Correct answer is (b) 10. Relationships in an ER model are primarily translated to which of the following in a relational model? (a) relationships (b) primary keys and foreign keys (c) three-way tables (d) dummy relationship tables Correct answer is (b) View Assessment Result With Query By Example, a user enters a query by (a) filling in skeleton tables of the database with examples of what is to be retrieved (b) placing SQL keywords, such as select, under the column names they want to retrieve (c) writing an English description of the data that the user needs (d) typing a syntactically correct SQL query that uses column and table names similar to the correct column and table names in a database F Your performance was as follows: You took 2 minutes on this assessment from Tue Mar 17 05:22:13 UTC+0800 2009 to Tue Mar 17 05:24:13 UTC+0800 2009. Total score: 100.00 1. An E-Commerce system consists of the following components. Which of the same components must be included in a database management system? 1 The data, such as information about the goods available for sale, customers, orders placed, shipping information, etc. 2 A collection of programs must be included that control the data, such as programs to create, maintain, and manipulate the data. These programs can be easily used to create, maintain, and manipulate data in other domains, such as in a library information system. 3 A collection of programs that operate on the data, but are specific to the E-commerce system. These programs enable users to browse through the store-items, place orders, track shipping, etc. (a) II only (b) I, II, and III (c) I only (d) II and III only Correct answer is (a) Your score on this question is: 14.29 Feedback: A DBMS refers to just the set of general-purpose programs to control data. (a) 2. An E-Commerce system consists of the following components. Which of these same components will constitute a database system? 4 The data, such as information about the goods available for sale, customers, orders placed, shipping information, etc. 5 A collection of programs that control the data, such as programs to create, maintain, and manipulate the data constitutes a database system. These programs can be easily used to create, maintain, and manipulate data in other domains such as in a library information system. 6 A collection of programs that operate on the data, but are specific to the E-commerce system, constitutes a database system. These programs enable users to browse through the store-items, place orders, track shipping, etc. (a) I only (b) I, II, and III (c) I and II only (d) II only Correct answer is (b) Your score on this question is: 14.29 Feedback: A database system includes the data, the DBMS, and the application-specific programs that operate on that data. (b) 3. An E-Commerce system consists of the following components. Which of these same components must be included in a database? 7 The data, such as information about the goods available for sale, customers, orders placed, shipping information, etc. 8 A database must include a collection of programs that control the data, such as programs to create, maintain, and manipulate the data. These programs can be easily used to create, maintain, and manipulate data in other domains. 9 A database must include a collection of programs that operate on the data, but are specific to the E-commerce system. These programs enable users to browse through the store-items, place orders, track shipping, etc. (a) I and II only (b) I only (c) II only (d) I, II, and III Correct answer is (b) Your score on this question is: 14.29 Feedback: Database refers to just the data (b) 4. An E-Commerce database contains data about customers, products, orders, system response times, etc. Which of the following can be specified as integrity constraints in an E-Commerce database system? 10 No two products can have the same product ID. 11 The DBMS response time for all Web requests should be at most 2 seconds. 12 A customer order cannot have more than one shipping address. (a) I and III only (b) I and II only (c) I only (d) I, II, and III Correct answer is (a) Your score on this question is: 14.29 Feedback: The constraints I, II and III specify the application semantics of the data captured in the E-Commerce database. Constraint II, although it seems contrary to common sense, is not something that can be prohibited by the DBMS because the DBMS is general purpose. The response time of the DBMS cannot be enforced by the DBMS. It depends on factors such the processor speed, memory available, etc. (a) 5. In a database system, whose responsibility is it to provide data consistency? (a) the user's (b) the application programmer's (c) the DBMS's (d) the database administrator's Correct answer is (c) Your score on this question is: 14.29 Feedback: (c) 6. A database is needed for which of the following application scenarios? 13 A video store that needs to keep track of data about members, about videos carried by the store, about videos rented by members, as well as data concerning borrow-date, return-date, and payment information. 14 In the human resources department of a company, information about employees, their titles, their salaries and sick days, and about vacation days taken by each employee. 15 A computer-simulated video game which needs to calculate and display, the physical (x, y) location of each actor in the game, the speed with which they are moving at the current instant, the direction in which they are moving, the action they are performing, the angle at which the game-player is viewing the scene. (a) I only (b) I, II, and III (c) I and II only (d) I and III only Correct answer is (c) Your score on this question is: 14.29 Feedback: (c) 7. The physical storage structure will be _____ to the application programmer in a database approach, and will be _____ to the application programmer in a file system approach. (a) hidden, hidden (b) hidden, visible (c) visible, visible (d) visible, hidden Correct answer is (b) Your score on this question is: 14.29 Feedback: The layer of abstraction offered by a DBMS hides the physical storage structure from the application programmer. (b) Go to top of assessment. Total score: 100.00 Your performance was as follows: You took 3 minutes on this assessment from Tue Mar 17 04:27:27 UTC+0800 2009 to Tue Mar 17 04:30:02 UTC+0800 2009. Total score: 85.71 1. An E-Commerce system consists of the following components. Which of these same components must be included in a database? 1 The data, such as information about the goods available for sale, customers, orders placed, shipping information, etc. 2 A database must include a collection of programs that control the data, such as programs to create, maintain, and manipulate the data. These programs can be easily used to create, maintain, and manipulate data in other domains. 3 A database must include a collection of programs that operate on the data, but are specific to the E-commerce system. These programs enable users to browse through the store-items, place orders, track shipping, etc. (a) II only (b) I and II only (c) I only (d) I, II, and III Correct answer is (c) Your score on this question is: 14.29 Feedback: Database refers to just the data (c) 2. In a database system, whose responsibility is it to provide data consistency? (a) the database administrator's (b) the user's (c) the application programmer's (d) the DBMS's Correct answer is (d) Your score on this question is: 14.29 Feedback: (d) 3. An E-Commerce system consists of the following components. Which of these same components will constitute a database system? 4 The data, such as information about the goods available for sale, customers, orders placed, shipping information, etc. 5 A collection of programs that control the data, such as programs to create, maintain, and manipulate the data constitutes a database system. These programs can be easily used to create, maintain, and manipulate data in other domains such as in a library information system. 6 A collection of programs that operate on the data, but are specific to the E-commerce system, constitutes a database system. These programs enable users to browse through the store-items, place orders, track shipping, etc. (a) I, II, and III (b) I only (c) I and II only (d) II only Correct answer is (a) Your score on this question is: 14.29 Feedback: A database system includes the data, the DBMS, and the application-specific programs that operate on that data. (a) 4. An E-Commerce system consists of the following components. Which of the same components must be included in a database management system? 7 The data, such as information about the goods available for sale, customers, orders placed, shipping information, etc. 8 A collection of programs must be included that control the data, such as programs to create, maintain, and manipulate the data. These programs can be easily used to create, maintain, and manipulate data in other domains, such as in a library information system. 9 A collection of programs that operate on the data, but are specific to the E-commerce system. These programs enable users to browse through the store-items, place orders, track shipping, etc. (a) I only (b) I, II, and III (c) II only (d) II and III only Correct answer is (c) Your score on this question is: 0.00 Feedback: A DBMS refers to just the set of general-purpose programs to control data. (d) 5. An E-Commerce database contains data about customers, products, orders, system response times, etc. Which of the following can be specified as integrity constraints in an E-Commerce database system? 10 No two products can have the same product ID. 11 The DBMS response time for all Web requests should be at most 2 seconds. 12 A customer order cannot have more than one shipping address. (a) I, II, and III (b) I only (c) I and II only (d) I and III only Correct answer is (d) Your score on this question is: 14.29 Feedback: The constraints I, II and III specify the application semantics of the data captured in the E-Commerce database. Constraint II, although it seems contrary to common sense, is not something that can be prohibited by the DBMS because the DBMS is general purpose. The response time of the DBMS cannot be enforced by the DBMS. It depends on factors such the processor speed, memory available, etc. (d) 6. A database is needed for which of the following application scenarios? 13 A video store that needs to keep track of data about members, about videos carried by the store, about videos rented by members, as well as data concerning borrow-date, return-date, and payment information. 14 In the human resources department of a company, information about employees, their titles, their salaries and sick days, and about vacation days taken by each employee. 15 A computer-simulated video game which needs to calculate and display, the physical (x, y) location of each actor in the game, the speed with which they are moving at the current instant, the direction in which they are moving, the action they are performing, the angle at which the game-player is viewing the scene. (a) I and II only (b) I only (c) I, II, and III (d) I and III only Correct answer is (a) Your score on this question is: 14.29 Feedback: (a) 7. The physical storage structure will be _____ to the application programmer in a database approach, and will be _____ to the application programmer in a file system approach. (a) visible, hidden (b) hidden, hidden (c) hidden, visible (d) visible, visible Correct answer is (c) Your score on this question is: 14.29 Feedback: The layer of abstraction offered by a DBMS hides the physical storage structure from the application programmer. (c) Go to top of assessment. Total score: 85.71 Total score: 42.86 1. An E-Commerce system consists of the following components. Which of these same components must be included in a database? 1 The data, such as information about the goods available for sale, customers, orders placed, shipping information, etc. 2 A database must include a collection of programs that control the data, such as programs to create, maintain, and manipulate the data. These programs can be easily used to create, maintain, and manipulate data in other domains. 3 A database must include a collection of programs that operate on the data, but are specific to the E-commerce system. These programs enable users to browse through the store-items, place orders, track shipping, etc. (a) I and II only (b) I only (c) II only (d) I, II, and III Correct answer is (b) Your score on this question is: 14.29 Feedback: Database refers to just the data (b) 2. In a database system, whose responsibility is it to provide data consistency? (a) the DBMS's (b) the user's (c) the application programmer's (d) the database administrator's Correct answer is (a) Your score on this question is: 0.00 Feedback: (d) 3. An E-Commerce system consists of the following components. Which of these same components will constitute a database system? 4 The data, such as information about the goods available for sale, customers, orders placed, shipping information, etc. 5 A collection of programs that control the data, such as programs to create, maintain, and manipulate the data constitutes a database system. These programs can be easily used to create, maintain, and manipulate data in other domains such as in a library information system. 6 A collection of programs that operate on the data, but are specific to the E-commerce system, constitutes a database system. These programs enable users to browse through the store-items, place orders, track shipping, etc. (a) II only (b) I and II only (c) I, II, and III (d) I only Correct answer is (c) Your score on this question is: 0.00 Feedback: A database system includes the data, the DBMS, and the application-specific programs that operate on that data. (a) 4. An E-Commerce system consists of the following components. Which of the same components must be included in a database management system? 7 The data, such as information about the goods available for sale, customers, orders placed, shipping information, etc. 8 A collection of programs must be included that control the data, such as programs to create, maintain, and manipulate the data. These programs can be easily used to create, maintain, and manipulate data in other domains, such as in a library information system. 9 A collection of programs that operate on the data, but are specific to the E-commerce system. These programs enable users to browse through the store-items, place orders, track shipping, etc. (a) I, II, and III (b) II only (c) I only (d) II and III only Correct answer is (b) Your score on this question is: 0.00 Feedback: A DBMS refers to just the set of general-purpose programs to control data. (d) 5. An E-Commerce database contains data about customers, products, orders, system response times, etc. Which of the following can be specified as integrity constraints in an E-Commerce database system? 10 No two products can have the same product ID. 11 The DBMS response time for all Web requests should be at most 2 seconds. 12 A customer order cannot have more than one shipping address. (a) I only (b) I and III only (c) I and II only (d) I, II, and III Correct answer is (b) Your score on this question is: 0.00 Feedback: The constraints I, II and III specify the application semantics of the data captured in the E-Commerce database. Constraint II, although it seems contrary to common sense, is not something that can be prohibited by the DBMS because the DBMS is general purpose. The response time of the DBMS cannot be enforced by the DBMS. It depends on factors such the processor speed, memory available, etc. (d) 6. A database is needed for which of the following application scenarios? 13 A video store that needs to keep track of data about members, about videos carried by the store, about videos rented by members, as well as data concerning borrow-date, return-date, and payment information. 14 In the human resources department of a company, information about employees, their titles, their salaries and sick days, and about vacation days taken by each employee. 15 A computer-simulated video game which needs to calculate and display, the physical (x, y) location of each actor in the game, the speed with which they are moving at the current instant, the direction in which they are moving, the action they are performing, the angle at which the game-player is viewing the scene. (a) I only (b) I and II only (c) I, II, and III (d) I and III only Correct answer is (b) Your score on this question is: 14.29 Feedback: (b) 7. The physical storage structure will be _____ to the application programmer in a database approach, and will be _____ to the application programmer in a file system approach. (a) visible, visible (b) visible, hidden (c) hidden, visible (d) hidden, hidden Correct answer is (c) Your score on this question is: 14.29 Feedback: The layer of abstraction offered by a DBMS hides the physical storage structure from the application programmer. (c) Go to top of assessment. The arity of a table is the number of _____ in the table. (a) rows (b) columns (c) keys (d) foreign keys Correct answer is (b) Your score on this question is: 10.00 Feedback: 2. The cardinality of a table is the number of _____ in the table. (a) rows (b) foreign keys (c) keys (d) columns Correct answer is (a) Your score on this question is: 10.00 Feedback: 3. The degree of a table is the number of _____ in the table. (a) rows (b) columns (c) foreign keys (d) keys Correct answer is (b) Your score on this question is: 10.00 Feedback: 4. The foreign key in a table T1 _____ the same _____ as the corresponding primary key in table T2. 1 must have, name 2 need not have, name 3 must have, domain (a) I and III (b) II and III (c) I, II, and III (d) I and II Correct answer is (b) Your score on this question is: 10.00 Feedback: 5. The SQL clause to perform a set UNION operation is (a) MELD (b) UNITE (c) UNION (d) COMBINE Correct answer is (c) Your score on this question is: 10.00 Feedback: 6. DML is used to (a) manipulate the structure of database applications. (b) add/modify/delete data in the database. (c) specify the structure of a database. (d) add and delete tables. Correct answer is (b) Your score on this question is: 10.00 Feedback: 7. DDL is used to (a) specify the structure of a database. (b) add contents to tables. (c) access the contents of tables. (d) define the structure of database applications. Correct answer is (a) Your score on this question is: 10.00 Feedback: 8. Which of the following SQL statements can be used to create a relational table? (a) APPEND (b) CREATE (c) ADD (d) INSERT Correct answer is (b) Your score on this question is: 10.00 Feedback: 9. Which of the following SQL statements can be used to modify just one row (out of many rows) in a table? (a) CHANGE (b) UPDATE (c) ALTER (d) MODIFY Correct answer is (b) Your score on this question is: 0.00 Feedback: 10. The term query by example refers to (a) a visual query language developed by IBM (b) a query for SQL examples (c) example SQL queries provided by the DBMS that users can modify to suit their current needs (d) example SQL queries provided by other users that can be modified to suit current needs Correct answer is (a) Your score on this question is: 10.00 Feedback: See section 1.2.3 in the course notes. Your performance was as follows: You took 4 minutes on this assessment from Wed Mar 29 08:46:41 UTC+0800 2006 to Wed Mar 29 08:50:36 UTC+0800 2006. Total score: 90.00 1. What information is necessary when specifying the structure of a table? (a) the name of the table, the names of the table's attributes, the data types of attributes, and the formats of attributes (b) the name of the table, the names of the table's attributes, the data types of the table's attributes, the formats of the table's attributes, and the maximum number of rows that the table can have (c) the name of the table and the names of the table's attributes (d) the name of the table and the amount of storage space to be allocated to the table Correct answer is (a) Your score on this question is: 0.00 Feedback: 2. The cardinality of a table is the number of _____ in the table. (a) columns (b) foreign keys (c) rows (d) keys Correct answer is (c) Your score on this question is: 10.00 Feedback: 3. The arity of a table is the number of _____ in the table. (a) foreign keys (b) keys (c) rows (d) columns Correct answer is (d) Your score on this question is: 10.00 Feedback: 4. The degree of a table is the number of _____ in the table. (a) rows (b) foreign keys (c) columns (d) keys Correct answer is (c) Your score on this question is: 10.00 Feedback: 5. A difference operation can be applied to tables that (a) are union compatible (b) have the same name (c) are the same size (d) have the same column names Correct answer is (a) Your score on this question is: 10.00 Feedback: 6. Which of the following SQL statements can be used to remove a row from a table? (a) DESTROY (b) DELETE (c) ERASE (d) REMOVE Correct answer is (b) Your score on this question is: 10.00 Feedback: 7. DML is used to (a) add/modify/delete data in the database. (b) add and delete tables. (c) manipulate the structure of database applications. (d) specify the structure of a database. Correct answer is (a) Your score on this question is: 10.00 Feedback: 8. A deletion operation will _____ if the deletion leads to the violation of a referential integrity constraint. (a) fail (b) succeed with warning (c) succeed without warning (d) crash the system Correct answer is (a) Your score on this question is: 10.00 Feedback: 9. DDL is used to (a) access the contents of tables. (b) add contents to tables. (c) define the structure of database applications. (d) specify the structure of a database. Correct answer is (d) Your score on this question is: 10.00 Feedback: 10. With Query By Example, a user enters a query by (a) writing an English description of the data that the user needs (b) typing a syntactically correct SQL query that uses column and table names similar to the correct column and table names in a database (c) filling in skeleton tables of the database with examples of what is to be retrieved (d) placing SQL keywords, such as select, under the column names they want to retrieve Correct answer is (c) Your score on this question is: 10.00 1. What information is necessary when specifying the structure of a table? (a) the name of the table, the names of the table's attributes, the data types of attributes, and the formats of attributes (b) the name of the table, the names of the table's attributes, the data types of the table's attributes, the formats of the table's attributes, and the maximum number of rows that the table can have (c) the name of the table and the names of the table's attributes (d) the name of the table and the amount of storage space to be allocated to the table Correct answer is (a) Your score on this question is: 0.00 Feedback: 2. The cardinality of a table is the number of _____ in the table. (a) columns (b) foreign keys (c) rows (d) keys Correct answer is (c) Your score on this question is: 10.00 Feedback: 3. The arity of a table is the number of _____ in the table. (a) foreign keys (b) keys (c) rows (d) columns Correct answer is (d) Your score on this question is: 10.00 Feedback: 4. The degree of a table is the number of _____ in the table. (a) rows (b) foreign keys (c) columns (d) keys Correct answer is (c) Your score on this question is: 10.00 Feedback: 5. A difference operation can be applied to tables that (a) are union compatible (b) have the same name (c) are the same size (d) have the same column names Correct answer is (a) Your score on this question is: 10.00 Feedback: 6. Which of the following SQL statements can be used to remove a row from a table? (a) DESTROY (b) DELETE (c) ERASE (d) REMOVE Correct answer is (b) Your score on this question is: 10.00 Feedback: 7. DML is used to (a) add/modify/delete data in the database. (b) add and delete tables. (c) manipulate the structure of database applications. (d) specify the structure of a database. Correct answer is (a) Your score on this question is: 10.00 Feedback: 8. A deletion operation will _____ if the deletion leads to the violation of a referential integrity constraint. (a) fail (b) succeed with warning (c) succeed without warning (d) crash the system Correct answer is (a) Your score on this question is: 10.00 Feedback: 9. DDL is used to (a) access the contents of tables. (b) add contents to tables. (c) define the structure of database applications. (d) specify the structure of a database. Correct answer is (d) Your score on this question is: 10.00 Feedback: 10. With Query By Example, a user enters a query by (a) writing an English description of the data that the user needs (b) typing a syntactically correct SQL query that uses column and table names similar to the correct column and table names in a database (c) filling in skeleton tables of the database with examples of what is to be retrieved (d) placing SQL keywords, such as select, under the column names they want to retrieve Correct answer is (c) The cardinality of a table is the number of _____ in the table. (a) rows (b) keys (c) foreign keys (d) columns Correct answer is (a) Your score on this question is: 10.00 Feedback: 2. The foreign key in a table T1 _____ the same _____ as the corresponding primary key in table T2. 1 must have, name 2 need not have, name 3 must have, domain (a) I and II (b) I, II, and III (c) II and III (d) I and III Correct answer is (c) Your score on this question is: 10.00 Feedback: 3. What information is necessary when specifying the structure of a table? (a) the name of the table and the names of the table's attributes (b) the name of the table, the names of the table's attributes, the data types of attributes, and the formats of attributes (c) the name of the table, the names of the table's attributes, the data types of the table's attributes, the formats of the table's attributes, and the maximum number of rows that the table can have (d) the name of the table and the amount of storage space to be allocated to the table Correct answer is (b) Your score on this question is: 10.00 Feedback: 4. The arity of a table is the number of _____ in the table. (a) columns (b) foreign keys (c) keys (d) rows Correct answer is (a) Your score on this question is: 10.00 Feedback: 5. A difference operation can be applied to tables that (a) are union compatible (b) are the same size (c) have the same name (d) have the same column names Correct answer is (a) Your score on this question is: 10.00 Feedback: 6. What can be specified in the selection condition of a SELECT statement? (a) a Boolean operation (b) an arithmetic operation (c) the conditions under which the statement should be executed (d) the time at which the selection should be performed Correct answer is (a) Your score on this question is: 0.00 Feedback: 7. The SQL clause to perform a set UNION operation is (a) MELD (b) UNION (c) UNITE (d) COMBINE Correct answer is (b) Your score on this question is: 10.00 Feedback: 8. Which of the following SQL statements can be used to add a row to a table? (a) APPEND (b) CREATE (c) ADD (d) INSERT Correct answer is (d) Your score on this question is: 10.00 Feedback: 9. A join operation joins _____ tables into _____. (a) two, one (b) four, two (c) three, one (d) three, two Correct answer is (a) Your score on this question is: 10.00 Feedback: 10. With Query By Example, a user enters a query by (a) placing SQL keywords, such as select, under the column names they want to retrieve (b) writing an English description of the data that the user needs (c) typing a syntactically correct SQL query that uses column and table names similar to the correct column and table names in a database (d) filling in skeleton tables of the database with examples of what is to be retrieved Correct answer is (d) Your score on this question is: 10.00 The degree of a table is the number of _____ in the table. (a) foreign keys (b) columns (c) rows (d) keys Correct answer is (b) Your score on this question is: 10.00 Feedback: 2. The arity of a table is the number of _____ in the table. (a) rows (b) keys (c) columns (d) foreign keys Correct answer is (c) Your score on this question is: 10.00 Feedback: 3. What information is necessary when specifying the structure of a table? (a) the name of the table and the amount of storage space to be allocated to the table (b) the name of the table and the names of the table's attributes (c) the name of the table, the names of the table's attributes, the data types of the table's attributes, the formats of the table's attributes, and the maximum number of rows that the table can have (d) the name of the table, the names of the table's attributes, the data types of attributes, and the formats of attributes Correct answer is (d) Your score on this question is: 10.00 Feedback: 4. The cardinality of a table is the number of _____ in the table. (a) foreign keys (b) columns (c) keys (d) rows Correct answer is (d) Your score on this question is: 10.00 Feedback: 5. DML is used to (a) specify the structure of a database. (b) add and delete tables. (c) manipulate the structure of database applications. (d) add/modify/delete data in the database. Correct answer is (d) Your score on this question is: 10.00 Feedback: 6. The SQL clause to perform a set UNION operation is (a) COMBINE (b) UNION (c) UNITE (d) MELD Correct answer is (b) Your score on this question is: 10.00 Feedback: 7. Which of the following SQL statements can be used to create a relational table? (a) ADD (b) APPEND (c) CREATE (d) INSERT Correct answer is (c) Your score on this question is: 10.00 Feedback: 8. DDL is used to (a) access the contents of tables. (b) specify the structure of a database. (c) add contents to tables. (d) define the structure of database applications. Correct answer is (b) Your score on this question is: 10.00 Feedback: 9. What can be specified in the selection condition of a SELECT statement? (a) the time at which the selection should be performed (b) an arithmetic operation (c) the conditions under which the statement should be executed (d) a Boolean operation Correct answer is (d) Your score on this question is: 10.00 Feedback: 10. The term query by example refers to (a) a query for SQL examples (b) example SQL queries provided by other users that can be modified to suit current needs (c) a visual query language developed by IBM (d) example SQL queries provided by the DBMS that users can modify to suit their current needs Correct answer is (c) Your score on this question is: 10.00 Feedback: See section 1.2.3 in the course notes. Go to top of assessment. Your performance was as follows: 1. What information is necessary when specifying the structure of a table? (a) the name of the table, the names of the table's attributes, the data types of attributes, and the formats of attributes (b) the name of the table and the amount of storage space to be allocated to the table (c) the name of the table and the names of the table's attributes (d) the name of the table, the names of the table's attributes, the data types of the table's attributes, the formats of the table's attributes, and the maximum number of rows that the table can have Correct answer is (a) Your score on this question is: 10.00 Feedback: (a) 2. The foreign key in a table T1 _____ the same _____ as the corresponding primary key in table T2. 1 must have, name 2 need not have, name 3 must have, domain (a) I and II (b) II and III (c) I and III (d) I, II, and III Correct answer is (b) Your score on this question is: 10.00 Feedback: (b) 3. The arity of a table is the number of _____ in the table. (a) foreign keys (b) rows (c) keys (d) columns Correct answer is (d) Your score on this question is: 10.00 Feedback: (d) 4. The cardinality of a table is the number of _____ in the table. (a) keys (b) columns (c) rows (d) foreign keys Correct answer is (c) Your score on this question is: 10.00 Feedback: (c) 5. Which of the following SQL statements can be used to create a relational table? (a) INSERT (b) ADD (c) CREATE (d) APPEND Correct answer is (c) Your score on this question is: 10.00 Feedback: (c) 6. The SQL clause to perform a set difference operation is (a) EXCEPT (b) OMIT (c) DIFFER (d) REJECT Correct answer is (a) Your score on this question is: 10.00 Feedback: (a) 7. Which of the following SQL statements can be used to remove a row from a table? (a) ERASE (b) REMOVE (c) DESTROY (d) DELETE Correct answer is (d) Your score on this question is: 10.00 Feedback: (d) 8. Which of the following SQL statements can be used to add a row to a table? (a) ADD (b) APPEND (c) CREATE (d) INSERT Correct answer is (d) Your score on this question is: 10.00 Feedback: (d) 9. What can be specified in the selection condition of a SELECT statement? (a) the time at which the selection should be performed (b) a Boolean operation (c) an arithmetic operat
and involves relatively little movement of keys when nodes join and leave the system. A fundamental problem that confronts peer-to-peer applications is Previous work on consistent hashing assumed that nodes were to efficiently locate the node that stores a particular data item. This aware of most other nodes in the system, making it impractical to paper presents Chord, a distributed lookup protocol that addresses scale to large number of nodes. In contrast, each Chord node needs this problem. Chord provides support for just one operation: given “routing” information about only a few other nodes. Because the a key, it maps the key onto a node. Data location can be easily routing table is distributed, a node resolves the hash function by implemented on top of Chord by associating a key with each data communicating with a few other nodes. In the steady state, in item, and storing the key/data item pair at the node to which the an Æ -node system, each node maintains information only about key maps. Chord adapts efficiently as nodes join and leave the Ç ́ÐÓ Æ μ other nodes, and resolves all lookups via Ç ́ÐÓ Æ μ mes- system, and can answer queries even if the system is continuously sages to other nodes. Chord maintains its routing information as changing. Results from theoretical analysis, simulations, and ex- nodes join and leave the system; with high probability each such event results in no more than Ç ́ÐÓ 3⁄4 Æ μ messages. periments show that Chord is scalable, with communication cost and the state maintained by each node scaling logarithmically with Three features that distinguish Chord from many other peer-to- the number of Chord nodes. peer lookup protocols are its simplicity, provable correctness, and provable performance. Chord is simple, routing a key through a se- quence of Ç ́ÐÓ Æ μ other nodes toward the destination. A Chord node requires information about Ç ́ÐÓ Æ μ other nodes for efficient routing, but performance degrades gracefully when that informa- tion is out of date. This is important in practice because nodes will join and leave arbitrarily, and consistency of even Ç ́ÐÓ Æ μ state may be hard to maintain. Only one piece information per node need be correct in order for Chord to guarantee correct (though slow) routing of queries; Chord has a simple algorithm for maintaining this information in a dynamic environment. The rest of this paper is structured as follows. Section 2 com- pares Chord to related work. Section 3 presents the system model that motivates the Chord protocol. Section 4 presents the base Chord protocol and proves several of its properties, while Section 5 presents extensions to handle concurrent joins and failures. Sec- tion 6 demonstrates our claims about Chord’s performance through simulation and experiments on a deployed prototype. Finally, we outline items for future work in Section 7 and summarize our con- tributions in Section 8.
using System; using System.Collections.Generic; using System.Text; using System.ComponentModel; using System.Data; using System.Drawing; using System.Windows.Forms; using System.Runtime.InteropServices; namespace DS40XXSDK { #region enum /// /// 板卡类型 /// public enum BOARD_TYPE_DS : uint { DS400XM = 0, //M卡 DS400XH = 1, //H卡 DS4004HC = 2, //4004HC DS4008HC = 3, //4008HC DS4016HC = 4, //4016HC DS4001HF = 5, //4001HF DS4004HF = 6, //4004HF DS4002MD = 7, //4002MD DS4004MD = 8, //4004MD DS4016HCS = 9, //4016HCS DS4002HT = 10, //4002HT DS4004HT = 11, //4004HT DS4008HT = 12, //4008HT DS4004HC_PLUS = 13, //4004HC+ DS4008HC_PLUS = 14, //4008HC+ DS4016HC_PLUS = 15, //4016HC+ DS4008HF = 16, //4008HF DS4008MD = 17, //4008MD DS4008HS = 18, //4008HS DS4016HS = 19, //4016HS INVALID_BOARD_TYPE = 0xffffffff, } /// /// 视频预览格式 /// public enum TypeVideoFormat { vdfRGB8A_233 = 0x00000001, vdfRGB8R_332 = 0x00000002, vdfRGB15Alpha = 0x00000004, /// /// 16位RGB视频压缩格式 /// vdfRGB16 = 0x00000008, /// /// 24位RGB视频压缩格式 /// vdfRGB24 = 0x00000010, vdfRGB24Alpha = 0x00000020, vdfYUV420Planar = 0x00000040, /// /// YUV422视频压缩格式 /// vdfYUV422Planar = 0x00000080, vdfYUV411Planar = 0x00000100, vdfYUV420Interspersed = 0x00000200, vdfYUV422Interspersed = 0x00000400, vdfYUV411Interspersed = 0x00000800, vdfYUV422Sequence = 0x00001000, /* U0, Y0, V0, Y1: For VO overlay */ vdfYUV422SequenceAlpha = 0x00002000, /* U0, Y0, V0, Y1: For VO overlay, with low bit for alpha blending */ vdfMono = 0x00004000, /* 8 bit monochrome */ vdfYUV444Planar = 0x00008000, }; /// /// 视频制式 /// public enum VideoStandard_t : uint { /// /// 无视频信号 /// StandardNone = 0x80000000, /// /// NTSC制式 /// StandardNTSC = 0x00000001, /// /// PAL制式 /// StandardPAL = 0x00000002, StandardSECAM = 0x00000004, } ; /// /// 编码图像分辨率 /// public enum PictureFormat_t { ENC_CIF_FORMAT = 0, ENC_QCIF_FORMAT = 1, ENC_2CIF_FORMAT = 2, ENC_4CIF_FORMAT = 3, ENC_QQCIF_FORMAT = 4, ENC_CIFQCIF_FORMAT = 5, ENC_CIFQQCIF_FORMAT = 6, ENC_DCIF_FORMAT = 7 }; /// /// 码流控制方式 /// public enum BitrateControlType_t { /// /// 变码率 /// brCBR = 0, /// /// 恒定码率 /// brVBR = 1, }; public enum FrameType_t { PktError = 0, PktIFrames = 0x0001, PktPFrames = 0x0002, PktBBPFrames = 0x0004, PktAudioFrames = 0x0008, PktMotionDetection = 0x00010, PktDspStatus = 0x00020, PktOrigImage = 0x00040, PktSysHeader = 0x00080, PktBPFrames = 0x00100, PktSFrames = 0x00200, PktSubIFrames = 0x00400, PktSubPFrames = 0x00800, PktSubBBPFrames = 0x01000, PktSubSysHeader = 0x02000 }; #endregion #region struct /// /// 板卡信息结构体 /// public struct DS_BOARD_DETAIL { /// /// 板卡类型 /// BOARD_TYPE_DS type; /// /// 序列号 /// BYTE sn[16]; /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] byte[] sn; /// /// 板卡包含的DSP个数 /// uint dspCount; /// /// 板卡上第一个DSP的索引 /// uint firstDspIndex; /// /// 板卡包含的编码通道个数 /// uint encodeChannelCount; /// /// 板卡上第一个编码通道的索引 /// uint firstEncodeChannelIndex; /// /// 板卡包含的解码通道个数 /// uint decodeChannelCount; /// /// 板卡上第一个解码通道的索引 /// uint firstDecodeChannelIndex; /// /// 板卡包含的视频输出通道个数 /// uint displayChannelCount; /// /// 板卡上第一个视频输出通道的索引 /// uint firstDisplayChannelIndex; uint reserved1; uint reserved2; uint reserved3; /// /// 硬件版本,format:major.minor.build,major:bit 16-19,minor: bit 8-15,build: bit 0-7 /// uint version; } /// /// DSP信息结构体 /// public struct DSP_DETAIL { /// /// 此DSP所包含的编码通道个数 /// uint encodeChannelCount; /// /// 此DSP上第一个编码通道在所有编码通道中的索引 /// uint firstEncodeChannelIndex; /// /// 此DSP所包含的解码通道个数 /// uint decodeChannelCount; /// /// 此DSP上第一个解码通道在所有解码通道中的索引 /// uint firstDecodeChannelIndex; /// /// 此DSP包含的显示通道个数 /// uint displayChannelCount; /// /// 此DSP上第一个显示通道在所有显示通道中的索引 /// uint firstDisplayChannelIndex; uint reserved1; uint reserved2; uint reserved3; uint reserved4; } /// /// 特殊功能结构体 /// public struct CHANNEL_CAPABILITY { /// /// 音频预览 /// byte[] bAudioPreview; /// /// 报警信号 /// byte[] bAlarmIO; /// /// 看家狗 /// byte[] bWatchDog; } /// /// 版本信息 /// public struct PVERSION_INFO { /// /// DSP版本号,DSP的BUILD号,用于软件升级时标明该版本的最后修改时间 /// UInt64 DspVersion, DspBuildNum; /// /// Driver版本号,Driver的BUILD号,用于软件升级时标明该版本的最后修改时间 /// UInt64 DriverVersion, DriverBuildNum; /// /// SDK版本号,SDK的BUILD号,用于软件升级时标明该版本的最后修改时间 /// UInt64 SDKVersion, SDKBuildNum; } /// /// 显示窗口内的矩形区域 /// //[StructLayout(LayoutKind. //public struct RECT //{ // public Int32 left; // public Int32 top; // public Int32 right; // public Int32 bottom; //} /// /// 帧统计信息结构体 /// public struct PFRAMES_STATISTICS { /// /// 视频帧 /// UInt64 VideoFrames; /// /// 音频帧 /// UInt64 AudioFrames; /// /// 丢失帧 /// UInt64 FramesLost; /// /// 丢失的码流(字节) /// UInt64 QueueOverflow; /// /// 当前的帧率(bps) /// UInt64 CurBps; } /// /// 版本信息结构体 /// public struct PHW_VERSION { /// /// DSP程序的版本号和Build号 /// UInt64 DspVersion, DspBuildNum; /// /// 驱动程序的版本号和Build号 /// UInt64 DriverVersion, DriverBuildNum; /// /// SDK 的版本号和Build号 /// UInt64 SDKVersion, SDKBuildNum; } /// /// 系统时间 /// public struct SYSTEMTIME { ushort wYear; ushort wMonth; ushort wDayOfWeek; ushort wDay; ushort wHour; ushort wMinute; ushort wSecond; ushort wMilliseconds; } #endregion #region delegate /// /// 原始图像流设置 /// /// typedef void (*IMAGE_STREAM_CALLBACK)(UINT channelNumber,void *context); /// /// 通道号 /// 设备上下文 public delegate void IMAGE_STREAM_CALLBACK(uint channelNumber, IntPtr context); /// /// 编码数据流直接读取回调函数 /// /// typedef int (*STREAM_DIRECT_READ_CALLBACK)(UInt64 channelNumber,void *DataBuf,DWORD Length,int FrameType,void *context); /// /// 通道号 /// 缓冲区地址 /// 缓冲区长度 /// 缓冲区数据帧类型 /// 设备上下文 /// [UnmanagedFunctionPointer(CallingConvention.Cdecl)] //public delegate int STREAM_DIRECT_READ_CALLBACK(uint channelNumber, byte[] DataBuf, uint Length, FrameType_t FrameType, IntPtr context); public delegate int STREAM_DIRECT_READ_CALLBACK(int channelNumber, IntPtr DataBuf, int Length, FrameType_t FrameType, IntPtr context); //public unsafe delegate int STREAM_DIRECT_READ_CALLBACK(uint channelNumber, void * DataBuf, uint Length, int FrameType, IntPtr context); /// /// 直接读取码流回调函数 /// /// typedef int (*STREAM_READ_CALLBACK)(UInt64 channelNumber, void *context) /// /// 通道号 /// 设备上下文 /// public delegate int STREAM_READ_CALLBACK(UInt64 channelNumber, IntPtr context); /// /// 移动侦测结果回调函数 /// /// typedef void (*MOTION_DETECTION_CALLBACK)(UInt64 channelNumber, BOOL bMotionDetected,void *context) /// /// 通道号 /// /// 移动侦测发生标志,如果当前通道所设置的移动侦测 /// 区域内产生了移动侦测,则被置为True;如果当前通道所设置的移动侦测区域内自上 /// 一次产生移动侦测后delay秒内没有发生移动侦测,则被置为False。 /// /// 设备上下文 public delegate void MOTION_DETECTION_CALLBACK(UInt64 channelNumber, bool bMotionDetected, IntPtr context); /// /// 画图回调函数 /// /// #define DRAWFUN(x) void (CALLBACK* x)(Int32 nPort,HDC hDc,Int32 nUser) /// /// 通道号 /// offscreen表面设备上下文,相当于显示窗口中的DC /// 用户数据 public delegate void DrawFun(Int32 nPort, IntPtr HDC, Int32 nUser); /// /// 解码回调函数 /// /// typedef void (*DECODER_VIDEO_CAPTURE_CALLBACK)(UINT nChannelNumber, void *DataBuf,UINT width,UINT height,UINT nFrameNum,UINT nFrameTime, SYSTEMTIME *pFrameAbsoluteTime,void *context) /// /// 解码通道句柄 /// 缓冲区地址 /// 图像宽度 /// 图像高度 /// 捕获的当前帧的序号 /// 捕获的当前帧的相对时间,单位:毫秒 /// 捕获的当前帧的绝对时间 /// 设备上下文 public delegate void DECODER_VIDEO_CAPTURE_CALLBACK(uint nChannelNumber, IntPtr DataBuf, uint width, uint height, uint nFrameNum, uint nFrameTime, SYSTEMTIME pFrameAbsoluteTime, IntPtr context); /// /// 创建索引完成回调函数 /// /// typedef void (*FILE_REF_DONE_CALLBACK)(UINT nChannel,UINT nSize) /// /// 通道号 /// 索引大小(暂时无效,以后可以增加索引导出、导入功能) public delegate void FILE_REF_DONE_CALLBACK(uint nChannel, uint nSize); #endregion /// /// DS40xxSDK.dll /// public class HikVisionSDK { /// /// 状态 /// public static readonly List state = new List(new string[]{ "", "正在打开", "音频信号丢失", "视频信号丢失", "有物体移动", //0-4 "自动分割录像", "开始录像", "停止录像", "启动声音监听", "停止声音监听", //5-9 "启动视频预览", "停止视频预览", "启动录像", "停止录像", "启动视频报警", //10-14 "关闭视频报警", "启动音频报警", "停止音频报警", "启动移动侦测", "停止移动侦测", //15-19 "启动视频遮挡", "关闭视频遮挡", "开始屏幕输出", "停止屏幕输出", "启动视频LOGO", //20-24 "停止视频LOGO", "开始视频OSD", "停止视频OSD", "切换为黑白视频", "切换为彩色视频", //25-29 "切换为黑屏显示", "切换为白屏显示", "视频色彩复位", "启动全屏显示", "采集卡已经加载", //30-34 "采集卡已经卸截", "视频服务启动成功", "视频服务已停止", "静音", "音量恢复", //35-39 "云台控制命令发送", "系统出现未知错误", "录像文件大小", "配置端口号成功", "连接服务端成功", //40-44 "正在连接", "开始接收图象", "异常退出", "接收完毕,退出", "无法联系服务端", //45-49 "服务端拒绝访问", "无效", "停止客户端连接", "图像抓取成功", "初始化服务端网络连接成功", //50-54 "视频服务启动失败", "退出全屏预览", "", "", "" //55-59 }); //可以用新版函数替代功能或者无效的API //GetTotalChannels:可用GetEncodeChannelCount替代 //GetTotalDSPs:可用GetDspCount 替代 //SetupDateTime:4.0版本起无效 //HW_GetChannelNum:无效,请使用GetBoardDetail //HW_GetDeviceSerialNo:无效,请使用GetBoardDetail //HW_SetVideoOutStandard:无效,请使用SetDisplayStandard或SetDefaultVideoStandard //HW_SetDspDeadlockMsg:无效 //HW_ResetDsp:无效 //HW_SetDisplayPara:DISPLAY_PARA结构中bToVideoOut无效,MD卡模拟视频输出功能 //已经整合到视频矩阵之中。 #region 流类型宏定义 /// /// 视频流 /// #define STREAM_TYPE_VIDEO /// private const int STREAM_TYPE_VIDEO = 1; /// /// 音频流 /// #define STREAM_TYPE_AUDIO /// private const int STREAM_TYPE_AUDIO = 2; /// /// 音视频复合流 /// #define STREAM_TYPE_AVSYNC /// private const int STREAM_TYPE_AVSYNC = 3; #endregion #region 1.板卡初始化及卸载 /// /// 1.1初始化DSP InitDSPs /// 说 明: 初始化系统中每一块板卡,应在应用软件程序启动时完成。如果返回值为0则表 /// 明初始化失败,可能没有找到相应的DSP软件模块。 /// /// int __stdcall InitDSPs() /// /// 系统内可用的编码通道个数。 [DllImport("DS40xxSDK.dll")] public static extern int InitDSPs(); /// /// 1.2卸载DSP DeInitDSPs /// 说 明: 关闭每一块板卡上的功能,应在应用软件程序退出时调用。 /// /// int __stdcall DeInitDSPs() /// /// 0 [DllImport("DS40xxSDK.dll")] public static extern int DeInitDSPs(); #endregion #region 2.板卡信息获取 /// /// 2.1获取系统中板卡的张数GetBoardCount /// 说 明: 获取系统中所有板卡的张数,包含编码卡和解码卡。 /// /// unsigned int __stdcall GetBoardCount() /// /// 系统中板卡的总张数。 [DllImport("DS40xxSDK.dll")] public static extern uint GetBoardCount(); /// /// 2.2获取系统中DSP的个数GetDspCount /// 说 明: 获取系统中所有板卡的DSP的个数。 /// /// unsigned int __stdcall GetDspCount() /// /// 系统中DSP的总个数 [DllImport("DS40xxSDK.dll")] public static extern uint GetDspCount(); /// /// GetTotalDSPs:可用GetDspCount 替代 /// 获得实际可用DSP /// /// [DllImport("DS40xxSDK.dll")] public static extern int GetTotalDSPs(); /// /// 2.3获取系统中编码通道的个数GetEncodeChannelCount /// 说 明: 获取系统中所有编码卡的编码通道总个数,包含H系列和HC系列编码卡。 /// /// unsigned int __stdcall GetEncodeChannelCount() /// /// 系统中编码通道的个数 [DllImport("DS40xxSDK.dll")] public static extern uint GetEncodeChannelCount(); /// /// 2.4获取系统中解码通道的个数GetDecodeChannelCount /// 说 明: 获取系统中MD卡的解码通道个数 /// /// unsigned int __stdcall GetDecodeChannelCount() /// /// [DllImport("DS40xxSDK.dll")] public static extern uint GetDecodeChannelCount(); /// /// 2.5获取系统中解码显示通道的个数GetDisplayChannelCount /// 说 明: 获取系统中MD卡显示通道的个数,即模拟视频输出通道的个数 /// /// unsigned int __stdcall GetDisplayChannelCount() /// /// 系统中显示通道的个数 [DllImport("DS40xxSDK.dll")] public static extern uint GetDisplayChannelCount(); /// /// 2.6获取板卡详细信息GetBoardDetail /// 说 明: 获取某张板卡的详细信息 /// /// int __stdcall GetBoardDetail(UINT boardNum,DS_BOARD_DETAIL *pBoardDetail) /// /// 板卡索引 /// 板卡信息 /// 成功返回0;失败返回错误号 [DllImport("DS40xxSDK.dll")] public static extern int GetBoardDetail(uint boardNum, ref DS_BOARD_DETAIL pBoardDetail); /// /// 2.7获取DSP详细信息GetDspDetail /// 说 明: 获取某个DSP的详细信息 /// /// int __stdcall GetDspDetail(UINT dspNum,DSP_DETAIL *pDspDetail) /// /// DSP索引 /// DSP信息 /// 成功返回0;失败返回错误号 [DllImport("DS40xxSDK.dll")] public static extern int GetDspDetail(uint dspNum, ref DSP_DETAIL pDspDetail); /// /// 2.8获取板卡型号及序列号信息GetBoardInfo /// 说 明: 获取板卡的型号及序列号信息 /// /// int __stdcall GetBoardInfo(HANDLE hChannelHandle, UInt64 *BoardType, UCHAR *SerialNo) /// /// 通道句柄 /// 板卡型号 /// /// 板卡ID号, 内容为板卡序列号的ASCII的数值,次序为SerialNo[0] 对应最高位, /// SerialNo[11]对应最低位。比如卡号为“40000002345”的值对应为 4,0,0,0,0,1,0,0,2,3,4,5 的整形数组。 /// /// 成功为0;失败返回错误号 [DllImport("DS40xxSDK.dll")] public static extern int GetBoardInfo(IntPtr hChannelHandle, UInt64 BoardType, byte[] SerialNo); /// /// 2.9获取板卡特殊功能信息GetCapability /// 说 明: 获取板卡特殊功能信息 /// /// int __stdcall GetCapability(HANDLE hChannelHandle, CHANNEL_CAPABILITY *Capability) /// /// 通道句柄 /// 特殊功能 /// 成功返回0;失败返回错误号 [DllImport("DS40xxSDK.dll")] public static extern int GetCapability(IntPtr hChannelHandle, CHANNEL_CAPABILITY Capability); /// /// 2.10获取板卡SDK信息GetSDKVersion /// 说 明: 获取当前所使用的DSP、Driver、SDK版本号 /// /// int __stdcall GetSDKVersion(PVERSION_INFO VersionInfo) /// /// 版本信息 /// 成功返回0;失败返回错误号。 [DllImport("DS40xxSDK.dll")] public static extern int GetSDKVersion(ref PVERSION_INFO VersionInfo); /// /// 2.11获取板卡SDK及DSP错误报告GetLastErrorNum*,此函数只对H卡有效 /// 说 明: 获取SDK及DSP错误报告。此函数只对H卡有效,用于HC卡上返回0且无效 /// /// int __stdcall GetLastErrorNum(HANDLE hChannelHandle, UInt64 *DspError, UInt64 *SdkError) /// /// 通道句柄 /// DSP错误 /// SDK错误 /// DSP错误信息、SDK错误信息 [DllImport("DS40xxSDK.dll")] public static extern int GetLastErrorNum(IntPtr hChannelHandle, ref int DspError, ref int SdkError); #endregion #region 3.编码卡API #region 3.1通道打开及关闭 /// /// 3.1.1打开通道ChannelOpen /// 说 明: 打开通道,获取编码通道的操作句柄,与通道相关的操作需使用相对应的句柄。 /// /// HANDLE __stdcall ChannelOpen(int ChannelNum) /// /// 通道号(从0开始) /// 成功返回有效句柄(值可能为0);失败返回0xFFFFFFFF。 [DllImport("DS40xxSDK.dll")] public static extern IntPtr ChannelOpen(int ChannelNum); /// /// 3.1.2关闭通道ChannelClose /// 说 明: 关闭通道,释放相关资源 /// /// int __stdcall ChannelClose(HANDLE hChannelHandle) /// /// 通道句柄 /// 成功返回0;失败返回错误号 [DllImport("DS40xxSDK.dll")] public static extern int ChannelClose(IntPtr hChannelHandle); #endregion #region 3.2视频预览 #region 3.2.1 Overlay预览模式 // 释 义: overlay预览模式 //Overlay通常被称为重叠页面或者是覆盖层,是一种需要特定的硬件支持的页面,通常 //被用于显示实时视频于主页面之上,而不需要Blit操作到主页面或用任何方法改变主页面的 //内容。使用该方式进行预览可以提高预览的画质和降低CPU利用率。 /// /// 3.2.1.1设置视频预览模式SetPreviewOverlayMode /// 说 明: SDK自3.2版本起在部分显卡中实现了HC卡以overlay方式预览的功能(此功 /// 能不支持与H卡混插的状态下),可以提高预览的画质和降低CPU利用率。当预览画面小 /// 于704*576时,需要调用该函数来启动overlay模式,如不设置则自动切换到offscreen模式 /// 进行预览显示,当预览画面大于704*576时,SDK自动切换到overlay模式 /// /// int __stdcall SetPreviewOverlayMode(BOOL bTrue) /// /// 是否设置overlay预览方式,也适用于MD卡 /// 0表示显卡支持板卡的overlay预览方式;其他值表示显卡不支持 [DllImport("DS40xxSDK.dll")] public static extern int SetPreviewOverlayMode(bool bTrue); /// /// 3.2.1.2设置overlay关键色SetOverlayColorKey /// 注意:需要在StartVideoPreview前调用该函数。 /// 说 明: 板卡在显示范围小于704*576时,调用SetPreviewOverlayMode可以开启overlay /// 预览模式,需调用SetOverlayColorKey设置overlay关键色;当显示范围大于704*576时, /// 板卡自动切换到overlay预览模式,关键色默认设置为RGB(10,10,10),也可调用 /// SetOverlayColorKey修改关键色。在这两种情况下,都需要将显示窗口的底色设置为和关键 /// 色相一致。否则图像将难以显示。 /// /// /// int __stdcall SetOverlayColorKey(COLORREF DestColorKey) /// /// overlay关键色参数(RGB(*,*,*)) /// 成功返回0;失败返回错误号 [DllImport("DS40xxSDK.dll")] public static extern int SetOverlayColorKey(int DestColorKey); //public static extern int SetOverlayColorKey(Color DestColorKey); /// /// 3.2.1.3恢复当前丢失的表面RestoreOverlay /// 说 明: 恢复当前丢失的表面,例如:当系统按下CTRL+ALT+DEL时系统的OVERLAY /// 表面会被强制关闭,调用该函数可以恢复OVERLAY表面 /// /// int __stdcall RestoreOverlay() /// /// 成功返回0;失败返回错误号 [DllImport("DS40xxSDK.dll")] public static extern int RestoreOverlay(); #endregion #region 3.2.2 开启及停止视频预览 /// /// 3.2.2.1开启视频预览StartVideoPreview /// 说 明: 启动视频预览,调用SetPreviewOverlayMode后,可进行overlay模式预览,否则, /// 将默认采用offscreen模式预览。当画面大于704*576时,SDK自动切换到overlay预览模式。 /// /// int __stdcall StartVideoPreview(HANDLE hChannelHandle,HWND WndHandle, RECT *rect,BOOLEAN bOverlay, int VideoFormat, int FrameRate) /// /// 通道句柄 /// 显示窗口句柄 /// /// 显示窗口内的矩形区域 /// Rect.right 必须为8的倍数 /// Rect.bottom必须为16的倍数 /// /// 是否启用Overlay预览模式 /// 视频预览格式(目前无效) /// 视频预览帧率(PAL:1-25,NTSC:1-30) /// 成功返回0;失败返回错误号 [DllImport("DS40xxSDK.dll")] public static extern int StartVideoPreview(IntPtr hChannelHandle, IntPtr WndHandle, ref Rectangle rect, bool bOverlay, int VideoFormat, int FrameRate); //public static extern int StartVideoPreview(IntPtr hChannelHandle, IntPtr WndHandle, ref RECT rect, bool bOverlay, int VideoFormat, int FrameRate); /// /// 3.2.2.2停止视频预览StopVideoPreview /// 说 明: 停止视频预览 /// /// int __stdcall StopVideoPreview(HANDLE hChannelHandle) /// /// 通道句柄 /// 成功返回0;失败返回错误号 [DllImport("DS40xxSDK.dll")] public static extern int StopVideoPreview(IntPtr hChannelHandle); #endregion #region 3.2.3 视频参数的设置及获取 /// /// 3.2.3.1设置视频参数SetVideoPara /// 说 明: 设置视频参数 /// /// int __stdcall SetVideoPara(HANDLE hChannelHandle, int Brightness, int Contrast, int Saturation, int Hue) /// /// 通道句柄 /// 亮度值(0-255) /// 对比度(0-127) /// 饱和度(0-127) /// 色调(0-255) /// 成功返回0;失败返回错误号 [DllImport("DS40xxSDK.dll")] public static extern int SetVideoPara(IntPtr hChannelHandle, int Brightness, int Contrast, int Saturation, int Hue); /// /// 3.2.3.2获取视频参数GetVideoPara /// 说 明: 获取视频参数 /// /// int __stdcall GetVideoPara(HANDLE hChannelHandle, VideoStandard_t *VideoStandard, int*Brightness, int *Contrast, int *Saturation, int *Hue) /// /// 通道句柄 /// 视频制式 /// 亮度指针值(0-255) /// 对比度指针值(0-127) /// 饱和度指针值(0-127) /// 色调指针值(0-255) /// 成功返回0;失败返回错误号 [DllImport("DS40xxSDK.dll")] public static extern int GetVideoPara(IntPtr hChannelHandle, VideoStandard_t VideoStandard, out int Brightness, out int Contrast, out int Saturation, out int Hue); #endregion #endregion #region 3.3视频信号设置(制式、状况、输入位置等) /// /// 3.3.1设置视频制式SetVideoStandard,此函数只对H卡有效 /// 说 明: 设置视频制式,在某一制式的摄像头已经接好的情况下启动系统时可不必调用该 /// 函数,如果没有接摄像头的情况下启动系统然后再接NTSC制式的摄像头则必须调用该函 /// 数,或者中途调换不同制式的摄像头也必须调用该函数。 /// /// int __stdcall SetVideoStandard(HANDLE hChannelHandle, VideoStandard_t VideoStandard) /// /// 通道句柄 /// 视频制式 /// 成功返回0;失败返回错误号 [DllImport("DS40xxSDK.dll")] public static extern int SetVideoStandard(IntPtr hChannelHandle, VideoStandard_t VideoStandard); /// /// 3.3.2设置系统默认的视频制式SetDefaultVideoStandard /// 注意:该函数只能在系统初始化(InitDSPs)之前运行,否则无效 /// 说 明: 设置系统默认的视频制式,系统中所有的视频输入通道如果无视频输入或者在系 /// 统启动的时候,通道会按照所设置的系统默认视频制式进行处理。 /// /// int __stdcall SetDefaultVideoStandard(VideoStandard_t VideoStandard) /// /// 视频制式,默认为PAL /// 成功返回0;失败返回错误号 [DllImport("DS40xxSDK.dll")] public static extern int SetDefaultVideoStandard(VideoStandard_t VideoStandard); /// /// 3.3.3设置视频信号灵敏度SetVideoDetectPrecision /// 说 明: 设置视频信号检测的灵敏度。如果视频信号的强度比较弱,或者信号通断的切换 /// 比较频繁,会出现“无视频信号”的提示字样,为了避免提示字样影响图像,可以更改视频 /// 信号检测的灵敏度。灵敏度取值越大,检测精度越低,出现“无视频信号”提示字样的频率 /// 越低。当将value值设置为0xffffffff时,将不会再出现“无视频信号”的提示字样。 /// /// int __stdcall SetVideoDetectPrecision(HANDLE hChannel,unsigned int value) /// /// 通道句柄 /// 灵敏度。取值范围:0-100,默认为20 /// 成功返回0;失败返回错误号 [DllImport("DS40xxSDK.dll")] public static extern int SetVideoDetectPrecision(IntPtr hChannel, uint value); /// /// 3.3.4获取视频信号输入情况GetVideoSignal /// 说 明: 获取视频信号的输入情况,用于视频丢失报警 /// /// int __stdcall GetVideoSignal(HANDLE hChannelHandle) /// /// 通道句柄 /// 信号正常返回0;返回其他值说明信号异常或有错误 [DllImport("DS40xxSDK.dll")] public static extern int GetVideoSignal(IntPtr hChannelHandle); /// /// 3.3.5调整视频信号输入位置SetInputVideoPosition /// 说 明: 设置视频信号的输入位置。(x,y)为系统处理图像的左上角在摄像机输入的原 /// 始图像中的坐标,某些摄像机输入的图像在预览时可能在左边会有黑边,可以通过此函数进 /// 行调节,x必须设置为2的整数倍。(x,y)的取值和摄像机的型号有关,如果指定的值和 /// 摄像机的输入参数不匹配,可能会导致图像静止、水平垂直方向滚动或者黑屏,请谨慎使用。 /// /// int __stdcall SetInputVideoPosition(HANDLE hChannel,UINT x,UINT y) /// /// 通道句柄 /// X轴坐标,默认值为8 /// Y轴坐标,默认值为2 /// 成功返回0;失败返回错误号 [DllImport("DS40xxSDK.dll")] public static extern int SetInputVideoPosition(IntPtr hChannel, uint x, uint y); /// /// 3.3.6设置反隔行变换及强度SetDeInterlace /// 说 明: 设置是否采用反隔行算法,已经采用反隔行时的强度 /// /// 释 义: 反隔行变换 /// 如果该通道的图像需要进行4CIF的预览或编码,此时的图像中会同时包含奇、偶两 /// 场的数据,由于奇场图像和偶场图像不同步,导致图像中运动的部分发生错位、边缘模糊, /// 此时需要对图像进行反隔行变换来去掉这种现象。如果用户能够确定使用的是逐行扫描格式 /// 的摄像机,或者主要应用在静止场景,此时可以关掉反隔行变换功能,或者降低强度,这样 /// 可以提高系统运行效率,并降低反隔行变换对图像质量带来的损失。 /// /// int __stdcall SetDeInterlace(HANDLE hChannelHandle,UINT mode,UINT level) /// /// 通道句柄 /// /// 0表示该通道不进行反隔行变换,此时level参数无效; /// 1表示使用旧的算法; /// 2表示使用默认算法(系统默认值)。 /// /// /// mode=1时有效,其它时无效。 /// 0-10,反隔行变换的强度逐渐加强,0最弱,对图像的损失最小,10最强,对图像的损失最大。 /// /// 成功返回0;失败返回错误号 [DllImport("DS40xxSDK.dll")] public static extern int SetDeInterlace(IntPtr hChannelHandle, uint mode, uint level); #endregion #region 3.4视频编码参数设置 // 释 义: 双编码功能(主、子通道) // 对一路视频图像进行两路视频编码,两路视频可以有不同的码流类型、不同分辨率、不 //同码率等。3.0版本对双编码功能做了增强,子通道的所有参数都可以任意设置。 //双编码中主通道和子通道唯一的区别在于:子通道占用的系统资源比主通道少,优先级 //比主通道低。当系统忙时,会尽量保证主通道编码,并先从子通道开始丢帧。由于占用资源 //少,因此可以利用子通道来实现多路高分辨率的非实时编码。例如:可以把DS-4000HC中 //的每个子通道全部设置为4CIF分辨率(SetSubStreamType),而不使用主通道编码,这样就 //可以实现全部通道的4CIF编码。在一般场景下,每路图像都可以达到15帧以上。 /// /// 3.4.1主、子通道切换SetupSubChannel /// 说 明: 配合双编码模式使用。当设置某个通道为双编码模式时,如主通道编码CIF,子 /// 通道编码QCIF,这时可对主/子通道分别设置某些参数。关键帧间隔、OSD、LOGO等参数 /// 对主/子通道是一样的;在设置帧率、量化系数、变码流/定码流模式、码流大小等参数时应 /// 调用此函数分别对主/子通道进行设置,缺省是对主通道进行设置 /// /// int __stdcall SetupSubChannel(HANDLE hChannelHandle, int iSubChannel) /// /// 通道句柄 /// 子通道号(0表示主通道,1表示主通道) /// 成功返回0;失败返回错误号 [DllImport("DS40xxSDK.dll")] public static extern int SetupSubChannel(IntPtr hChannelHandle, int iSubChannel); /// /// 3.4.2获取双编码时数据流类型GetSubChannelStreamType /// 说 明: 配合双编码模式使用,当设置双编码模式时,启动录像后,DSP会向上送两种 /// 数据流,调用此函数得到主通道和子通道的数据流类型,供应用程序使用。 /// /// int __stdcall GetSubChannelStreamType(void *DataBuf, int FrameType) /// /// 数据缓存区 /// 帧类型 /// /// 0 其他数据 /// 1 主通道数据流的文件头 /// 2 子通道数据流的文件头 /// 3 主通道数据流的视频帧类型 /// 4 子通道数据流的视频帧类型 /// 5 数据流的音频帧 /// [DllImport("DS40xxSDK.dll")] public static extern int GetSubChannelStreamType(IntPtr DataBuf, int FrameType); #region 3.4.3编码流类型的设置及获取(不支持动态修改) /// /// 3.4.3.1设置主通道编码流类型SetStreamType /// 说 明: 设置主通道编码流类型。此函数需在启动编码前进行设置 /// /// int __stdcall SetStreamType(HANDLE hChannelHandle, USHORT Type) /// /// 通道句柄 /// 流类型 /// 成功返回0;失败返回错误号 [DllImport("DS40xxSDK.dll")] public static extern int SetStreamType(IntPtr hChannelHandle, ushort Type); /// /// 3.4.3.2获取主通道编码流类型GetStreamType /// 说 明: 获取主通道编码流类型 /// /// int __stdcall GetStreamType(HANDLE hChannelHandle, USHORT *StreamType) /// /// 通道句柄 /// 流类型 /// 成功返回0;失败返回错误号 [DllImport("DS40xxSDK.dll")] public static extern int GetStreamType(IntPtr hChannelHandle, ref ushort StreamType); /// /// 3.4.3.3设置子通道编码流类型SetSubStreamType /// 说 明: 设置子通道编码流类型,此函数需在启动编码前进行设置 /// /// int __stdcall SetSubStreamType(HANDLE hChannelHandle, USHORT Type) /// /// 通道句柄 /// 流类型 /// 成功返回0;失败返回错误号 [DllImport("DS40xxSDK.dll")] public static extern int SetSubStreamType(IntPtr hChannelHandle, ref ushort Type); /// /// 3.4.3.4获取子通道编码流类型GetSubStreamType /// 说 明: 获取子通道编码流类型 /// /// int __stdcall GetSubStreamType(HANDLE hChannelHandle, USHORT *StreamType) /// /// 通道句柄 /// 流类型 /// [DllImport("DS40xxSDK.dll")] public static extern int GetSubStreamType(IntPtr hChannelHandle, ref ushort StreamType); #endregion #region 3.4.4(支持动态修改)的编码参数设置 /// /// 3.4.4.1设置编码图像质量SetDefaultQuant /// 说 明: 设置图像量化系数,用于调整图像质量。量化系数越小图像质量越高。系统默认量化系数值为18,18,23。 /// 释 义: 量化系数 /// 量化系数是强烈影响MPEG标准中编码图像质量和码率的参数,当量化系数越低,图 /// 像质量就会越高,码率也就越高,反之,图形质量就会越低,码率也就越低 /// /// int __stdcall SetDefaultQuant(HANDLE hChannelHandle, int IQuantVal, int PQuantVal, int BQuantVal) /// /// 通道句柄 /// I帧量化系数,取值范围:12-30 /// P帧量化系数。取值范围:12-30(目前无效) /// B帧量化系数。取值范围:12-30(目前无效) /// 成功返回0;失败返回错误号 [DllImport("DS40xxSDK.dll")] public static extern int SetDefaultQuant(IntPtr hChannelHandle, int IQuantVal, int PQuantVal, int BQuantVal); /// /// 3.4.4.2设置编码帧结构、帧率SetIBPMode /// 说 明: 设置编码帧结构和帧率。支持动态修改 /// 释 义: 关键帧间隔 /// 关键帧为编码码流中采用帧内压缩的图像帧,其特点是图像清晰度好,但数据量大,通 /// 常作为帧间编码的原始参考帧。关键帧间隔是连续的帧间编码的帧个数,因H264(MPEG4) /// 编码是有损压缩,关键帧的个数会影响图像质量,因此关键帧的间隔需要合理设计。 /// /// int __stdcall SetIBPMode(HANDLE hChannelHandle, int KeyFrameIntervals, int BFrames, int PFrames, int FrameRate) /// /// 通道句柄 /// 关键帧间隔。取值范围1-400,系统默认为100 /// B帧数量,取值为0或者2,系统默认为2 /// P帧数量。目前暂取值无效 /// 帧率,帧率范围1-25(PAL)、1-30(NTSC) /// 成功返回0;失败返回错误号 [DllImport("DS40xxSDK.dll")] public static extern int SetIBPMode(IntPtr hChannelHandle, int KeyFrameIntervals, int BFrames, int PFrames, int FrameRate); #region 3.4.4.3设置编码分辨率 /// /// 3.4.4.3.1设置主通道分辨率SetEncoderPictureFormat /// 说 明: 设置主通道编码分辨率。支持动态修改。 /// /// int __stdcall SetEncoderPictureFormat(HANDLE hChannelHandle, PictureFormat_t PictureFormat) /// /// 通道句柄 /// 编码图像分辨率(4CIF、DCIF、2CIF、CIF、QCIF) /// 成功返回0;失败返回错误号 [DllImport("DS40xxSDK.dll")] public static extern int SetEncoderPictureFormat(IntPtr hChannelHandle, PictureFormat_t PictureFormat); /// /// 3.4.4.3.2设置子通道编码分辨率SetSubEncoderPictureFormat /// 说 明: 设置双编码模式时子通道的编码分辨率,支持动态修改。 /// /// int __stdcall SetSubEncoderPictureFormat(HANDLE hChannelHandle, PictureFormat_t PictureFormat) /// /// 子通道句柄 /// 子通道编码图像分辨率(4CIF、DCIF、2CIF、CIF、 QCIF) /// 成功返回0;失败返回错误号 [DllImport("DS40xxSDK.dll")] public static extern int SetSubEncoderPictureFormat(IntPtr hChannelHandle, PictureFormat_t PictureFormat); #endregion #region 3.4.4.4设置码率及码流控制模式 /// /// 3.4.4.4.1设置码流最大比特率SetupBitrateControl /// 说 明: 设置编码的最大比特率。设置为0时码流控制无效,设置为某一最大比特率时, /// 当编码码流超过该值时,DSP会自动调整编码参数来保证不超过最大比特率,当编码码流 /// 低于最大比特率时,DSP不进行干涉。调整误差<10% /// /// int __stdcall SetupBitrateControl(HANDLE hChannelHandle, UInt64 MaxBps) /// /// 通道句柄 /// 最大比特率。取值:10000以上 /// 成功返回0;失败返回错误号 [DllImport("DS40xxSDK.dll")] public static extern int SetupBitrateControl(IntPtr hChannelHandle, Int32 MaxBps); /// /// 3.4.4.4.2设置码流控制方式SetBitrateControlMode /// 说 明: 设置编码码流控制方式。配合SetupBitrateControl使用。当设置为变码率(brVBR) /// 时,最大比特率将作为编码码流上限,由DSP在码流上限下自动控制码率,一般会自动回 /// 落到最低的状态(由设定的图像质量参数和关键帧间隔决定),能最大程度地降低带宽和存 /// 储空间,但存储容量一般难以估算;当设置为定码率(brCBR)时,以最大比特率作为编码 /// 码率参数恒定输出码流,不会自动回落到低码流状态,存储容量可根据设定码率的大小进行估算。 /// /// int __stdcall SetBitrateControlMode(HANDLE hChannelHandle, BitrateControlType_t brc) /// /// 通道句柄 /// 码流控制方式,分为变码率(brVBR)和恒定码率 (brCBR)两种方式 /// 成功返回0;失败返回错误号 [DllImport("DS40xxSDK.dll")] public static extern int SetBitrateControlMode(IntPtr hChannelHandle, BitrateControlType_t brc); #endregion /// /// 3.4.5强制设定I帧CaptureIFrame /// 说 明: 将当前编码帧强制设定为I帧模式,可从码流中提取该帧单独用于网络传送。 /// /// int __stdcall CaptureIFrame(HANDLE hChannelHandle) /// /// 通道句柄 /// 成功返回0;失败返回错误号 [DllImport("DS40xxSDK.dll")] public static extern int CaptureIFrame(IntPtr hChannelHandle); /// /// 3.4.6获取帧统计信息GetFramesStatistics /// 说 明: 获取帧统计信息 /// /// int __stdcall GetFramesStatistics(HANDLE hChannelHandle,PFRAMES_STATISTICS framesStatistics) /// /// 通道句柄 /// 帧统计信息 /// 成功返回0;失败返回错误号 [DllImport("DS40xxSDK.dll")] public static extern int GetFramesStatistics(IntPtr hChannelHandle, PFRAMES_STATISTICS framesStatistics); #endregion #endregion #region 3.5数据捕获 #region 3.5.1抓图(获取单帧图像数据) #region 3.5.1.1抓取BMP格式图像 /// /// 3.5.1.1.1获取原始yuv422格式数据GetOriginalImage /// 说 明: 获得原始yuv422格式图像,DS4000HC原始图像是4CIF图像格式(包括QCIF编码), /// DS-4000HS原始图像为CIF图像格式,DS400xH卡的原始图象是CIF图象格式。 /// /// int __stdcall GetOriginalImage(HANDLE hChannelHandle, UCHAR *ImageBuf, UInt64 *Size) /// /// 通道句柄 /// 原始yuv422格式图像指针 /// 原始yuv422格式图像尺寸,函数调用前是ImageBuf的大小,调用后是实际图像所占用的字节数 /// 成功返回0,失败返回错误号 [DllImport("DS40xxSDK.dll")] public static extern int GetOriginalImage(IntPtr hChannelHandle, byte[] ImageBuf, out int Size); /// /// 3.5.1.1.2图像格式转换YUVtoBMP SaveYUVToBmpFile /// 说 明: 用户程序可调用此函数来生成24位的bmp文件,如果是DS4000HC卡抓图则 /// Width 为704,Height 为576PAL/480NTSC,如果是DS400xH卡抓图则Width可能为352 /// 或176,Height为288、240、144或120,要根据缓冲区的大小来判断。 /// /// int __stdcall SaveYUVToBmpFile(char *FileName, unsigned char *yuv, int Width, int Height) /// /// 文件名 /// yuv422格式图像指针 /// 图像宽度 /// 图像高度 /// [DllImport("DS40xxSDK.dll")] public static extern int SaveYUVToBmpFile(string FileName, byte[] yuv, int Width, int Height); /// /// 3.5.1.2抓取JPEG格式图像GetJpegImage /// 说 明: 抓取JPEG格式图像 /// /// int __stdcall GetJpegImage(HANDLE hChannelHandle,UCHAR *ImageBuf, UInt64 *Size,UINT nQuality) /// /// 通道句柄 /// JPEG图像指针 /// JPEG图像尺寸,函数调用前是ImageBuf的大小,调用后是实际图像所占用的字节数 /// JPEG图像质量,取值范围1-100,取值100时质量最好 /// [DllImport("DS40xxSDK.dll")] public static extern int GetJpegImage(IntPtr hChannelHandle, byte[] ImageBuf, out int Size, uint nQuality); #endregion #region 3.5.2原始图像数据流捕获(获取YUV420格式数据流) /// /// 3.5.2.1注册原始图像数据流回调函数RegisterImageStreamCallback /// 说 明: 注册获取原始图像数据流函数,用户可以获取实时的YUV420格式的预览数据 /// /// int __stdcall RegisterImageStreamCallback (IMAGE_STREAM_CALLBACK ImageStreamCallback,void *context) /// /// 原始图像数据流回调函数 /// 设备上下文 /// 成功返回0;失败返回错误号 [DllImport("DS40xxSDK.dll")] public static extern int RegisterImageStreamCallback(IMAGE_STREAM_CALLBACK ImageStreamCallback, IntPtr context); /// /// 3.5.2.2开启及停止原始数据流捕获SetImageStream /// 说明: 开启或停止原始图像数据流捕获,此函数依赖主机的处理速度。DS-4000HS只能捕获不大于CIF格式的数据流 /// /// 函 数: int __stdcall SetImageStream(HANDLE hChannel,BOOL bStart,UINT fps, UINT width,UINT height,unsigned char *imageBuffer) /// /// 通道句柄 /// 是否启动捕获 /// 帧率 /// 图像宽度,必须是4CIF宽度的1/8,1/4,1/2或原始大小704 /// 图象高度,必须是4CIF高度的1/8,1/4,1/2或原始大小576PAL/480NTSC /// 数据存储缓存 /// 成功返回0;失败返回错误号 [DllImport("DS40xxSDK.dll")] public static extern int SetImageStream(IntPtr hChannel, bool bStart, uint fps, uint width, uint height, char[] imageBuffer); #endregion #region 3.5.3编码数据流捕获(获取编码后H.264格式数据流)即录像 //注意:注册直接回调或者消息回调后,需要启动编码数据流捕获函数才能进行数据回调。三 //种数据回调方式,只需选取其中一种使用即可。对于HC系列板卡(包括HC、HC+、HCS、 //HS),推荐使用第一种读取方式。对于H系列板卡,只能使用后两种读取方式。 #region 3.5.3.1编码数据流捕获方式设置 /// /// 3.5.3.1.1.1注册编码图像数据流直接读取回调函数 /// 说 明: DS4000HC系列板卡新增的一种数据流读取方式,当启动数据捕获后, /// StreamDirectReadCallback会提供数据流的地址、长度、帧类型等,供用户程序直接处理。 /// /// 函 数: int __stdcall RegisterStreamDirectReadCallback (STREAM_DIRECT_READ_CALLBACK StreamDirectReadCallback,void *Context) /// /// 编码数据流直接读取回调函数 /// 设备上下文 /// 成功返回0;失败返回错误号 [DllImport("DS40xxSDK.dll")] public static extern int RegisterStreamDirectReadCallback(STREAM_DIRECT_READ_CALLBACK StreamDirectReadCallback, IntPtr context); #endregion #region 3.5.3.1.2方式二、消息读取方式 /// /// 3.5.3.1.2.1设置消息读取伐值,此函数只对H卡有效 /// 说 明: 设置消息读取的伐值,可以将缓冲区的数据在OnDataReady中一次性取走 /// /// int __stdcall SetupNotifyThreshold(HANDLE hChannelHandle, int iFramesThreshold) /// /// 通道句柄 /// 读取消息伐值,范围1-10 /// 成功返回0;失败返回错误号 [DllImport("DS40xxSDK.dll")] public static extern int SetupNotifyThreshold(IntPtr hChannelHandle, int iFramesThreshold); /// /// 3.5.3.1.2.2注册消息读取码流函数 /// 说 明: 当数据准备好时,SDK会向hWnd窗口发送MessageId消息,目标窗口收到 /// Message后调用ReadStreamData读取一帧数据。如果HC卡与H卡混插,可以先调用 /// RegisterStreamDirectReadCallback函数来注册HC卡取码流回调函数,再调用 /// RegisterMessageNotifyHandle函数来注册H卡取码流消息函数。 /// HC系列板卡建议使用方式一进行数据捕获。 /// /// int __stdcall RegisterMessageNotifyHandle(HWND hWnd, UINT MessageId) /// /// 通道句柄 /// 自定义消息 /// 成功返回0;失败返回错误号 [DllImport("DS40xxSDK.dll")] public static extern int RegisterMessageNotifyHandle(IntPtr hWnd, uint MessageId); #endregion #region 3.5.3.1.3方式三、另一种直接读取方式 /// /// 3.5.3.1.3.1注册直接读取码流回调函数 /// 说 明: 另一种数据流读取方式 /// /// int __stdcall RegisterStreamReadCallback (STREAM_READ_CALLBACK StreamReadCallback, void *Context) /// /// 直接读取码流回调函数 /// 设备上下文 /// 成功返回0;失败返回错误号 [DllImport("DS40xxSDK.dll")] public static extern int RegisterStreamReadCallback(STREAM_READ_CALLBACK StreamReadCallback, IntPtr Context); #endregion /// /// 3.5.3.2读取码流函数 /// 说 明: 读指定长度的数据流,适用于方式二及方式三。当调用StartVideoCapture 或 /// StartMotionDetection后,SDK线程会向已注册的用户窗口消息处理函数发送指定的消息, /// 并提供消息来源的通道号。当用户程序收到该消息时,可调用本函数来读取数据,Length 在 /// 作为输入时必须提供缓冲的大小,ReadStreamData会判断缓冲是否足够,如果缓冲足够大 /// 则返回值为当前的读取的帧长度,否则返回错误。 /// 在HC卡中,如果已经先调用了RegisterStreamDirectReadCallback()函数,则不需调用 /// ReadStreamData来读取数据,因为音视频数据会在RegisterStreamDirectReadCallback所注册 /// 的回调函数中直接返回。 /// /// int __stdcall ReadStreamData(HANDLE hChannelHandle, void *DataBuf, DWORD *Length, int *FrameType) /// /// 通道句柄 /// 自定义的数据缓存区 /// 输入:缓存区的大小;输出:一帧数据的大小 /// 帧类型 /// 成功返回0;失败返回错误号 [DllImport("DS40xxSDK.dll")] public static extern int ReadStreamData(IntPtr hChannelHandle, byte[] DataBuf, out UInt64 Length, out int FrameType); #region 3.5.3.3开启及停止录像 /// /// 3.5.3.3.1启动主通道编码数据流捕获 /// 说 明: 启动主通道编码数据流捕获。用户程序可以使用直接读取方式,使用 /// StreamDirectReadCallback回调函数直接对数据流进行处理;也可以与H卡一样,通过消息 /// 读取方式,等SDK向用户程序发送在RegisterMessageNotifyHandle中注册的消息,用户程 /// 序使用ReadStreamData来读取数据流。 /// /// int __stdcall StartVideoCapture(HANDLE hChannelHandle) /// /// 通道句柄 /// 成功返回0;失败返回错误号 [DllImport("DS40xxSDK.dll")] public static extern int StartVideoCapture(IntPtr hChannelHandle); /// /// 3.5.3.3.2停止主通道编码数据流捕获 /// 说 明: 停止主通道编码数据流捕获 /// /// int __stdcall StopVideoCapture(HANDLE hChannelHandle) /// /// 通道句柄 /// 成功返回0;失败返回错误号 [DllImport("DS40xxSDK.dll")] public static extern int StopVideoCapture(IntPtr hChannelHandle); /// /// 3.5.3.3.3启动子通道编码数据流捕获 /// 说 明: 启动子通道编码数据流捕获 /// /// int __stdcall StartSubVideoCapture(HANDLE hChannelHandle) /// /// 通道句柄 /// 成功返回0;失败返回错误号 [DllImport("DS40xxSDK.dll")] public static extern int StartSubVideoCapture(IntPtr hChannelHandle); /// /// 3.5.3.3.4停止子通道编码数据流捕获 /// 说 明: 停止子通道编码数据流捕获 /// /// int __stdcall StopSubVideoCapture(HANDLE hChannelHandle) /// /// 通道句柄 /// 成功返回0;失败返回错误号 [DllImport("DS40xxSDK.dll")] public static extern int StopSubVideoCapture(IntPtr hChannelHandle); #endregion #endregion #endregion #endregion #region 3.6移动侦测 // 释 义: 移动侦测 //DS4000HC提供运动强度信息来处理运动检测,设置移动侦测区域时以32*32像素块为 //单位,按4CIF(704*576)分辨率计算,每行有22个块(704/32),PAL时18行(576/32), //NTSC时15行(480/32),与编码格式无关。经过测试,这种方法比H卡提高了灵敏度和可 //靠性,并简化了返回的数据,返回的值是18个DWORD,对应屏幕高度576/32=18行(PAL), //每个DWORD的0-21位对应屏幕宽度704/32=22, 其中1为运动,0为静止,也可以调用原有 //MotionAnalyzer分析结果 //4.0版本的SDK新增了接口函数SetupMotionDetectionEx,
发帖
网络编程

1.8w+

社区成员

VC/MFC 网络编程
c++c语言开发语言 技术论坛(原bbs)
社区管理员
  • 网络编程
加入社区
帖子事件
创建了帖子
2005-07-27 09:48
社区公告
暂无公告